[TS] Update auto-generated TS bindings
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(uint32_t, uint32_t);
56 DECL_ARR_TYPE(void*, ptr);
57 DECL_ARR_TYPE(char, char);
58 typedef charArray jstring;
59
60 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
61         charArray arr = init_charArray(len, __LINE__);
62         memcpy(arr->elems, chars, len);
63         return arr;
64 }
65 static inline LDKStr str_ref_to_owned_c(const jstring str) {
66         char* newchars = MALLOC(str->arr_len + 1, "String chars");
67         memcpy(newchars, str->elems, str->arr_len);
68         newchars[str->arr_len] = 0;
69         LDKStr res = {
70                 .chars = newchars,
71                 .len = str->arr_len,
72                 .chars_is_owned = true
73         };
74         return res;
75 }
76
77 typedef bool jboolean;
78
79 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
80         return (uint32_t)MALLOC(size, "JS-Called malloc");
81 }
82 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
83         FREE((void*)ptr);
84 }
85
86 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
87         const char *res = check_get_ldk_bindings_version();
88         if (res == NULL) return NULL;
89         return str_ref_to_ts(res, strlen(res));
90 }
91 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
92         const char *res = check_get_ldk_version();
93         if (res == NULL) return NULL;
94         return str_ref_to_ts(res, strlen(res));
95 }
96 #include "version.c"
97 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
98
99 static inline void* untag_ptr(uint64_t ptr) {
100         if (ptr < 4096) return (void*)ptr;
101         if (sizeof(void*) == 4) {
102                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
103                 return (void*)(uintptr_t)ptr;
104         } else {
105                 // For 64-bit systems, assume the top byte is used for tagging, then
106                 // use bit 9 ^ bit 10.
107                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
108                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
109 #ifdef LDK_DEBUG_BUILD
110                 // On debug builds we also use the 11th bit as a debug flag
111                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
112                 CHECK(tenth_bit != eleventh_bit);
113                 p ^= 1ULL << 53;
114 #endif
115                 return (void*)p;
116         }
117 }
118 static inline bool ptr_is_owned(uint64_t ptr) {
119         if(ptr < 4096) return true;
120         if (sizeof(void*) == 4) {
121                 return ptr & (1ULL << 32);
122         } else {
123                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
124                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
125 #ifdef LDK_DEBUG_BUILD
126                 // On debug builds we also use the 11th bit as a debug flag
127                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
128                 CHECK(tenth_bit != eleventh_bit);
129 #endif
130                 return (ninth_bit ^ tenth_bit) ? true : false;
131         }
132 }
133 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
134         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
135         if (sizeof(void*) == 4) {
136                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
137         } else {
138                 CHECK(sizeof(uintptr_t) == 8);
139                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
140                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
141 #ifdef LDK_DEBUG_BUILD
142                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
143                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
144                 CHECK(ninth_bit == tenth_bit);
145                 CHECK(ninth_bit == eleventh_bit);
146                 t ^= 1ULL << 53;
147 #endif
148                 CHECK(ptr_is_owned(t) == is_owned);
149                 CHECK(untag_ptr(t) == ptr);
150                 return t;
151         }
152 }
153
154 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
155         switch (ord) {
156                 case 0: return LDKAccessError_UnknownChain;
157                 case 1: return LDKAccessError_UnknownTx;
158         }
159         abort();
160 }
161 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
162         switch (val) {
163                 case LDKAccessError_UnknownChain: return 0;
164                 case LDKAccessError_UnknownTx: return 1;
165                 default: abort();
166         }
167 }
168 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
169         switch (ord) {
170                 case 0: return LDKCOption_NoneZ_Some;
171                 case 1: return LDKCOption_NoneZ_None;
172         }
173         abort();
174 }
175 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
176         switch (val) {
177                 case LDKCOption_NoneZ_Some: return 0;
178                 case LDKCOption_NoneZ_None: return 1;
179                 default: abort();
180         }
181 }
182 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
183         switch (ord) {
184                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
185                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
186                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
187         }
188         abort();
189 }
190 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
191         switch (val) {
192                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
193                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
194                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
195                 default: abort();
196         }
197 }
198 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
199         switch (ord) {
200                 case 0: return LDKConfirmationTarget_Background;
201                 case 1: return LDKConfirmationTarget_Normal;
202                 case 2: return LDKConfirmationTarget_HighPriority;
203         }
204         abort();
205 }
206 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
207         switch (val) {
208                 case LDKConfirmationTarget_Background: return 0;
209                 case LDKConfirmationTarget_Normal: return 1;
210                 case LDKConfirmationTarget_HighPriority: return 2;
211                 default: abort();
212         }
213 }
214 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
215         switch (ord) {
216                 case 0: return LDKCreationError_DescriptionTooLong;
217                 case 1: return LDKCreationError_RouteTooLong;
218                 case 2: return LDKCreationError_TimestampOutOfBounds;
219                 case 3: return LDKCreationError_InvalidAmount;
220                 case 4: return LDKCreationError_MissingRouteHints;
221         }
222         abort();
223 }
224 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
225         switch (val) {
226                 case LDKCreationError_DescriptionTooLong: return 0;
227                 case LDKCreationError_RouteTooLong: return 1;
228                 case LDKCreationError_TimestampOutOfBounds: return 2;
229                 case LDKCreationError_InvalidAmount: return 3;
230                 case LDKCreationError_MissingRouteHints: return 4;
231                 default: abort();
232         }
233 }
234 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
235         switch (ord) {
236                 case 0: return LDKCurrency_Bitcoin;
237                 case 1: return LDKCurrency_BitcoinTestnet;
238                 case 2: return LDKCurrency_Regtest;
239                 case 3: return LDKCurrency_Simnet;
240                 case 4: return LDKCurrency_Signet;
241         }
242         abort();
243 }
244 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
245         switch (val) {
246                 case LDKCurrency_Bitcoin: return 0;
247                 case LDKCurrency_BitcoinTestnet: return 1;
248                 case LDKCurrency_Regtest: return 2;
249                 case LDKCurrency_Simnet: return 3;
250                 case LDKCurrency_Signet: return 4;
251                 default: abort();
252         }
253 }
254 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
255         switch (ord) {
256                 case 0: return LDKIOError_NotFound;
257                 case 1: return LDKIOError_PermissionDenied;
258                 case 2: return LDKIOError_ConnectionRefused;
259                 case 3: return LDKIOError_ConnectionReset;
260                 case 4: return LDKIOError_ConnectionAborted;
261                 case 5: return LDKIOError_NotConnected;
262                 case 6: return LDKIOError_AddrInUse;
263                 case 7: return LDKIOError_AddrNotAvailable;
264                 case 8: return LDKIOError_BrokenPipe;
265                 case 9: return LDKIOError_AlreadyExists;
266                 case 10: return LDKIOError_WouldBlock;
267                 case 11: return LDKIOError_InvalidInput;
268                 case 12: return LDKIOError_InvalidData;
269                 case 13: return LDKIOError_TimedOut;
270                 case 14: return LDKIOError_WriteZero;
271                 case 15: return LDKIOError_Interrupted;
272                 case 16: return LDKIOError_Other;
273                 case 17: return LDKIOError_UnexpectedEof;
274         }
275         abort();
276 }
277 static inline int32_t LDKIOError_to_js(LDKIOError val) {
278         switch (val) {
279                 case LDKIOError_NotFound: return 0;
280                 case LDKIOError_PermissionDenied: return 1;
281                 case LDKIOError_ConnectionRefused: return 2;
282                 case LDKIOError_ConnectionReset: return 3;
283                 case LDKIOError_ConnectionAborted: return 4;
284                 case LDKIOError_NotConnected: return 5;
285                 case LDKIOError_AddrInUse: return 6;
286                 case LDKIOError_AddrNotAvailable: return 7;
287                 case LDKIOError_BrokenPipe: return 8;
288                 case LDKIOError_AlreadyExists: return 9;
289                 case LDKIOError_WouldBlock: return 10;
290                 case LDKIOError_InvalidInput: return 11;
291                 case LDKIOError_InvalidData: return 12;
292                 case LDKIOError_TimedOut: return 13;
293                 case LDKIOError_WriteZero: return 14;
294                 case LDKIOError_Interrupted: return 15;
295                 case LDKIOError_Other: return 16;
296                 case LDKIOError_UnexpectedEof: return 17;
297                 default: abort();
298         }
299 }
300 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
301         switch (ord) {
302                 case 0: return LDKLevel_Gossip;
303                 case 1: return LDKLevel_Trace;
304                 case 2: return LDKLevel_Debug;
305                 case 3: return LDKLevel_Info;
306                 case 4: return LDKLevel_Warn;
307                 case 5: return LDKLevel_Error;
308         }
309         abort();
310 }
311 static inline int32_t LDKLevel_to_js(LDKLevel val) {
312         switch (val) {
313                 case LDKLevel_Gossip: return 0;
314                 case LDKLevel_Trace: return 1;
315                 case LDKLevel_Debug: return 2;
316                 case LDKLevel_Info: return 3;
317                 case LDKLevel_Warn: return 4;
318                 case LDKLevel_Error: return 5;
319                 default: abort();
320         }
321 }
322 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
323         switch (ord) {
324                 case 0: return LDKNetwork_Bitcoin;
325                 case 1: return LDKNetwork_Testnet;
326                 case 2: return LDKNetwork_Regtest;
327                 case 3: return LDKNetwork_Signet;
328         }
329         abort();
330 }
331 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
332         switch (val) {
333                 case LDKNetwork_Bitcoin: return 0;
334                 case LDKNetwork_Testnet: return 1;
335                 case LDKNetwork_Regtest: return 2;
336                 case LDKNetwork_Signet: return 3;
337                 default: abort();
338         }
339 }
340 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
341         switch (ord) {
342                 case 0: return LDKRecipient_Node;
343                 case 1: return LDKRecipient_PhantomNode;
344         }
345         abort();
346 }
347 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
348         switch (val) {
349                 case LDKRecipient_Node: return 0;
350                 case LDKRecipient_PhantomNode: return 1;
351                 default: abort();
352         }
353 }
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
355         switch (ord) {
356                 case 0: return LDKSecp256k1Error_IncorrectSignature;
357                 case 1: return LDKSecp256k1Error_InvalidMessage;
358                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359                 case 3: return LDKSecp256k1Error_InvalidSignature;
360                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
362                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
363                 case 7: return LDKSecp256k1Error_InvalidTweak;
364                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
365                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
366                 case 10: return LDKSecp256k1Error_InvalidParityValue;
367         }
368         abort();
369 }
370 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
371         switch (val) {
372                 case LDKSecp256k1Error_IncorrectSignature: return 0;
373                 case LDKSecp256k1Error_InvalidMessage: return 1;
374                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
375                 case LDKSecp256k1Error_InvalidSignature: return 3;
376                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
377                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
378                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
379                 case LDKSecp256k1Error_InvalidTweak: return 7;
380                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
381                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
382                 case LDKSecp256k1Error_InvalidParityValue: return 10;
383                 default: abort();
384         }
385 }
386 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
387         switch (ord) {
388                 case 0: return LDKSemanticError_NoPaymentHash;
389                 case 1: return LDKSemanticError_MultiplePaymentHashes;
390                 case 2: return LDKSemanticError_NoDescription;
391                 case 3: return LDKSemanticError_MultipleDescriptions;
392                 case 4: return LDKSemanticError_NoPaymentSecret;
393                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
394                 case 6: return LDKSemanticError_InvalidFeatures;
395                 case 7: return LDKSemanticError_InvalidRecoveryId;
396                 case 8: return LDKSemanticError_InvalidSignature;
397                 case 9: return LDKSemanticError_ImpreciseAmount;
398         }
399         abort();
400 }
401 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
402         switch (val) {
403                 case LDKSemanticError_NoPaymentHash: return 0;
404                 case LDKSemanticError_MultiplePaymentHashes: return 1;
405                 case LDKSemanticError_NoDescription: return 2;
406                 case LDKSemanticError_MultipleDescriptions: return 3;
407                 case LDKSemanticError_NoPaymentSecret: return 4;
408                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
409                 case LDKSemanticError_InvalidFeatures: return 6;
410                 case LDKSemanticError_InvalidRecoveryId: return 7;
411                 case LDKSemanticError_InvalidSignature: return 8;
412                 case LDKSemanticError_ImpreciseAmount: return 9;
413                 default: abort();
414         }
415 }
416 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
417         switch (ord) {
418                 case 0: return LDKSiPrefix_Milli;
419                 case 1: return LDKSiPrefix_Micro;
420                 case 2: return LDKSiPrefix_Nano;
421                 case 3: return LDKSiPrefix_Pico;
422         }
423         abort();
424 }
425 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
426         switch (val) {
427                 case LDKSiPrefix_Milli: return 0;
428                 case LDKSiPrefix_Micro: return 1;
429                 case LDKSiPrefix_Nano: return 2;
430                 case LDKSiPrefix_Pico: return 3;
431                 default: abort();
432         }
433 }
434 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
435         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
436         return ret;
437 }
438 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
439         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
440         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
441         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
442         return ret_arr;
443 }
444
445 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
446 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
447         if (!ptr_is_owned(thing)) return;
448         void* thing_ptr = untag_ptr(thing);
449         CHECK_ACCESS(thing_ptr);
450         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
451         FREE(untag_ptr(thing));
452         BigEndianScalar_free(thing_conv);
453 }
454
455 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
456         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
457         switch(obj->tag) {
458                 case LDKBech32Error_MissingSeparator: return 0;
459                 case LDKBech32Error_InvalidChecksum: return 1;
460                 case LDKBech32Error_InvalidLength: return 2;
461                 case LDKBech32Error_InvalidChar: return 3;
462                 case LDKBech32Error_InvalidData: return 4;
463                 case LDKBech32Error_InvalidPadding: return 5;
464                 case LDKBech32Error_MixedCase: return 6;
465                 default: abort();
466         }
467 }
468 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
469         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
470         assert(obj->tag == LDKBech32Error_InvalidChar);
471                         int32_t invalid_char_conv = obj->invalid_char;
472         return invalid_char_conv;
473 }
474 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
475         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
476         assert(obj->tag == LDKBech32Error_InvalidData);
477                         int8_t invalid_data_conv = obj->invalid_data;
478         return invalid_data_conv;
479 }
480 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
481         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
482         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
483         return ret;
484 }
485 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) {
486         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
487         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
488         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
489         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
490         CVec_u8Z_free(ret_var);
491         return ret_arr;
492 }
493
494 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) {
495         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
496         int64_t ret_conv = TxOut_get_value(thing_conv);
497         return ret_conv;
498 }
499
500 static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
501         LDKBlindedRoute ret = *owner->contents.result;
502         ret.is_owned = false;
503         return ret;
504 }
505 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_ok"))) TS_CResult_BlindedRouteNoneZ_get_ok(uint64_t owner) {
506         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
507         LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv);
508         uint64_t ret_ref = 0;
509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
511         return ret_ref;
512 }
513
514 static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
515 CHECK(!owner->result_ok);
516         return *owner->contents.err;
517 }
518 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_err"))) TS_CResult_BlindedRouteNoneZ_get_err(uint64_t owner) {
519         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
520         CResult_BlindedRouteNoneZ_get_err(owner_conv);
521 }
522
523 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
524         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
525         switch(obj->tag) {
526                 case LDKDecodeError_UnknownVersion: return 0;
527                 case LDKDecodeError_UnknownRequiredFeature: return 1;
528                 case LDKDecodeError_InvalidValue: return 2;
529                 case LDKDecodeError_ShortRead: return 3;
530                 case LDKDecodeError_BadLengthDescriptor: return 4;
531                 case LDKDecodeError_Io: return 5;
532                 case LDKDecodeError_UnsupportedCompression: return 6;
533                 default: abort();
534         }
535 }
536 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
537         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
538         assert(obj->tag == LDKDecodeError_Io);
539                         uint32_t io_conv = LDKIOError_to_js(obj->io);
540         return io_conv;
541 }
542 static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
543         LDKBlindedRoute ret = *owner->contents.result;
544         ret.is_owned = false;
545         return ret;
546 }
547 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_get_ok(uint64_t owner) {
548         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
549         LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv);
550         uint64_t ret_ref = 0;
551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
553         return ret_ref;
554 }
555
556 static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
557 CHECK(!owner->result_ok);
558         return DecodeError_clone(&*owner->contents.err);
559 }
560 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_err"))) TS_CResult_BlindedRouteDecodeErrorZ_get_err(uint64_t owner) {
561         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
563         *ret_copy = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv);
564         uint64_t ret_ref = tag_ptr(ret_copy, true);
565         return ret_ref;
566 }
567
568 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
569         LDKBlindedHop ret = *owner->contents.result;
570         ret.is_owned = false;
571         return ret;
572 }
573 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
574         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
575         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
576         uint64_t ret_ref = 0;
577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
579         return ret_ref;
580 }
581
582 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
583 CHECK(!owner->result_ok);
584         return DecodeError_clone(&*owner->contents.err);
585 }
586 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
587         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
589         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
590         uint64_t ret_ref = tag_ptr(ret_copy, true);
591         return ret_ref;
592 }
593
594 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
595 CHECK(owner->result_ok);
596         return *owner->contents.result;
597 }
598 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
599         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
600         CResult_NoneNoneZ_get_ok(owner_conv);
601 }
602
603 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
604 CHECK(!owner->result_ok);
605         return *owner->contents.err;
606 }
607 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
608         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
609         CResult_NoneNoneZ_get_err(owner_conv);
610 }
611
612 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
613         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
614         ret.is_owned = false;
615         return ret;
616 }
617 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
618         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
619         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
620         uint64_t ret_ref = 0;
621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
623         return ret_ref;
624 }
625
626 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
627 CHECK(!owner->result_ok);
628         return DecodeError_clone(&*owner->contents.err);
629 }
630 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
631         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
633         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
634         uint64_t ret_ref = tag_ptr(ret_copy, true);
635         return ret_ref;
636 }
637
638 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
639 CHECK(owner->result_ok);
640         return *owner->contents.result;
641 }
642 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
643         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
644         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
645         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
646         return ret_arr;
647 }
648
649 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
650 CHECK(!owner->result_ok);
651         return *owner->contents.err;
652 }
653 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
654         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
655         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
656         return ret_conv;
657 }
658
659 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
660 CHECK(owner->result_ok);
661         return *owner->contents.result;
662 }
663 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
664         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
665         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
666         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
667         return ret_arr;
668 }
669
670 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
671 CHECK(!owner->result_ok);
672         return *owner->contents.err;
673 }
674 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
675         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
676         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
677         return ret_conv;
678 }
679
680 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
681         LDKTxCreationKeys ret = *owner->contents.result;
682         ret.is_owned = false;
683         return ret;
684 }
685 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
686         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
687         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
688         uint64_t ret_ref = 0;
689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
691         return ret_ref;
692 }
693
694 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
695 CHECK(!owner->result_ok);
696         return DecodeError_clone(&*owner->contents.err);
697 }
698 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
699         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
700         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
701         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
702         uint64_t ret_ref = tag_ptr(ret_copy, true);
703         return ret_ref;
704 }
705
706 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
707         LDKChannelPublicKeys ret = *owner->contents.result;
708         ret.is_owned = false;
709         return ret;
710 }
711 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
712         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
713         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
714         uint64_t ret_ref = 0;
715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
717         return ret_ref;
718 }
719
720 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
721 CHECK(!owner->result_ok);
722         return DecodeError_clone(&*owner->contents.err);
723 }
724 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
725         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
726         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
727         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
728         uint64_t ret_ref = tag_ptr(ret_copy, true);
729         return ret_ref;
730 }
731
732 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
733         LDKTxCreationKeys ret = *owner->contents.result;
734         ret.is_owned = false;
735         return ret;
736 }
737 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
738         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
739         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
740         uint64_t ret_ref = 0;
741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
743         return ret_ref;
744 }
745
746 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
747 CHECK(!owner->result_ok);
748         return *owner->contents.err;
749 }
750 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
751         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
752         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
753         return ret_conv;
754 }
755
756 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
757         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
758         switch(obj->tag) {
759                 case LDKCOption_u32Z_Some: return 0;
760                 case LDKCOption_u32Z_None: return 1;
761                 default: abort();
762         }
763 }
764 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
765         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
766         assert(obj->tag == LDKCOption_u32Z_Some);
767                         int32_t some_conv = obj->some;
768         return some_conv;
769 }
770 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
771         LDKHTLCOutputInCommitment ret = *owner->contents.result;
772         ret.is_owned = false;
773         return ret;
774 }
775 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
776         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
777         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
778         uint64_t ret_ref = 0;
779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
781         return ret_ref;
782 }
783
784 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
785 CHECK(!owner->result_ok);
786         return DecodeError_clone(&*owner->contents.err);
787 }
788 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
789         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
790         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
791         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
792         uint64_t ret_ref = tag_ptr(ret_copy, true);
793         return ret_ref;
794 }
795
796 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
797         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
798         ret.is_owned = false;
799         return ret;
800 }
801 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
802         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
803         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
804         uint64_t ret_ref = 0;
805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
807         return ret_ref;
808 }
809
810 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
811 CHECK(!owner->result_ok);
812         return DecodeError_clone(&*owner->contents.err);
813 }
814 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
815         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
816         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
817         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
818         uint64_t ret_ref = tag_ptr(ret_copy, true);
819         return ret_ref;
820 }
821
822 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
823         LDKChannelTransactionParameters ret = *owner->contents.result;
824         ret.is_owned = false;
825         return ret;
826 }
827 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
828         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
829         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
830         uint64_t ret_ref = 0;
831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
833         return ret_ref;
834 }
835
836 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
837 CHECK(!owner->result_ok);
838         return DecodeError_clone(&*owner->contents.err);
839 }
840 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
841         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
842         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
843         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
844         uint64_t ret_ref = tag_ptr(ret_copy, true);
845         return ret_ref;
846 }
847
848 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
849         LDKHolderCommitmentTransaction ret = *owner->contents.result;
850         ret.is_owned = false;
851         return ret;
852 }
853 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
854         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
855         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
856         uint64_t ret_ref = 0;
857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
859         return ret_ref;
860 }
861
862 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
863 CHECK(!owner->result_ok);
864         return DecodeError_clone(&*owner->contents.err);
865 }
866 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
867         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
869         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
870         uint64_t ret_ref = tag_ptr(ret_copy, true);
871         return ret_ref;
872 }
873
874 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
875         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
876         ret.is_owned = false;
877         return ret;
878 }
879 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
880         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
881         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
882         uint64_t ret_ref = 0;
883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
885         return ret_ref;
886 }
887
888 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
889 CHECK(!owner->result_ok);
890         return DecodeError_clone(&*owner->contents.err);
891 }
892 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
893         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
894         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
895         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
896         uint64_t ret_ref = tag_ptr(ret_copy, true);
897         return ret_ref;
898 }
899
900 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
901         LDKTrustedClosingTransaction ret = *owner->contents.result;
902         ret.is_owned = false;
903         return ret;
904 }
905 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
906         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
907         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
908         uint64_t ret_ref = 0;
909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
911         return ret_ref;
912 }
913
914 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
915 CHECK(!owner->result_ok);
916         return *owner->contents.err;
917 }
918 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
919         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
920         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
921 }
922
923 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
924         LDKCommitmentTransaction ret = *owner->contents.result;
925         ret.is_owned = false;
926         return ret;
927 }
928 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
929         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
930         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
931         uint64_t ret_ref = 0;
932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
934         return ret_ref;
935 }
936
937 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
938 CHECK(!owner->result_ok);
939         return DecodeError_clone(&*owner->contents.err);
940 }
941 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
942         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
943         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
944         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
945         uint64_t ret_ref = tag_ptr(ret_copy, true);
946         return ret_ref;
947 }
948
949 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
950         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
951         ret.is_owned = false;
952         return ret;
953 }
954 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
955         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
956         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
957         uint64_t ret_ref = 0;
958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
960         return ret_ref;
961 }
962
963 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
964 CHECK(!owner->result_ok);
965         return *owner->contents.err;
966 }
967 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
968         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
969         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
970 }
971
972 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
973 CHECK(owner->result_ok);
974         return *owner->contents.result;
975 }
976 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
977         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
978         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
979         ptrArray ret_arr = NULL;
980         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
981         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
982         for (size_t m = 0; m < ret_var.datalen; m++) {
983                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
984                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
985                 ret_arr_ptr[m] = ret_conv_12_arr;
986         }
987         
988         return ret_arr;
989 }
990
991 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
992 CHECK(!owner->result_ok);
993         return *owner->contents.err;
994 }
995 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
996         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
997         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
998 }
999
1000 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1001         LDKShutdownScript ret = *owner->contents.result;
1002         ret.is_owned = false;
1003         return ret;
1004 }
1005 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1006         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1007         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1008         uint64_t ret_ref = 0;
1009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1011         return ret_ref;
1012 }
1013
1014 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1015 CHECK(!owner->result_ok);
1016         return DecodeError_clone(&*owner->contents.err);
1017 }
1018 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1019         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1020         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1021         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1022         uint64_t ret_ref = tag_ptr(ret_copy, true);
1023         return ret_ref;
1024 }
1025
1026 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1027         LDKShutdownScript ret = *owner->contents.result;
1028         ret.is_owned = false;
1029         return ret;
1030 }
1031 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1032         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1033         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1034         uint64_t ret_ref = 0;
1035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1037         return ret_ref;
1038 }
1039
1040 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1041         LDKInvalidShutdownScript ret = *owner->contents.err;
1042         ret.is_owned = false;
1043         return ret;
1044 }
1045 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1046         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1047         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1048         uint64_t ret_ref = 0;
1049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1051         return ret_ref;
1052 }
1053
1054 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1055         LDKRouteHop ret = *owner->contents.result;
1056         ret.is_owned = false;
1057         return ret;
1058 }
1059 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1060         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1061         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1062         uint64_t ret_ref = 0;
1063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1065         return ret_ref;
1066 }
1067
1068 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1069 CHECK(!owner->result_ok);
1070         return DecodeError_clone(&*owner->contents.err);
1071 }
1072 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1073         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1074         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1075         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1076         uint64_t ret_ref = tag_ptr(ret_copy, true);
1077         return ret_ref;
1078 }
1079
1080 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1081         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1082         for (size_t i = 0; i < ret.datalen; i++) {
1083                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1084         }
1085         return ret;
1086 }
1087 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1088         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1089         for (size_t i = 0; i < ret.datalen; i++) {
1090                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1091         }
1092         return ret;
1093 }
1094 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1095         LDKRoute ret = *owner->contents.result;
1096         ret.is_owned = false;
1097         return ret;
1098 }
1099 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1100         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1101         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1102         uint64_t ret_ref = 0;
1103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1105         return ret_ref;
1106 }
1107
1108 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1109 CHECK(!owner->result_ok);
1110         return DecodeError_clone(&*owner->contents.err);
1111 }
1112 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1113         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1114         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1115         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1116         uint64_t ret_ref = tag_ptr(ret_copy, true);
1117         return ret_ref;
1118 }
1119
1120 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1121         LDKRouteParameters ret = *owner->contents.result;
1122         ret.is_owned = false;
1123         return ret;
1124 }
1125 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1126         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1127         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1128         uint64_t ret_ref = 0;
1129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1131         return ret_ref;
1132 }
1133
1134 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1135 CHECK(!owner->result_ok);
1136         return DecodeError_clone(&*owner->contents.err);
1137 }
1138 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1139         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1141         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1142         uint64_t ret_ref = tag_ptr(ret_copy, true);
1143         return ret_ref;
1144 }
1145
1146 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1147         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1148         for (size_t i = 0; i < ret.datalen; i++) {
1149                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1150         }
1151         return ret;
1152 }
1153 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1154         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1155         switch(obj->tag) {
1156                 case LDKCOption_u64Z_Some: return 0;
1157                 case LDKCOption_u64Z_None: return 1;
1158                 default: abort();
1159         }
1160 }
1161 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1162         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1163         assert(obj->tag == LDKCOption_u64Z_Some);
1164                         int64_t some_conv = obj->some;
1165         return some_conv;
1166 }
1167 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1168         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1169         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1170         return ret;
1171 }
1172 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1173         LDKPaymentParameters ret = *owner->contents.result;
1174         ret.is_owned = false;
1175         return ret;
1176 }
1177 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1178         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1179         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1180         uint64_t ret_ref = 0;
1181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1183         return ret_ref;
1184 }
1185
1186 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1187 CHECK(!owner->result_ok);
1188         return DecodeError_clone(&*owner->contents.err);
1189 }
1190 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1191         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1192         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1193         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1194         uint64_t ret_ref = tag_ptr(ret_copy, true);
1195         return ret_ref;
1196 }
1197
1198 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1199         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1200         for (size_t i = 0; i < ret.datalen; i++) {
1201                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1202         }
1203         return ret;
1204 }
1205 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1206         LDKRouteHint ret = *owner->contents.result;
1207         ret.is_owned = false;
1208         return ret;
1209 }
1210 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1211         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1212         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1213         uint64_t ret_ref = 0;
1214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1216         return ret_ref;
1217 }
1218
1219 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1220 CHECK(!owner->result_ok);
1221         return DecodeError_clone(&*owner->contents.err);
1222 }
1223 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1224         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1225         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1226         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1227         uint64_t ret_ref = tag_ptr(ret_copy, true);
1228         return ret_ref;
1229 }
1230
1231 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1232         LDKRouteHintHop ret = *owner->contents.result;
1233         ret.is_owned = false;
1234         return ret;
1235 }
1236 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1237         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1238         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1239         uint64_t ret_ref = 0;
1240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1242         return ret_ref;
1243 }
1244
1245 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1246 CHECK(!owner->result_ok);
1247         return DecodeError_clone(&*owner->contents.err);
1248 }
1249 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1250         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1251         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1252         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1253         uint64_t ret_ref = tag_ptr(ret_copy, true);
1254         return ret_ref;
1255 }
1256
1257 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1258         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1259         for (size_t i = 0; i < ret.datalen; i++) {
1260                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1261         }
1262         return ret;
1263 }
1264 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1265         LDKRoute ret = *owner->contents.result;
1266         ret.is_owned = false;
1267         return ret;
1268 }
1269 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1270         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1271         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1272         uint64_t ret_ref = 0;
1273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1275         return ret_ref;
1276 }
1277
1278 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1279         LDKLightningError ret = *owner->contents.err;
1280         ret.is_owned = false;
1281         return ret;
1282 }
1283 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1284         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1285         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1286         uint64_t ret_ref = 0;
1287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1289         return ret_ref;
1290 }
1291
1292 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1293         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1294         switch(obj->tag) {
1295                 case LDKPaymentPurpose_InvoicePayment: return 0;
1296                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1297                 default: abort();
1298         }
1299 }
1300 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1301         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1302         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1303                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1304                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1305         return payment_preimage_arr;
1306 }
1307 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1308         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1309         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1310                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1311                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1312         return payment_secret_arr;
1313 }
1314 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1315         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1316         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1317                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1318                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1319         return spontaneous_payment_arr;
1320 }
1321 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1322 CHECK(owner->result_ok);
1323         return PaymentPurpose_clone(&*owner->contents.result);
1324 }
1325 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1326         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1327         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1328         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1329         uint64_t ret_ref = tag_ptr(ret_copy, true);
1330         return ret_ref;
1331 }
1332
1333 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1334 CHECK(!owner->result_ok);
1335         return DecodeError_clone(&*owner->contents.err);
1336 }
1337 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1338         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1340         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1341         uint64_t ret_ref = tag_ptr(ret_copy, true);
1342         return ret_ref;
1343 }
1344
1345 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1346         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1347         switch(obj->tag) {
1348                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1349                 case LDKClosureReason_HolderForceClosed: return 1;
1350                 case LDKClosureReason_CooperativeClosure: return 2;
1351                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1352                 case LDKClosureReason_FundingTimedOut: return 4;
1353                 case LDKClosureReason_ProcessingError: return 5;
1354                 case LDKClosureReason_DisconnectedPeer: return 6;
1355                 case LDKClosureReason_OutdatedChannelManager: return 7;
1356                 default: abort();
1357         }
1358 }
1359 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1360         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1361         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1362                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1363                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1364         return peer_msg_conv;
1365 }
1366 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1367         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1368         assert(obj->tag == LDKClosureReason_ProcessingError);
1369                         LDKStr err_str = obj->processing_error.err;
1370                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1371         return err_conv;
1372 }
1373 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1374         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1375         switch(obj->tag) {
1376                 case LDKCOption_ClosureReasonZ_Some: return 0;
1377                 case LDKCOption_ClosureReasonZ_None: return 1;
1378                 default: abort();
1379         }
1380 }
1381 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1382         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1383         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1384                         uint64_t some_ref = tag_ptr(&obj->some, false);
1385         return some_ref;
1386 }
1387 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1388 CHECK(owner->result_ok);
1389         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1390 }
1391 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1392         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1393         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1394         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1395         uint64_t ret_ref = tag_ptr(ret_copy, true);
1396         return ret_ref;
1397 }
1398
1399 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1400 CHECK(!owner->result_ok);
1401         return DecodeError_clone(&*owner->contents.err);
1402 }
1403 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1404         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1405         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1406         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1407         uint64_t ret_ref = tag_ptr(ret_copy, true);
1408         return ret_ref;
1409 }
1410
1411 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1412         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1413         switch(obj->tag) {
1414                 case LDKHTLCDestination_NextHopChannel: return 0;
1415                 case LDKHTLCDestination_UnknownNextHop: return 1;
1416                 case LDKHTLCDestination_FailedPayment: return 2;
1417                 default: abort();
1418         }
1419 }
1420 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1421         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1422         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1423                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1424                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1425         return node_id_arr;
1426 }
1427 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1428         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1429         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1430                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1431                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1432         return channel_id_arr;
1433 }
1434 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1435         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1436         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1437                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1438         return requested_forward_scid_conv;
1439 }
1440 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1441         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1442         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1443                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1444                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1445         return payment_hash_arr;
1446 }
1447 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1448         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1449         switch(obj->tag) {
1450                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1451                 case LDKCOption_HTLCDestinationZ_None: return 1;
1452                 default: abort();
1453         }
1454 }
1455 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1456         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1457         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1458                         uint64_t some_ref = tag_ptr(&obj->some, false);
1459         return some_ref;
1460 }
1461 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1462 CHECK(owner->result_ok);
1463         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1464 }
1465 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1466         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1467         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1468         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1469         uint64_t ret_ref = tag_ptr(ret_copy, true);
1470         return ret_ref;
1471 }
1472
1473 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1474 CHECK(!owner->result_ok);
1475         return DecodeError_clone(&*owner->contents.err);
1476 }
1477 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1478         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1480         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1481         uint64_t ret_ref = tag_ptr(ret_copy, true);
1482         return ret_ref;
1483 }
1484
1485 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1486         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1487         switch(obj->tag) {
1488                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1489                 case LDKNetworkUpdate_ChannelFailure: return 1;
1490                 case LDKNetworkUpdate_NodeFailure: return 2;
1491                 default: abort();
1492         }
1493 }
1494 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1495         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1496         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1497                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1498                         uint64_t msg_ref = 0;
1499                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1500                         msg_ref = tag_ptr(msg_var.inner, false);
1501         return msg_ref;
1502 }
1503 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1504         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1505         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1506                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1507         return short_channel_id_conv;
1508 }
1509 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1510         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1511         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1512                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1513         return is_permanent_conv;
1514 }
1515 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1516         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1517         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1518                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1519                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1520         return node_id_arr;
1521 }
1522 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1523         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1524         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1525                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1526         return is_permanent_conv;
1527 }
1528 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1529         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1530         switch(obj->tag) {
1531                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1532                 case LDKCOption_NetworkUpdateZ_None: return 1;
1533                 default: abort();
1534         }
1535 }
1536 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1537         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1538         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1539                         uint64_t some_ref = tag_ptr(&obj->some, false);
1540         return some_ref;
1541 }
1542 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1543         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1544         switch(obj->tag) {
1545                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1546                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1547                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1548                 default: abort();
1549         }
1550 }
1551 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1552         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1553         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1554                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1555                         uint64_t outpoint_ref = 0;
1556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1557                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1558         return outpoint_ref;
1559 }
1560 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1561         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1562         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1563                         LDKTxOut* output_ref = &obj->static_output.output;
1564         return tag_ptr(output_ref, false);
1565 }
1566 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1567         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1568         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1569                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1570                         uint64_t delayed_payment_output_ref = 0;
1571                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1572                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1573         return delayed_payment_output_ref;
1574 }
1575 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1576         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1577         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1578                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1579                         uint64_t static_payment_output_ref = 0;
1580                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1581                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1582         return static_payment_output_ref;
1583 }
1584 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1585         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1586         for (size_t i = 0; i < ret.datalen; i++) {
1587                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1588         }
1589         return ret;
1590 }
1591 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1592         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1593         switch(obj->tag) {
1594                 case LDKEvent_FundingGenerationReady: return 0;
1595                 case LDKEvent_PaymentReceived: return 1;
1596                 case LDKEvent_PaymentClaimed: return 2;
1597                 case LDKEvent_PaymentSent: return 3;
1598                 case LDKEvent_PaymentFailed: return 4;
1599                 case LDKEvent_PaymentPathSuccessful: return 5;
1600                 case LDKEvent_PaymentPathFailed: return 6;
1601                 case LDKEvent_ProbeSuccessful: return 7;
1602                 case LDKEvent_ProbeFailed: return 8;
1603                 case LDKEvent_PendingHTLCsForwardable: return 9;
1604                 case LDKEvent_SpendableOutputs: return 10;
1605                 case LDKEvent_PaymentForwarded: return 11;
1606                 case LDKEvent_ChannelClosed: return 12;
1607                 case LDKEvent_DiscardFunding: return 13;
1608                 case LDKEvent_OpenChannelRequest: return 14;
1609                 case LDKEvent_HTLCHandlingFailed: return 15;
1610                 default: abort();
1611         }
1612 }
1613 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1614         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1615         assert(obj->tag == LDKEvent_FundingGenerationReady);
1616                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1617                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1618         return temporary_channel_id_arr;
1619 }
1620 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1621         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1622         assert(obj->tag == LDKEvent_FundingGenerationReady);
1623                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1624                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1625         return counterparty_node_id_arr;
1626 }
1627 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1628         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1629         assert(obj->tag == LDKEvent_FundingGenerationReady);
1630                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1631         return channel_value_satoshis_conv;
1632 }
1633 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1634         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1635         assert(obj->tag == LDKEvent_FundingGenerationReady);
1636                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1637                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1638                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1639         return output_script_arr;
1640 }
1641 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1642         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1643         assert(obj->tag == LDKEvent_FundingGenerationReady);
1644                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1645         return user_channel_id_conv;
1646 }
1647 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1648         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1649         assert(obj->tag == LDKEvent_PaymentReceived);
1650                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1651                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1652         return payment_hash_arr;
1653 }
1654 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1655         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1656         assert(obj->tag == LDKEvent_PaymentReceived);
1657                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1658         return amount_msat_conv;
1659 }
1660 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1661         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1662         assert(obj->tag == LDKEvent_PaymentReceived);
1663                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1664         return purpose_ref;
1665 }
1666 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1667         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1668         assert(obj->tag == LDKEvent_PaymentClaimed);
1669                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1670                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1671         return payment_hash_arr;
1672 }
1673 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1674         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1675         assert(obj->tag == LDKEvent_PaymentClaimed);
1676                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1677         return amount_msat_conv;
1678 }
1679 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1680         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1681         assert(obj->tag == LDKEvent_PaymentClaimed);
1682                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1683         return purpose_ref;
1684 }
1685 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1686         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1687         assert(obj->tag == LDKEvent_PaymentSent);
1688                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1689                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1690         return payment_id_arr;
1691 }
1692 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1693         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1694         assert(obj->tag == LDKEvent_PaymentSent);
1695                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1696                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1697         return payment_preimage_arr;
1698 }
1699 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1701         assert(obj->tag == LDKEvent_PaymentSent);
1702                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1703                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1704         return payment_hash_arr;
1705 }
1706 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1707         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1708         assert(obj->tag == LDKEvent_PaymentSent);
1709                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1710         return fee_paid_msat_ref;
1711 }
1712 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1713         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1714         assert(obj->tag == LDKEvent_PaymentFailed);
1715                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1716                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1717         return payment_id_arr;
1718 }
1719 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1721         assert(obj->tag == LDKEvent_PaymentFailed);
1722                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1723                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1724         return payment_hash_arr;
1725 }
1726 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1727         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1728         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1729                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1730                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1731         return payment_id_arr;
1732 }
1733 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1734         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1735         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1736                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1737                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1738         return payment_hash_arr;
1739 }
1740 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1741         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1742         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1743                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1744                         uint64_tArray path_arr = NULL;
1745                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1746                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1747                         for (size_t k = 0; k < path_var.datalen; k++) {
1748                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1749                                 uint64_t path_conv_10_ref = 0;
1750                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1751                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1752                                 path_arr_ptr[k] = path_conv_10_ref;
1753                         }
1754                         
1755         return path_arr;
1756 }
1757 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1758         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1759         assert(obj->tag == LDKEvent_PaymentPathFailed);
1760                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1761                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1762         return payment_id_arr;
1763 }
1764 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1765         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1766         assert(obj->tag == LDKEvent_PaymentPathFailed);
1767                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1768                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1769         return payment_hash_arr;
1770 }
1771 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1772         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1773         assert(obj->tag == LDKEvent_PaymentPathFailed);
1774                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1775         return payment_failed_permanently_conv;
1776 }
1777 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1778         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1779         assert(obj->tag == LDKEvent_PaymentPathFailed);
1780                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1781         return network_update_ref;
1782 }
1783 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1784         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1785         assert(obj->tag == LDKEvent_PaymentPathFailed);
1786                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1787         return all_paths_failed_conv;
1788 }
1789 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1790         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1791         assert(obj->tag == LDKEvent_PaymentPathFailed);
1792                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1793                         uint64_tArray path_arr = NULL;
1794                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1795                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1796                         for (size_t k = 0; k < path_var.datalen; k++) {
1797                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1798                                 uint64_t path_conv_10_ref = 0;
1799                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1800                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1801                                 path_arr_ptr[k] = path_conv_10_ref;
1802                         }
1803                         
1804         return path_arr;
1805 }
1806 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1807         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1808         assert(obj->tag == LDKEvent_PaymentPathFailed);
1809                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1810         return short_channel_id_ref;
1811 }
1812 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1813         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1814         assert(obj->tag == LDKEvent_PaymentPathFailed);
1815                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1816                         uint64_t retry_ref = 0;
1817                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1818                         retry_ref = tag_ptr(retry_var.inner, false);
1819         return retry_ref;
1820 }
1821 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1822         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1823         assert(obj->tag == LDKEvent_ProbeSuccessful);
1824                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1825                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1826         return payment_id_arr;
1827 }
1828 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1829         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1830         assert(obj->tag == LDKEvent_ProbeSuccessful);
1831                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1832                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1833         return payment_hash_arr;
1834 }
1835 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1836         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1837         assert(obj->tag == LDKEvent_ProbeSuccessful);
1838                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1839                         uint64_tArray path_arr = NULL;
1840                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1841                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1842                         for (size_t k = 0; k < path_var.datalen; k++) {
1843                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1844                                 uint64_t path_conv_10_ref = 0;
1845                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1846                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1847                                 path_arr_ptr[k] = path_conv_10_ref;
1848                         }
1849                         
1850         return path_arr;
1851 }
1852 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1853         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1854         assert(obj->tag == LDKEvent_ProbeFailed);
1855                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1856                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1857         return payment_id_arr;
1858 }
1859 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1860         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1861         assert(obj->tag == LDKEvent_ProbeFailed);
1862                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1863                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1864         return payment_hash_arr;
1865 }
1866 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1867         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1868         assert(obj->tag == LDKEvent_ProbeFailed);
1869                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1870                         uint64_tArray path_arr = NULL;
1871                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1872                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1873                         for (size_t k = 0; k < path_var.datalen; k++) {
1874                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1875                                 uint64_t path_conv_10_ref = 0;
1876                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1877                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1878                                 path_arr_ptr[k] = path_conv_10_ref;
1879                         }
1880                         
1881         return path_arr;
1882 }
1883 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1884         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1885         assert(obj->tag == LDKEvent_ProbeFailed);
1886                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1887         return short_channel_id_ref;
1888 }
1889 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1890         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1891         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1892                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1893         return time_forwardable_conv;
1894 }
1895 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1896         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1897         assert(obj->tag == LDKEvent_SpendableOutputs);
1898                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1899                         uint64_tArray outputs_arr = NULL;
1900                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1901                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1902                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1903                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1904                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1905                         }
1906                         
1907         return outputs_arr;
1908 }
1909 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1910         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1911         assert(obj->tag == LDKEvent_PaymentForwarded);
1912                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1913                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1914         return prev_channel_id_arr;
1915 }
1916 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1917         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1918         assert(obj->tag == LDKEvent_PaymentForwarded);
1919                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1920                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1921         return next_channel_id_arr;
1922 }
1923 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1924         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1925         assert(obj->tag == LDKEvent_PaymentForwarded);
1926                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1927         return fee_earned_msat_ref;
1928 }
1929 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1930         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1931         assert(obj->tag == LDKEvent_PaymentForwarded);
1932                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1933         return claim_from_onchain_tx_conv;
1934 }
1935 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1937         assert(obj->tag == LDKEvent_ChannelClosed);
1938                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1939                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1940         return channel_id_arr;
1941 }
1942 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1943         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1944         assert(obj->tag == LDKEvent_ChannelClosed);
1945                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1946         return user_channel_id_conv;
1947 }
1948 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1950         assert(obj->tag == LDKEvent_ChannelClosed);
1951                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1952         return reason_ref;
1953 }
1954 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1955         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1956         assert(obj->tag == LDKEvent_DiscardFunding);
1957                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1958                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1959         return channel_id_arr;
1960 }
1961 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1962         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1963         assert(obj->tag == LDKEvent_DiscardFunding);
1964                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1965                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1966                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1967         return transaction_arr;
1968 }
1969 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1970         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1971         assert(obj->tag == LDKEvent_OpenChannelRequest);
1972                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1973                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1974         return temporary_channel_id_arr;
1975 }
1976 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1977         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1978         assert(obj->tag == LDKEvent_OpenChannelRequest);
1979                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1980                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1981         return counterparty_node_id_arr;
1982 }
1983 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
1984         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1985         assert(obj->tag == LDKEvent_OpenChannelRequest);
1986                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
1987         return funding_satoshis_conv;
1988 }
1989 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
1990         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1991         assert(obj->tag == LDKEvent_OpenChannelRequest);
1992                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
1993         return push_msat_conv;
1994 }
1995 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
1996         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1997         assert(obj->tag == LDKEvent_OpenChannelRequest);
1998                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
1999                         uint64_t channel_type_ref = 0;
2000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2001                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2002         return channel_type_ref;
2003 }
2004 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2005         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2006         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2007                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2008                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2009         return prev_channel_id_arr;
2010 }
2011 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2012         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2013         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2014                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2015         return failed_next_destination_ref;
2016 }
2017 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2018         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2019         switch(obj->tag) {
2020                 case LDKCOption_EventZ_Some: return 0;
2021                 case LDKCOption_EventZ_None: return 1;
2022                 default: abort();
2023         }
2024 }
2025 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2026         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2027         assert(obj->tag == LDKCOption_EventZ_Some);
2028                         uint64_t some_ref = tag_ptr(&obj->some, false);
2029         return some_ref;
2030 }
2031 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2032 CHECK(owner->result_ok);
2033         return COption_EventZ_clone(&*owner->contents.result);
2034 }
2035 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2036         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2037         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2038         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2039         uint64_t ret_ref = tag_ptr(ret_copy, true);
2040         return ret_ref;
2041 }
2042
2043 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2044 CHECK(!owner->result_ok);
2045         return DecodeError_clone(&*owner->contents.err);
2046 }
2047 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2048         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2049         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2050         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2051         uint64_t ret_ref = tag_ptr(ret_copy, true);
2052         return ret_ref;
2053 }
2054
2055 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2056         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2057         switch(obj->tag) {
2058                 case LDKErrorAction_DisconnectPeer: return 0;
2059                 case LDKErrorAction_IgnoreError: return 1;
2060                 case LDKErrorAction_IgnoreAndLog: return 2;
2061                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2062                 case LDKErrorAction_SendErrorMessage: return 4;
2063                 case LDKErrorAction_SendWarningMessage: return 5;
2064                 default: abort();
2065         }
2066 }
2067 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2068         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2069         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2070                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2071                         uint64_t msg_ref = 0;
2072                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2073                         msg_ref = tag_ptr(msg_var.inner, false);
2074         return msg_ref;
2075 }
2076 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2077         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2078         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2079                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2080         return ignore_and_log_conv;
2081 }
2082 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2083         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2084         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2085                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2086                         uint64_t msg_ref = 0;
2087                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2088                         msg_ref = tag_ptr(msg_var.inner, false);
2089         return msg_ref;
2090 }
2091 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2092         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2093         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2094                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2095                         uint64_t msg_ref = 0;
2096                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2097                         msg_ref = tag_ptr(msg_var.inner, false);
2098         return msg_ref;
2099 }
2100 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2101         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2102         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2103                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2104         return log_level_conv;
2105 }
2106 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2107         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2108         switch(obj->tag) {
2109                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2110                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2111                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2112                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2113                 case LDKMessageSendEvent_SendChannelReady: return 4;
2114                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2115                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2116                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2117                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2118                 case LDKMessageSendEvent_SendShutdown: return 9;
2119                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2120                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2121                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2122                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2123                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2124                 case LDKMessageSendEvent_HandleError: return 15;
2125                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2126                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2127                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2128                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2129                 default: abort();
2130         }
2131 }
2132 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2133         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2134         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2135                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2136                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2137         return node_id_arr;
2138 }
2139 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2140         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2141         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2142                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2143                         uint64_t msg_ref = 0;
2144                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2145                         msg_ref = tag_ptr(msg_var.inner, false);
2146         return msg_ref;
2147 }
2148 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2149         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2150         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2151                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2152                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2153         return node_id_arr;
2154 }
2155 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2156         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2157         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2158                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2159                         uint64_t msg_ref = 0;
2160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2161                         msg_ref = tag_ptr(msg_var.inner, false);
2162         return msg_ref;
2163 }
2164 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2165         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2166         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2167                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2168                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2169         return node_id_arr;
2170 }
2171 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2172         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2173         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2174                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2175                         uint64_t msg_ref = 0;
2176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2177                         msg_ref = tag_ptr(msg_var.inner, false);
2178         return msg_ref;
2179 }
2180 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2181         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2182         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2183                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2184                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2185         return node_id_arr;
2186 }
2187 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2188         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2189         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2190                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2191                         uint64_t msg_ref = 0;
2192                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2193                         msg_ref = tag_ptr(msg_var.inner, false);
2194         return msg_ref;
2195 }
2196 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2197         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2198         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2199                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2200                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2201         return node_id_arr;
2202 }
2203 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2204         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2205         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2206                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2207                         uint64_t msg_ref = 0;
2208                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2209                         msg_ref = tag_ptr(msg_var.inner, false);
2210         return msg_ref;
2211 }
2212 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2213         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2214         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2215                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2216                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2217         return node_id_arr;
2218 }
2219 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2220         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2221         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2222                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2223                         uint64_t msg_ref = 0;
2224                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2225                         msg_ref = tag_ptr(msg_var.inner, false);
2226         return msg_ref;
2227 }
2228 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2229         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2230         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2231                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2232                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2233         return node_id_arr;
2234 }
2235 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2236         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2237         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2238                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2239                         uint64_t updates_ref = 0;
2240                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2241                         updates_ref = tag_ptr(updates_var.inner, false);
2242         return updates_ref;
2243 }
2244 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2245         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2246         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2247                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2248                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2249         return node_id_arr;
2250 }
2251 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2252         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2253         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2254                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2255                         uint64_t msg_ref = 0;
2256                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2257                         msg_ref = tag_ptr(msg_var.inner, false);
2258         return msg_ref;
2259 }
2260 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2261         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2262         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2263                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2264                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2265         return node_id_arr;
2266 }
2267 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2268         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2269         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2270                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2271                         uint64_t msg_ref = 0;
2272                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2273                         msg_ref = tag_ptr(msg_var.inner, false);
2274         return msg_ref;
2275 }
2276 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2277         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2278         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2279                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2280                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2281         return node_id_arr;
2282 }
2283 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2284         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2285         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2286                         LDKShutdown msg_var = obj->send_shutdown.msg;
2287                         uint64_t msg_ref = 0;
2288                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2289                         msg_ref = tag_ptr(msg_var.inner, false);
2290         return msg_ref;
2291 }
2292 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2293         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2294         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2295                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2296                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2297         return node_id_arr;
2298 }
2299 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2300         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2301         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2302                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2303                         uint64_t msg_ref = 0;
2304                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2305                         msg_ref = tag_ptr(msg_var.inner, false);
2306         return msg_ref;
2307 }
2308 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2309         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2310         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2311                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2312                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2313         return node_id_arr;
2314 }
2315 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2316         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2317         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2318                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2319                         uint64_t msg_ref = 0;
2320                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2321                         msg_ref = tag_ptr(msg_var.inner, false);
2322         return msg_ref;
2323 }
2324 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2325         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2326         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2327                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2328                         uint64_t update_msg_ref = 0;
2329                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2330                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2331         return update_msg_ref;
2332 }
2333 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2334         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2335         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2336                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2337                         uint64_t msg_ref = 0;
2338                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2339                         msg_ref = tag_ptr(msg_var.inner, false);
2340         return msg_ref;
2341 }
2342 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2343         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2344         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2345                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2346                         uint64_t update_msg_ref = 0;
2347                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2348                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2349         return update_msg_ref;
2350 }
2351 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2352         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2353         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2354                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2355                         uint64_t msg_ref = 0;
2356                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2357                         msg_ref = tag_ptr(msg_var.inner, false);
2358         return msg_ref;
2359 }
2360 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2361         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2362         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2363                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2364                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2365         return node_id_arr;
2366 }
2367 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2368         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2369         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2370                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2371                         uint64_t msg_ref = 0;
2372                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2373                         msg_ref = tag_ptr(msg_var.inner, false);
2374         return msg_ref;
2375 }
2376 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2377         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2378         assert(obj->tag == LDKMessageSendEvent_HandleError);
2379                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2380                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2381         return node_id_arr;
2382 }
2383 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2384         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2385         assert(obj->tag == LDKMessageSendEvent_HandleError);
2386                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2387         return action_ref;
2388 }
2389 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2390         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2391         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2392                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2393                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2394         return node_id_arr;
2395 }
2396 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2397         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2398         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2399                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2400                         uint64_t msg_ref = 0;
2401                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2402                         msg_ref = tag_ptr(msg_var.inner, false);
2403         return msg_ref;
2404 }
2405 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2406         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2407         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2408                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2409                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2410         return node_id_arr;
2411 }
2412 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2413         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2414         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2415                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2416                         uint64_t msg_ref = 0;
2417                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2418                         msg_ref = tag_ptr(msg_var.inner, false);
2419         return msg_ref;
2420 }
2421 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2422         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2423         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2424                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2425                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2426         return node_id_arr;
2427 }
2428 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2429         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2430         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2431                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2432                         uint64_t msg_ref = 0;
2433                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2434                         msg_ref = tag_ptr(msg_var.inner, false);
2435         return msg_ref;
2436 }
2437 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2438         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2439         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2440                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2441                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2442         return node_id_arr;
2443 }
2444 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2445         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2446         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2447                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2448                         uint64_t msg_ref = 0;
2449                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2450                         msg_ref = tag_ptr(msg_var.inner, false);
2451         return msg_ref;
2452 }
2453 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2454         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2455         for (size_t i = 0; i < ret.datalen; i++) {
2456                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2457         }
2458         return ret;
2459 }
2460 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2461 CHECK(owner->result_ok);
2462         return TxOut_clone(&*owner->contents.result);
2463 }
2464 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2465         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2466         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2467         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2468         return tag_ptr(ret_ref, true);
2469 }
2470
2471 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2472 CHECK(!owner->result_ok);
2473         return AccessError_clone(&*owner->contents.err);
2474 }
2475 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2476         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2477         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2478         return ret_conv;
2479 }
2480
2481 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2482         return owner->a;
2483 }
2484 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2485         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2486         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2487         return ret_conv;
2488 }
2489
2490 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2491         return owner->b;
2492 }
2493 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2494         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2495         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2496         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2497         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2498         return ret_arr;
2499 }
2500
2501 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2502         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2503         for (size_t i = 0; i < ret.datalen; i++) {
2504                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2505         }
2506         return ret;
2507 }
2508 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2509         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2510         for (size_t i = 0; i < ret.datalen; i++) {
2511                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2512         }
2513         return ret;
2514 }
2515 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2516         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2517         switch(obj->tag) {
2518                 case LDKMonitorEvent_HTLCEvent: return 0;
2519                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2520                 case LDKMonitorEvent_Completed: return 2;
2521                 case LDKMonitorEvent_UpdateFailed: return 3;
2522                 default: abort();
2523         }
2524 }
2525 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2526         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2527         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2528                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2529                         uint64_t htlc_event_ref = 0;
2530                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2531                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2532         return htlc_event_ref;
2533 }
2534 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2535         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2536         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2537                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2538                         uint64_t commitment_tx_confirmed_ref = 0;
2539                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2540                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2541         return commitment_tx_confirmed_ref;
2542 }
2543 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2544         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2545         assert(obj->tag == LDKMonitorEvent_Completed);
2546                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2547                         uint64_t funding_txo_ref = 0;
2548                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2549                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2550         return funding_txo_ref;
2551 }
2552 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2553         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2554         assert(obj->tag == LDKMonitorEvent_Completed);
2555                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2556         return monitor_update_id_conv;
2557 }
2558 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2559         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2560         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2561                         LDKOutPoint update_failed_var = obj->update_failed;
2562                         uint64_t update_failed_ref = 0;
2563                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2564                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2565         return update_failed_ref;
2566 }
2567 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2568         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2569         for (size_t i = 0; i < ret.datalen; i++) {
2570                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2571         }
2572         return ret;
2573 }
2574 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2575         LDKOutPoint ret = owner->a;
2576         ret.is_owned = false;
2577         return ret;
2578 }
2579 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2580         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2581         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2582         uint64_t ret_ref = 0;
2583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2585         return ret_ref;
2586 }
2587
2588 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2589         return CVec_MonitorEventZ_clone(&owner->b);
2590 }
2591 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2592         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2593         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2594         uint64_tArray ret_arr = NULL;
2595         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2596         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2597         for (size_t o = 0; o < ret_var.datalen; o++) {
2598                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2599                 *ret_conv_14_copy = ret_var.data[o];
2600                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2601                 ret_arr_ptr[o] = ret_conv_14_ref;
2602         }
2603         
2604         FREE(ret_var.data);
2605         return ret_arr;
2606 }
2607
2608 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2609         return owner->c;
2610 }
2611 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2612         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2613         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2614         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2615         return ret_arr;
2616 }
2617
2618 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2619         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2620         for (size_t i = 0; i < ret.datalen; i++) {
2621                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2622         }
2623         return ret;
2624 }
2625 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2626         LDKFixedPenaltyScorer ret = *owner->contents.result;
2627         ret.is_owned = false;
2628         return ret;
2629 }
2630 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2631         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2632         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2633         uint64_t ret_ref = 0;
2634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2636         return ret_ref;
2637 }
2638
2639 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2640 CHECK(!owner->result_ok);
2641         return DecodeError_clone(&*owner->contents.err);
2642 }
2643 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2644         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2645         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2646         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2647         uint64_t ret_ref = tag_ptr(ret_copy, true);
2648         return ret_ref;
2649 }
2650
2651 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2652         return owner->a;
2653 }
2654 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2655         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2656         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2657         return ret_conv;
2658 }
2659
2660 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2661         return owner->b;
2662 }
2663 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2664         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2665         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2666         return ret_conv;
2667 }
2668
2669 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2670         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2671         switch(obj->tag) {
2672                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2673                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2674                 default: abort();
2675         }
2676 }
2677 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2678         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2679         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2680                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2681                         *some_conv = obj->some;
2682                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2683         return tag_ptr(some_conv, true);
2684 }
2685 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2686         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2687         for (size_t i = 0; i < ret.datalen; i++) {
2688                 ret.data[i] = NodeId_clone(&orig->data[i]);
2689         }
2690         return ret;
2691 }
2692 typedef struct LDKLogger_JCalls {
2693         atomic_size_t refcnt;
2694         uint32_t instance_ptr;
2695 } LDKLogger_JCalls;
2696 static void LDKLogger_JCalls_free(void* this_arg) {
2697         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2698         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2699                 FREE(j_calls);
2700         }
2701 }
2702 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2703         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2704         LDKRecord record_var = *record;
2705         uint64_t record_ref = 0;
2706         record_var = Record_clone(&record_var);
2707         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2708         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2709         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2710 }
2711 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2712         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2713         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2714 }
2715 static inline LDKLogger LDKLogger_init (JSValue o) {
2716         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2717         atomic_init(&calls->refcnt, 1);
2718         calls->instance_ptr = o;
2719
2720         LDKLogger ret = {
2721                 .this_arg = (void*) calls,
2722                 .log = log_LDKLogger_jcall,
2723                 .free = LDKLogger_JCalls_free,
2724         };
2725         return ret;
2726 }
2727 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2728         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2729         *res_ptr = LDKLogger_init(o);
2730         return tag_ptr(res_ptr, true);
2731 }
2732 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2733         LDKProbabilisticScorer ret = *owner->contents.result;
2734         ret.is_owned = false;
2735         return ret;
2736 }
2737 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2738         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2739         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2740         uint64_t ret_ref = 0;
2741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2743         return ret_ref;
2744 }
2745
2746 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2747 CHECK(!owner->result_ok);
2748         return DecodeError_clone(&*owner->contents.err);
2749 }
2750 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2751         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2752         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2753         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2754         uint64_t ret_ref = tag_ptr(ret_copy, true);
2755         return ret_ref;
2756 }
2757
2758 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2759         LDKInitFeatures ret = *owner->contents.result;
2760         ret.is_owned = false;
2761         return ret;
2762 }
2763 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2764         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2765         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2766         uint64_t ret_ref = 0;
2767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2769         return ret_ref;
2770 }
2771
2772 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2773 CHECK(!owner->result_ok);
2774         return DecodeError_clone(&*owner->contents.err);
2775 }
2776 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2777         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2778         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2779         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2780         uint64_t ret_ref = tag_ptr(ret_copy, true);
2781         return ret_ref;
2782 }
2783
2784 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2785         LDKChannelFeatures ret = *owner->contents.result;
2786         ret.is_owned = false;
2787         return ret;
2788 }
2789 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2790         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2791         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2792         uint64_t ret_ref = 0;
2793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2795         return ret_ref;
2796 }
2797
2798 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2799 CHECK(!owner->result_ok);
2800         return DecodeError_clone(&*owner->contents.err);
2801 }
2802 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2803         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2804         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2805         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2806         uint64_t ret_ref = tag_ptr(ret_copy, true);
2807         return ret_ref;
2808 }
2809
2810 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2811         LDKNodeFeatures ret = *owner->contents.result;
2812         ret.is_owned = false;
2813         return ret;
2814 }
2815 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2816         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2817         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2818         uint64_t ret_ref = 0;
2819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2821         return ret_ref;
2822 }
2823
2824 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2825 CHECK(!owner->result_ok);
2826         return DecodeError_clone(&*owner->contents.err);
2827 }
2828 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2829         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2830         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2831         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2832         uint64_t ret_ref = tag_ptr(ret_copy, true);
2833         return ret_ref;
2834 }
2835
2836 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2837         LDKInvoiceFeatures ret = *owner->contents.result;
2838         ret.is_owned = false;
2839         return ret;
2840 }
2841 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2842         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2843         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2844         uint64_t ret_ref = 0;
2845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2847         return ret_ref;
2848 }
2849
2850 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2851 CHECK(!owner->result_ok);
2852         return DecodeError_clone(&*owner->contents.err);
2853 }
2854 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2855         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2856         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2857         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2858         uint64_t ret_ref = tag_ptr(ret_copy, true);
2859         return ret_ref;
2860 }
2861
2862 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2863         LDKChannelTypeFeatures ret = *owner->contents.result;
2864         ret.is_owned = false;
2865         return ret;
2866 }
2867 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2868         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2869         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2870         uint64_t ret_ref = 0;
2871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2873         return ret_ref;
2874 }
2875
2876 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2877 CHECK(!owner->result_ok);
2878         return DecodeError_clone(&*owner->contents.err);
2879 }
2880 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2881         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2882         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2883         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2884         uint64_t ret_ref = tag_ptr(ret_copy, true);
2885         return ret_ref;
2886 }
2887
2888 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2889         LDKNodeId ret = *owner->contents.result;
2890         ret.is_owned = false;
2891         return ret;
2892 }
2893 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2894         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2895         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2896         uint64_t ret_ref = 0;
2897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2899         return ret_ref;
2900 }
2901
2902 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2903 CHECK(!owner->result_ok);
2904         return DecodeError_clone(&*owner->contents.err);
2905 }
2906 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2907         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2908         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2909         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2910         uint64_t ret_ref = tag_ptr(ret_copy, true);
2911         return ret_ref;
2912 }
2913
2914 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2915 CHECK(owner->result_ok);
2916         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2917 }
2918 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2919         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2920         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2921         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2922         uint64_t ret_ref = tag_ptr(ret_copy, true);
2923         return ret_ref;
2924 }
2925
2926 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2927 CHECK(!owner->result_ok);
2928         return DecodeError_clone(&*owner->contents.err);
2929 }
2930 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2931         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2932         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2933         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2934         uint64_t ret_ref = tag_ptr(ret_copy, true);
2935         return ret_ref;
2936 }
2937
2938 typedef struct LDKAccess_JCalls {
2939         atomic_size_t refcnt;
2940         uint32_t instance_ptr;
2941 } LDKAccess_JCalls;
2942 static void LDKAccess_JCalls_free(void* this_arg) {
2943         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2944         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2945                 FREE(j_calls);
2946         }
2947 }
2948 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
2949         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
2950         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
2951         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
2952         int64_t short_channel_id_conv = short_channel_id;
2953         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);
2954         void* ret_ptr = untag_ptr(ret);
2955         CHECK_ACCESS(ret_ptr);
2956         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
2957         FREE(untag_ptr(ret));
2958         return ret_conv;
2959 }
2960 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
2961         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
2962         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2963 }
2964 static inline LDKAccess LDKAccess_init (JSValue o) {
2965         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
2966         atomic_init(&calls->refcnt, 1);
2967         calls->instance_ptr = o;
2968
2969         LDKAccess ret = {
2970                 .this_arg = (void*) calls,
2971                 .get_utxo = get_utxo_LDKAccess_jcall,
2972                 .free = LDKAccess_JCalls_free,
2973         };
2974         return ret;
2975 }
2976 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
2977         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
2978         *res_ptr = LDKAccess_init(o);
2979         return tag_ptr(res_ptr, true);
2980 }
2981 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) {
2982         void* this_arg_ptr = untag_ptr(this_arg);
2983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2984         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
2985         unsigned char genesis_hash_arr[32];
2986         CHECK(genesis_hash->arr_len == 32);
2987         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
2988         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
2989         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2990         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
2991         return tag_ptr(ret_conv, true);
2992 }
2993
2994 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
2995         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
2996         switch(obj->tag) {
2997                 case LDKCOption_AccessZ_Some: return 0;
2998                 case LDKCOption_AccessZ_None: return 1;
2999                 default: abort();
3000         }
3001 }
3002 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3003         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3004         assert(obj->tag == LDKCOption_AccessZ_Some);
3005                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3006                         *some_ret = obj->some;
3007                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3008                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3009                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3010                                 LDKAccess_JCalls_cloned(&(*some_ret));
3011                         }
3012         return tag_ptr(some_ret, true);
3013 }
3014 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3015 CHECK(owner->result_ok);
3016         return *owner->contents.result;
3017 }
3018 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3019         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3020         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3021         return ret_conv;
3022 }
3023
3024 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3025         LDKLightningError ret = *owner->contents.err;
3026         ret.is_owned = false;
3027         return ret;
3028 }
3029 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3030         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3031         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3032         uint64_t ret_ref = 0;
3033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3035         return ret_ref;
3036 }
3037
3038 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3039         LDKChannelAnnouncement ret = owner->a;
3040         ret.is_owned = false;
3041         return ret;
3042 }
3043 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3044         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3045         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3046         uint64_t ret_ref = 0;
3047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3049         return ret_ref;
3050 }
3051
3052 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3053         LDKChannelUpdate ret = owner->b;
3054         ret.is_owned = false;
3055         return ret;
3056 }
3057 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3058         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3059         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3060         uint64_t ret_ref = 0;
3061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3063         return ret_ref;
3064 }
3065
3066 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3067         LDKChannelUpdate ret = owner->c;
3068         ret.is_owned = false;
3069         return ret;
3070 }
3071 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3072         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3073         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3074         uint64_t ret_ref = 0;
3075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3077         return ret_ref;
3078 }
3079
3080 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3081         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3082         switch(obj->tag) {
3083                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3084                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3085                 default: abort();
3086         }
3087 }
3088 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3089         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3090         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3091                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3092                         *some_conv = obj->some;
3093                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3094         return tag_ptr(some_conv, true);
3095 }
3096 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3097 CHECK(owner->result_ok);
3098         return *owner->contents.result;
3099 }
3100 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3101         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3102         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3103 }
3104
3105 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3106         LDKLightningError ret = *owner->contents.err;
3107         ret.is_owned = false;
3108         return ret;
3109 }
3110 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3111         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3112         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3113         uint64_t ret_ref = 0;
3114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3116         return ret_ref;
3117 }
3118
3119 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3120         LDKChannelUpdateInfo ret = *owner->contents.result;
3121         ret.is_owned = false;
3122         return ret;
3123 }
3124 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3125         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3126         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3127         uint64_t ret_ref = 0;
3128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3130         return ret_ref;
3131 }
3132
3133 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3134 CHECK(!owner->result_ok);
3135         return DecodeError_clone(&*owner->contents.err);
3136 }
3137 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3138         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3139         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3140         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3141         uint64_t ret_ref = tag_ptr(ret_copy, true);
3142         return ret_ref;
3143 }
3144
3145 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3146         LDKChannelInfo ret = *owner->contents.result;
3147         ret.is_owned = false;
3148         return ret;
3149 }
3150 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3151         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3152         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3153         uint64_t ret_ref = 0;
3154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3156         return ret_ref;
3157 }
3158
3159 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3160 CHECK(!owner->result_ok);
3161         return DecodeError_clone(&*owner->contents.err);
3162 }
3163 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3164         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3166         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3167         uint64_t ret_ref = tag_ptr(ret_copy, true);
3168         return ret_ref;
3169 }
3170
3171 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3172         LDKRoutingFees ret = *owner->contents.result;
3173         ret.is_owned = false;
3174         return ret;
3175 }
3176 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3177         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3178         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3179         uint64_t ret_ref = 0;
3180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3182         return ret_ref;
3183 }
3184
3185 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3186 CHECK(!owner->result_ok);
3187         return DecodeError_clone(&*owner->contents.err);
3188 }
3189 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3190         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3192         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3193         uint64_t ret_ref = tag_ptr(ret_copy, true);
3194         return ret_ref;
3195 }
3196
3197 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3198         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3199         switch(obj->tag) {
3200                 case LDKNetAddress_IPv4: return 0;
3201                 case LDKNetAddress_IPv6: return 1;
3202                 case LDKNetAddress_OnionV2: return 2;
3203                 case LDKNetAddress_OnionV3: return 3;
3204                 case LDKNetAddress_Hostname: return 4;
3205                 default: abort();
3206         }
3207 }
3208 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3209         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3210         assert(obj->tag == LDKNetAddress_IPv4);
3211                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3212                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3213         return addr_arr;
3214 }
3215 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3216         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3217         assert(obj->tag == LDKNetAddress_IPv4);
3218                         int16_t port_conv = obj->i_pv4.port;
3219         return port_conv;
3220 }
3221 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3222         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3223         assert(obj->tag == LDKNetAddress_IPv6);
3224                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3225                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3226         return addr_arr;
3227 }
3228 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3229         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3230         assert(obj->tag == LDKNetAddress_IPv6);
3231                         int16_t port_conv = obj->i_pv6.port;
3232         return port_conv;
3233 }
3234 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3235         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3236         assert(obj->tag == LDKNetAddress_OnionV2);
3237                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3238                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3239         return onion_v2_arr;
3240 }
3241 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3242         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3243         assert(obj->tag == LDKNetAddress_OnionV3);
3244                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3245                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3246         return ed25519_pubkey_arr;
3247 }
3248 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3249         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3250         assert(obj->tag == LDKNetAddress_OnionV3);
3251                         int16_t checksum_conv = obj->onion_v3.checksum;
3252         return checksum_conv;
3253 }
3254 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3255         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3256         assert(obj->tag == LDKNetAddress_OnionV3);
3257                         int8_t version_conv = obj->onion_v3.version;
3258         return version_conv;
3259 }
3260 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3261         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3262         assert(obj->tag == LDKNetAddress_OnionV3);
3263                         int16_t port_conv = obj->onion_v3.port;
3264         return port_conv;
3265 }
3266 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3267         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3268         assert(obj->tag == LDKNetAddress_Hostname);
3269                         LDKHostname hostname_var = obj->hostname.hostname;
3270                         uint64_t hostname_ref = 0;
3271                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3272                         hostname_ref = tag_ptr(hostname_var.inner, false);
3273         return hostname_ref;
3274 }
3275 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3276         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3277         assert(obj->tag == LDKNetAddress_Hostname);
3278                         int16_t port_conv = obj->hostname.port;
3279         return port_conv;
3280 }
3281 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3282         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3283         for (size_t i = 0; i < ret.datalen; i++) {
3284                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3285         }
3286         return ret;
3287 }
3288 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3289         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3290         ret.is_owned = false;
3291         return ret;
3292 }
3293 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3294         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3295         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3296         uint64_t ret_ref = 0;
3297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3299         return ret_ref;
3300 }
3301
3302 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3303 CHECK(!owner->result_ok);
3304         return DecodeError_clone(&*owner->contents.err);
3305 }
3306 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3307         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3308         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3309         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3310         uint64_t ret_ref = tag_ptr(ret_copy, true);
3311         return ret_ref;
3312 }
3313
3314 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3315         LDKNodeAlias ret = *owner->contents.result;
3316         ret.is_owned = false;
3317         return ret;
3318 }
3319 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3320         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3321         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3322         uint64_t ret_ref = 0;
3323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3325         return ret_ref;
3326 }
3327
3328 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3329 CHECK(!owner->result_ok);
3330         return DecodeError_clone(&*owner->contents.err);
3331 }
3332 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3333         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3334         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3335         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3336         uint64_t ret_ref = tag_ptr(ret_copy, true);
3337         return ret_ref;
3338 }
3339
3340 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3341         LDKNodeInfo ret = *owner->contents.result;
3342         ret.is_owned = false;
3343         return ret;
3344 }
3345 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3346         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3347         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3348         uint64_t ret_ref = 0;
3349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3351         return ret_ref;
3352 }
3353
3354 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3355 CHECK(!owner->result_ok);
3356         return DecodeError_clone(&*owner->contents.err);
3357 }
3358 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3359         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3360         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3361         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3362         uint64_t ret_ref = tag_ptr(ret_copy, true);
3363         return ret_ref;
3364 }
3365
3366 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3367         LDKNetworkGraph ret = *owner->contents.result;
3368         ret.is_owned = false;
3369         return ret;
3370 }
3371 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3372         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3373         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3374         uint64_t ret_ref = 0;
3375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3377         return ret_ref;
3378 }
3379
3380 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3381 CHECK(!owner->result_ok);
3382         return DecodeError_clone(&*owner->contents.err);
3383 }
3384 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3385         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3386         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3387         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3388         uint64_t ret_ref = tag_ptr(ret_copy, true);
3389         return ret_ref;
3390 }
3391
3392 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3393         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3394         switch(obj->tag) {
3395                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3396                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3397                 default: abort();
3398         }
3399 }
3400 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3401         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3402         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3403                         LDKCVec_NetAddressZ some_var = obj->some;
3404                         uint64_tArray some_arr = NULL;
3405                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3406                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3407                         for (size_t m = 0; m < some_var.datalen; m++) {
3408                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3409                                 some_arr_ptr[m] = some_conv_12_ref;
3410                         }
3411                         
3412         return some_arr;
3413 }
3414 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3415         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3416         ret.is_owned = false;
3417         return ret;
3418 }
3419 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3420         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3421         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3422         uint64_t ret_ref = 0;
3423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3425         return ret_ref;
3426 }
3427
3428 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3429 CHECK(!owner->result_ok);
3430         return DecodeError_clone(&*owner->contents.err);
3431 }
3432 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3433         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3434         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3435         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3436         uint64_t ret_ref = tag_ptr(ret_copy, true);
3437         return ret_ref;
3438 }
3439
3440 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3441         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3442         ret.is_owned = false;
3443         return ret;
3444 }
3445 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3446         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3447         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3448         uint64_t ret_ref = 0;
3449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3451         return ret_ref;
3452 }
3453
3454 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3455 CHECK(!owner->result_ok);
3456         return DecodeError_clone(&*owner->contents.err);
3457 }
3458 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3459         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3460         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3461         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3462         uint64_t ret_ref = tag_ptr(ret_copy, true);
3463         return ret_ref;
3464 }
3465
3466 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3467 CHECK(owner->result_ok);
3468         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3469 }
3470 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3471         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3472         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3473         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3474         uint64_t ret_ref = tag_ptr(ret_copy, true);
3475         return ret_ref;
3476 }
3477
3478 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3479 CHECK(!owner->result_ok);
3480         return DecodeError_clone(&*owner->contents.err);
3481 }
3482 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3483         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3485         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3486         uint64_t ret_ref = tag_ptr(ret_copy, true);
3487         return ret_ref;
3488 }
3489
3490 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3491         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3492         for (size_t i = 0; i < ret.datalen; i++) {
3493                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3494         }
3495         return ret;
3496 }
3497 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3498         return owner->a;
3499 }
3500 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3501         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3502         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3503         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3504         return ret_arr;
3505 }
3506
3507 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3508         return owner->b;
3509 }
3510 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3511         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3512         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3513         ptrArray ret_arr = NULL;
3514         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3515         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3516         for (size_t m = 0; m < ret_var.datalen; m++) {
3517                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3518                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3519                 ret_arr_ptr[m] = ret_conv_12_arr;
3520         }
3521         
3522         return ret_arr;
3523 }
3524
3525 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3526 CHECK(owner->result_ok);
3527         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3528 }
3529 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3530         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3531         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3532         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3533         return tag_ptr(ret_conv, true);
3534 }
3535
3536 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3537 CHECK(!owner->result_ok);
3538         return *owner->contents.err;
3539 }
3540 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3541         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3542         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3543 }
3544
3545 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3546 CHECK(owner->result_ok);
3547         return *owner->contents.result;
3548 }
3549 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3550         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3551         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3552         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3553         return ret_arr;
3554 }
3555
3556 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3557 CHECK(!owner->result_ok);
3558         return *owner->contents.err;
3559 }
3560 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3561         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3562         CResult_SignatureNoneZ_get_err(owner_conv);
3563 }
3564
3565 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3566         return owner->a;
3567 }
3568 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3569         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3570         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3571         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3572         return ret_arr;
3573 }
3574
3575 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3576         return owner->b;
3577 }
3578 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3579         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3580         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3581         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3582         return ret_arr;
3583 }
3584
3585 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3586 CHECK(owner->result_ok);
3587         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3588 }
3589 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3590         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3591         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3592         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3593         return tag_ptr(ret_conv, true);
3594 }
3595
3596 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3597 CHECK(!owner->result_ok);
3598         return *owner->contents.err;
3599 }
3600 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3601         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3602         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3603 }
3604
3605 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3606 CHECK(owner->result_ok);
3607         return *owner->contents.result;
3608 }
3609 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3610         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3611         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3612         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3613         return ret_arr;
3614 }
3615
3616 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3617 CHECK(!owner->result_ok);
3618         return *owner->contents.err;
3619 }
3620 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3621         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3622         CResult_SecretKeyNoneZ_get_err(owner_conv);
3623 }
3624
3625 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3626 CHECK(owner->result_ok);
3627         return *owner->contents.result;
3628 }
3629 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3630         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3631         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3632         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3633         return ret_arr;
3634 }
3635
3636 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3637 CHECK(!owner->result_ok);
3638         return *owner->contents.err;
3639 }
3640 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
3641         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3642         CResult_PublicKeyNoneZ_get_err(owner_conv);
3643 }
3644
3645 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3646         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3647         switch(obj->tag) {
3648                 case LDKCOption_ScalarZ_Some: return 0;
3649                 case LDKCOption_ScalarZ_None: return 1;
3650                 default: abort();
3651         }
3652 }
3653 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3654         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3655         assert(obj->tag == LDKCOption_ScalarZ_Some);
3656                         LDKBigEndianScalar* some_ref = &obj->some;
3657         return tag_ptr(some_ref, false);
3658 }
3659 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3660 CHECK(owner->result_ok);
3661         return ThirtyTwoBytes_clone(&*owner->contents.result);
3662 }
3663 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3664         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3666         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3667         return ret_arr;
3668 }
3669
3670 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3671 CHECK(!owner->result_ok);
3672         return *owner->contents.err;
3673 }
3674 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3675         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3676         CResult_SharedSecretNoneZ_get_err(owner_conv);
3677 }
3678
3679 typedef struct LDKBaseSign_JCalls {
3680         atomic_size_t refcnt;
3681         uint32_t instance_ptr;
3682 } LDKBaseSign_JCalls;
3683 static void LDKBaseSign_JCalls_free(void* this_arg) {
3684         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3685         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3686                 FREE(j_calls);
3687         }
3688 }
3689 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3690         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3691         int64_t idx_conv = idx;
3692         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3693         LDKPublicKey ret_ref;
3694         CHECK(ret->arr_len == 33);
3695         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3696         return ret_ref;
3697 }
3698 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3699         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3700         int64_t idx_conv = idx;
3701         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3702         LDKThirtyTwoBytes ret_ref;
3703         CHECK(ret->arr_len == 32);
3704         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3705         return ret_ref;
3706 }
3707 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3708         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3709         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3710         uint64_t holder_tx_ref = 0;
3711         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3712         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3713         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3714         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3715         ptrArray preimages_arr = NULL;
3716         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3717         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3718         for (size_t m = 0; m < preimages_var.datalen; m++) {
3719                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3720                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3721                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3722         }
3723         
3724         FREE(preimages_var.data);
3725         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3726         void* ret_ptr = untag_ptr(ret);
3727         CHECK_ACCESS(ret_ptr);
3728         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3729         FREE(untag_ptr(ret));
3730         return ret_conv;
3731 }
3732 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3733         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3734         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3735         LDKThirtyTwoBytes ret_ref;
3736         CHECK(ret->arr_len == 32);
3737         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3738         return ret_ref;
3739 }
3740 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3741         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3742         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3743         uint64_t commitment_tx_ref = 0;
3744         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3745         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3746         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3747         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3748         ptrArray preimages_arr = NULL;
3749         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3750         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3751         for (size_t m = 0; m < preimages_var.datalen; m++) {
3752                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3753                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3754                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3755         }
3756         
3757         FREE(preimages_var.data);
3758         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3759         void* ret_ptr = untag_ptr(ret);
3760         CHECK_ACCESS(ret_ptr);
3761         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3762         FREE(untag_ptr(ret));
3763         return ret_conv;
3764 }
3765 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3766         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3767         int64_t idx_conv = idx;
3768         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3769         memcpy(secret_arr->elems, *secret, 32);
3770         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3771         void* ret_ptr = untag_ptr(ret);
3772         CHECK_ACCESS(ret_ptr);
3773         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3774         FREE(untag_ptr(ret));
3775         return ret_conv;
3776 }
3777 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3778         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3779         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3780         uint64_t commitment_tx_ref = 0;
3781         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3782         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3783         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3784         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3785         void* ret_ptr = untag_ptr(ret);
3786         CHECK_ACCESS(ret_ptr);
3787         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3788         FREE(untag_ptr(ret));
3789         return ret_conv;
3790 }
3791 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]) {
3792         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3793         LDKTransaction justice_tx_var = justice_tx;
3794         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3795         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3796         Transaction_free(justice_tx_var);
3797         uint32_t input_conv = input;
3798         int64_t amount_conv = amount;
3799         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3800         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3801         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);
3802         void* ret_ptr = untag_ptr(ret);
3803         CHECK_ACCESS(ret_ptr);
3804         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3805         FREE(untag_ptr(ret));
3806         return ret_conv;
3807 }
3808 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) {
3809         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3810         LDKTransaction justice_tx_var = justice_tx;
3811         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3812         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3813         Transaction_free(justice_tx_var);
3814         uint32_t input_conv = input;
3815         int64_t amount_conv = amount;
3816         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3817         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3818         LDKHTLCOutputInCommitment htlc_var = *htlc;
3819         uint64_t htlc_ref = 0;
3820         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3821         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3822         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3823         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);
3824         void* ret_ptr = untag_ptr(ret);
3825         CHECK_ACCESS(ret_ptr);
3826         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3827         FREE(untag_ptr(ret));
3828         return ret_conv;
3829 }
3830 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) {
3831         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3832         LDKTransaction htlc_tx_var = htlc_tx;
3833         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3834         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3835         Transaction_free(htlc_tx_var);
3836         uint32_t input_conv = input;
3837         int64_t amount_conv = amount;
3838         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3839         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3840         LDKHTLCOutputInCommitment htlc_var = *htlc;
3841         uint64_t htlc_ref = 0;
3842         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3843         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3844         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3845         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);
3846         void* ret_ptr = untag_ptr(ret);
3847         CHECK_ACCESS(ret_ptr);
3848         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3849         FREE(untag_ptr(ret));
3850         return ret_conv;
3851 }
3852 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3853         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3854         LDKClosingTransaction closing_tx_var = *closing_tx;
3855         uint64_t closing_tx_ref = 0;
3856         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3857         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3858         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3859         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3860         void* ret_ptr = untag_ptr(ret);
3861         CHECK_ACCESS(ret_ptr);
3862         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3863         FREE(untag_ptr(ret));
3864         return ret_conv;
3865 }
3866 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3867         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3868         LDKTransaction anchor_tx_var = anchor_tx;
3869         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
3870         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
3871         Transaction_free(anchor_tx_var);
3872         uint32_t input_conv = input;
3873         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
3874         void* ret_ptr = untag_ptr(ret);
3875         CHECK_ACCESS(ret_ptr);
3876         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3877         FREE(untag_ptr(ret));
3878         return ret_conv;
3879 }
3880 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3881         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3882         LDKUnsignedChannelAnnouncement msg_var = *msg;
3883         uint64_t msg_ref = 0;
3884         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3885         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3886         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3887         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
3888         void* ret_ptr = untag_ptr(ret);
3889         CHECK_ACCESS(ret_ptr);
3890         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3891         FREE(untag_ptr(ret));
3892         return ret_conv;
3893 }
3894 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3895         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3896         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3897         uint64_t channel_parameters_ref = 0;
3898         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3899         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3900         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3901         js_invoke_function_buuuuu(j_calls->instance_ptr, 15, channel_parameters_ref, 0, 0, 0, 0, 0);
3902 }
3903 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3904         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3905         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3906 }
3907 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3908         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3909         atomic_init(&calls->refcnt, 1);
3910         calls->instance_ptr = o;
3911
3912         LDKChannelPublicKeys pubkeys_conv;
3913         pubkeys_conv.inner = untag_ptr(pubkeys);
3914         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3915         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3916
3917         LDKBaseSign ret = {
3918                 .this_arg = (void*) calls,
3919                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3920                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3921                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3922                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3923                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3924                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3925                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3926                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3927                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3928                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3929                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3930                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall,
3931                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3932                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3933                 .free = LDKBaseSign_JCalls_free,
3934                 .pubkeys = pubkeys_conv,
3935                 .set_pubkeys = NULL,
3936         };
3937         return ret;
3938 }
3939 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3940         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3941         *res_ptr = LDKBaseSign_init(o, pubkeys);
3942         return tag_ptr(res_ptr, true);
3943 }
3944 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3945         void* this_arg_ptr = untag_ptr(this_arg);
3946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3947         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3948         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3949         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3950         return ret_arr;
3951 }
3952
3953 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3954         void* this_arg_ptr = untag_ptr(this_arg);
3955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3956         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3957         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3958         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3959         return ret_arr;
3960 }
3961
3962 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) {
3963         void* this_arg_ptr = untag_ptr(this_arg);
3964         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3965         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3966         LDKHolderCommitmentTransaction holder_tx_conv;
3967         holder_tx_conv.inner = untag_ptr(holder_tx);
3968         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3969         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3970         holder_tx_conv.is_owned = false;
3971         LDKCVec_PaymentPreimageZ preimages_constr;
3972         preimages_constr.datalen = preimages->arr_len;
3973         if (preimages_constr.datalen > 0)
3974                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3975         else
3976                 preimages_constr.data = NULL;
3977         int8_tArray* preimages_vals = (void*) preimages->elems;
3978         for (size_t m = 0; m < preimages_constr.datalen; m++) {
3979                 int8_tArray preimages_conv_12 = preimages_vals[m];
3980                 LDKThirtyTwoBytes preimages_conv_12_ref;
3981                 CHECK(preimages_conv_12->arr_len == 32);
3982                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3983                 preimages_constr.data[m] = preimages_conv_12_ref;
3984         }
3985         FREE(preimages);
3986         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3987         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3988         return tag_ptr(ret_conv, true);
3989 }
3990
3991 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
3992         void* this_arg_ptr = untag_ptr(this_arg);
3993         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3994         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3995         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3996         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3997         return ret_arr;
3998 }
3999
4000 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) {
4001         void* this_arg_ptr = untag_ptr(this_arg);
4002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4003         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4004         LDKCommitmentTransaction commitment_tx_conv;
4005         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4006         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4007         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4008         commitment_tx_conv.is_owned = false;
4009         LDKCVec_PaymentPreimageZ preimages_constr;
4010         preimages_constr.datalen = preimages->arr_len;
4011         if (preimages_constr.datalen > 0)
4012                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4013         else
4014                 preimages_constr.data = NULL;
4015         int8_tArray* preimages_vals = (void*) preimages->elems;
4016         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4017                 int8_tArray preimages_conv_12 = preimages_vals[m];
4018                 LDKThirtyTwoBytes preimages_conv_12_ref;
4019                 CHECK(preimages_conv_12->arr_len == 32);
4020                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4021                 preimages_constr.data[m] = preimages_conv_12_ref;
4022         }
4023         FREE(preimages);
4024         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4025         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4026         return tag_ptr(ret_conv, true);
4027 }
4028
4029 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) {
4030         void* this_arg_ptr = untag_ptr(this_arg);
4031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4032         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4033         unsigned char secret_arr[32];
4034         CHECK(secret->arr_len == 32);
4035         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4036         unsigned char (*secret_ref)[32] = &secret_arr;
4037         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4038         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4039         return tag_ptr(ret_conv, true);
4040 }
4041
4042 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) {
4043         void* this_arg_ptr = untag_ptr(this_arg);
4044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4045         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4046         LDKHolderCommitmentTransaction commitment_tx_conv;
4047         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4048         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4049         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4050         commitment_tx_conv.is_owned = false;
4051         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4052         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4053         return tag_ptr(ret_conv, true);
4054 }
4055
4056 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) {
4057         void* this_arg_ptr = untag_ptr(this_arg);
4058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4059         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4060         LDKTransaction justice_tx_ref;
4061         justice_tx_ref.datalen = justice_tx->arr_len;
4062         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4063         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4064         justice_tx_ref.data_is_owned = true;
4065         unsigned char per_commitment_key_arr[32];
4066         CHECK(per_commitment_key->arr_len == 32);
4067         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4068         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4069         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4070         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4071         return tag_ptr(ret_conv, true);
4072 }
4073
4074 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) {
4075         void* this_arg_ptr = untag_ptr(this_arg);
4076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4077         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4078         LDKTransaction justice_tx_ref;
4079         justice_tx_ref.datalen = justice_tx->arr_len;
4080         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4081         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4082         justice_tx_ref.data_is_owned = true;
4083         unsigned char per_commitment_key_arr[32];
4084         CHECK(per_commitment_key->arr_len == 32);
4085         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4086         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4087         LDKHTLCOutputInCommitment htlc_conv;
4088         htlc_conv.inner = untag_ptr(htlc);
4089         htlc_conv.is_owned = ptr_is_owned(htlc);
4090         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4091         htlc_conv.is_owned = false;
4092         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4093         *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);
4094         return tag_ptr(ret_conv, true);
4095 }
4096
4097 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) {
4098         void* this_arg_ptr = untag_ptr(this_arg);
4099         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4100         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4101         LDKTransaction htlc_tx_ref;
4102         htlc_tx_ref.datalen = htlc_tx->arr_len;
4103         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4104         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4105         htlc_tx_ref.data_is_owned = true;
4106         LDKPublicKey per_commitment_point_ref;
4107         CHECK(per_commitment_point->arr_len == 33);
4108         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4109         LDKHTLCOutputInCommitment htlc_conv;
4110         htlc_conv.inner = untag_ptr(htlc);
4111         htlc_conv.is_owned = ptr_is_owned(htlc);
4112         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4113         htlc_conv.is_owned = false;
4114         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4115         *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);
4116         return tag_ptr(ret_conv, true);
4117 }
4118
4119 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4120         void* this_arg_ptr = untag_ptr(this_arg);
4121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4122         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4123         LDKClosingTransaction closing_tx_conv;
4124         closing_tx_conv.inner = untag_ptr(closing_tx);
4125         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4126         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4127         closing_tx_conv.is_owned = false;
4128         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4129         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4130         return tag_ptr(ret_conv, true);
4131 }
4132
4133 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) {
4134         void* this_arg_ptr = untag_ptr(this_arg);
4135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4136         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4137         LDKTransaction anchor_tx_ref;
4138         anchor_tx_ref.datalen = anchor_tx->arr_len;
4139         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4140         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4141         anchor_tx_ref.data_is_owned = true;
4142         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4143         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4144         return tag_ptr(ret_conv, true);
4145 }
4146
4147 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4148         void* this_arg_ptr = untag_ptr(this_arg);
4149         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4150         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4151         LDKUnsignedChannelAnnouncement msg_conv;
4152         msg_conv.inner = untag_ptr(msg);
4153         msg_conv.is_owned = ptr_is_owned(msg);
4154         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4155         msg_conv.is_owned = false;
4156         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4157         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4158         return tag_ptr(ret_conv, true);
4159 }
4160
4161 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
4162         void* this_arg_ptr = untag_ptr(this_arg);
4163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4164         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4165         LDKChannelTransactionParameters channel_parameters_conv;
4166         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4167         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4168         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4169         channel_parameters_conv.is_owned = false;
4170         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4171 }
4172
4173 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4174         if (this_arg->set_pubkeys != NULL)
4175                 this_arg->set_pubkeys(this_arg);
4176         return this_arg->pubkeys;
4177 }
4178 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4179         void* this_arg_ptr = untag_ptr(this_arg);
4180         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4181         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4182         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4183         uint64_t ret_ref = 0;
4184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4186         return ret_ref;
4187 }
4188
4189 typedef struct LDKSign_JCalls {
4190         atomic_size_t refcnt;
4191         uint32_t instance_ptr;
4192         LDKBaseSign_JCalls* BaseSign;
4193 } LDKSign_JCalls;
4194 static void LDKSign_JCalls_free(void* this_arg) {
4195         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4196         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4197                 FREE(j_calls);
4198         }
4199 }
4200 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4201         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4202         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4203         LDKCVec_u8Z ret_ref;
4204         ret_ref.datalen = ret->arr_len;
4205         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4206         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4207         return ret_ref;
4208 }
4209 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4210         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4211         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4212         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4213 }
4214 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4215         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4216         atomic_init(&calls->refcnt, 1);
4217         calls->instance_ptr = o;
4218
4219         LDKChannelPublicKeys pubkeys_conv;
4220         pubkeys_conv.inner = untag_ptr(pubkeys);
4221         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4222         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4223
4224         LDKSign ret = {
4225                 .this_arg = (void*) calls,
4226                 .write = write_LDKSign_jcall,
4227                 .cloned = LDKSign_JCalls_cloned,
4228                 .free = LDKSign_JCalls_free,
4229                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4230         };
4231         calls->BaseSign = ret.BaseSign.this_arg;
4232         return ret;
4233 }
4234 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4235         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4236         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4237         return tag_ptr(res_ptr, true);
4238 }
4239 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4240         void* this_arg_ptr = untag_ptr(this_arg);
4241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4242         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4243         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4244         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4245         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4246         CVec_u8Z_free(ret_var);
4247         return ret_arr;
4248 }
4249
4250 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4251 CHECK(owner->result_ok);
4252         return Sign_clone(&*owner->contents.result);
4253 }
4254 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4255         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4256         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4257         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4258         return tag_ptr(ret_ret, true);
4259 }
4260
4261 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4262 CHECK(!owner->result_ok);
4263         return DecodeError_clone(&*owner->contents.err);
4264 }
4265 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4266         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4267         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4268         *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv);
4269         uint64_t ret_ref = tag_ptr(ret_copy, true);
4270         return ret_ref;
4271 }
4272
4273 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4274 CHECK(owner->result_ok);
4275         return *owner->contents.result;
4276 }
4277 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4278         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4279         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4280         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4281         return ret_arr;
4282 }
4283
4284 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4285 CHECK(!owner->result_ok);
4286         return *owner->contents.err;
4287 }
4288 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4289         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4290         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4291 }
4292
4293 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4294         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4295         for (size_t i = 0; i < ret.datalen; i++) {
4296                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4297         }
4298         return ret;
4299 }
4300 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4301 CHECK(owner->result_ok);
4302         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4303 }
4304 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4305         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4306         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4307         ptrArray ret_arr = NULL;
4308         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4309         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4310         for (size_t m = 0; m < ret_var.datalen; m++) {
4311                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4312                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4313                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4314                 CVec_u8Z_free(ret_conv_12_var);
4315                 ret_arr_ptr[m] = ret_conv_12_arr;
4316         }
4317         
4318         FREE(ret_var.data);
4319         return ret_arr;
4320 }
4321
4322 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4323 CHECK(!owner->result_ok);
4324         return *owner->contents.err;
4325 }
4326 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4327         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4328         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4329 }
4330
4331 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4332         LDKInMemorySigner ret = *owner->contents.result;
4333         ret.is_owned = false;
4334         return ret;
4335 }
4336 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4337         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4338         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4339         uint64_t ret_ref = 0;
4340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4342         return ret_ref;
4343 }
4344
4345 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4346 CHECK(!owner->result_ok);
4347         return DecodeError_clone(&*owner->contents.err);
4348 }
4349 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4350         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4352         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4353         uint64_t ret_ref = tag_ptr(ret_copy, true);
4354         return ret_ref;
4355 }
4356
4357 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4358         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4359         for (size_t i = 0; i < ret.datalen; i++) {
4360                 ret.data[i] = TxOut_clone(&orig->data[i]);
4361         }
4362         return ret;
4363 }
4364 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4365 CHECK(owner->result_ok);
4366         return *owner->contents.result;
4367 }
4368 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4369         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4370         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4373         return ret_arr;
4374 }
4375
4376 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4377 CHECK(!owner->result_ok);
4378         return *owner->contents.err;
4379 }
4380 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4381         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4382         CResult_TransactionNoneZ_get_err(owner_conv);
4383 }
4384
4385 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4386         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4387         switch(obj->tag) {
4388                 case LDKCOption_u16Z_Some: return 0;
4389                 case LDKCOption_u16Z_None: return 1;
4390                 default: abort();
4391         }
4392 }
4393 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4394         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4395         assert(obj->tag == LDKCOption_u16Z_Some);
4396                         int16_t some_conv = obj->some;
4397         return some_conv;
4398 }
4399 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4400         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4401         switch(obj->tag) {
4402                 case LDKAPIError_APIMisuseError: return 0;
4403                 case LDKAPIError_FeeRateTooHigh: return 1;
4404                 case LDKAPIError_RouteError: return 2;
4405                 case LDKAPIError_ChannelUnavailable: return 3;
4406                 case LDKAPIError_MonitorUpdateInProgress: return 4;
4407                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4408                 default: abort();
4409         }
4410 }
4411 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4412         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4413         assert(obj->tag == LDKAPIError_APIMisuseError);
4414                         LDKStr err_str = obj->api_misuse_error.err;
4415                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4416         return err_conv;
4417 }
4418 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4419         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4420         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4421                         LDKStr err_str = obj->fee_rate_too_high.err;
4422                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4423         return err_conv;
4424 }
4425 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4426         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4427         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4428                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4429         return feerate_conv;
4430 }
4431 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4432         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4433         assert(obj->tag == LDKAPIError_RouteError);
4434                         LDKStr err_str = obj->route_error.err;
4435                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4436         return err_conv;
4437 }
4438 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4439         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4440         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4441                         LDKStr err_str = obj->channel_unavailable.err;
4442                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4443         return err_conv;
4444 }
4445 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4446         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4447         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4448                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4449                         uint64_t script_ref = 0;
4450                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4451                         script_ref = tag_ptr(script_var.inner, false);
4452         return script_ref;
4453 }
4454 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4455 CHECK(owner->result_ok);
4456         return *owner->contents.result;
4457 }
4458 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4459         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4460         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4461 }
4462
4463 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4464 CHECK(!owner->result_ok);
4465         return APIError_clone(&*owner->contents.err);
4466 }
4467 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4468         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4469         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4470         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4471         uint64_t ret_ref = tag_ptr(ret_copy, true);
4472         return ret_ref;
4473 }
4474
4475 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4476         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4477         for (size_t i = 0; i < ret.datalen; i++) {
4478                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4479         }
4480         return ret;
4481 }
4482 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4483         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4484         for (size_t i = 0; i < ret.datalen; i++) {
4485                 ret.data[i] = APIError_clone(&orig->data[i]);
4486         }
4487         return ret;
4488 }
4489 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4490 CHECK(owner->result_ok);
4491         return ThirtyTwoBytes_clone(&*owner->contents.result);
4492 }
4493 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4494         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4495         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4496         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4497         return ret_arr;
4498 }
4499
4500 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4501 CHECK(!owner->result_ok);
4502         return APIError_clone(&*owner->contents.err);
4503 }
4504 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4505         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4506         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4507         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4508         uint64_t ret_ref = tag_ptr(ret_copy, true);
4509         return ret_ref;
4510 }
4511
4512 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4513         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4514         switch(obj->tag) {
4515                 case LDKPaymentSendFailure_ParameterError: return 0;
4516                 case LDKPaymentSendFailure_PathParameterError: return 1;
4517                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4518                 case LDKPaymentSendFailure_PartialFailure: return 3;
4519                 default: abort();
4520         }
4521 }
4522 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4523         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4524         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4525                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4526         return parameter_error_ref;
4527 }
4528 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4529         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4530         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4531                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4532                         uint64_tArray path_parameter_error_arr = NULL;
4533                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4534                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4535                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4536                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4537                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4538                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4539                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4540                         }
4541                         
4542         return path_parameter_error_arr;
4543 }
4544 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4545         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4546         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4547                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4548                         uint64_tArray all_failed_retry_safe_arr = NULL;
4549                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4550                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4551                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4552                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4553                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4554                         }
4555                         
4556         return all_failed_retry_safe_arr;
4557 }
4558 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4559         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4560         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4561                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4562                         uint64_tArray results_arr = NULL;
4563                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4564                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4565                         for (size_t w = 0; w < results_var.datalen; w++) {
4566                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4567                                 *results_conv_22_conv = results_var.data[w];
4568                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4569                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4570                         }
4571                         
4572         return results_arr;
4573 }
4574 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4575         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4576         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4577                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4578                         uint64_t failed_paths_retry_ref = 0;
4579                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4580                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4581         return failed_paths_retry_ref;
4582 }
4583 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4584         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4585         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4586                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4587                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4588         return payment_id_arr;
4589 }
4590 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4591 CHECK(owner->result_ok);
4592         return ThirtyTwoBytes_clone(&*owner->contents.result);
4593 }
4594 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4595         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4596         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4597         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4598         return ret_arr;
4599 }
4600
4601 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4602 CHECK(!owner->result_ok);
4603         return PaymentSendFailure_clone(&*owner->contents.err);
4604 }
4605 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4606         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4607         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4608         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4609         uint64_t ret_ref = tag_ptr(ret_copy, true);
4610         return ret_ref;
4611 }
4612
4613 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4614 CHECK(owner->result_ok);
4615         return *owner->contents.result;
4616 }
4617 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4618         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4619         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4620 }
4621
4622 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4623 CHECK(!owner->result_ok);
4624         return PaymentSendFailure_clone(&*owner->contents.err);
4625 }
4626 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4627         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4628         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4629         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4630         uint64_t ret_ref = tag_ptr(ret_copy, true);
4631         return ret_ref;
4632 }
4633
4634 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4635         return ThirtyTwoBytes_clone(&owner->a);
4636 }
4637 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4638         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4639         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4640         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4641         return ret_arr;
4642 }
4643
4644 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4645         return ThirtyTwoBytes_clone(&owner->b);
4646 }
4647 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4648         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4649         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4650         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4651         return ret_arr;
4652 }
4653
4654 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4655 CHECK(owner->result_ok);
4656         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4657 }
4658 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4659         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4660         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4661         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4662         return tag_ptr(ret_conv, true);
4663 }
4664
4665 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4666 CHECK(!owner->result_ok);
4667         return PaymentSendFailure_clone(&*owner->contents.err);
4668 }
4669 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4670         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4671         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4672         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4673         uint64_t ret_ref = tag_ptr(ret_copy, true);
4674         return ret_ref;
4675 }
4676
4677 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4678         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4679         for (size_t i = 0; i < ret.datalen; i++) {
4680                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4681         }
4682         return ret;
4683 }
4684 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4685         return ThirtyTwoBytes_clone(&owner->a);
4686 }
4687 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4688         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4689         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4690         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4691         return ret_arr;
4692 }
4693
4694 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4695         return ThirtyTwoBytes_clone(&owner->b);
4696 }
4697 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4698         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4699         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4700         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4701         return ret_arr;
4702 }
4703
4704 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4705 CHECK(owner->result_ok);
4706         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4707 }
4708 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4709         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4710         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4711         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4712         return tag_ptr(ret_conv, true);
4713 }
4714
4715 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4716 CHECK(!owner->result_ok);
4717         return *owner->contents.err;
4718 }
4719 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4720         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4721         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4722 }
4723
4724 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4725 CHECK(owner->result_ok);
4726         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4727 }
4728 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4729         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4730         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4731         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4732         return tag_ptr(ret_conv, true);
4733 }
4734
4735 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4736 CHECK(!owner->result_ok);
4737         return APIError_clone(&*owner->contents.err);
4738 }
4739 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4740         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4741         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4742         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4743         uint64_t ret_ref = tag_ptr(ret_copy, true);
4744         return ret_ref;
4745 }
4746
4747 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4748 CHECK(owner->result_ok);
4749         return ThirtyTwoBytes_clone(&*owner->contents.result);
4750 }
4751 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4752         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4753         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4754         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4755         return ret_arr;
4756 }
4757
4758 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4759 CHECK(!owner->result_ok);
4760         return *owner->contents.err;
4761 }
4762 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4763         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4764         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4765 }
4766
4767 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4768 CHECK(owner->result_ok);
4769         return ThirtyTwoBytes_clone(&*owner->contents.result);
4770 }
4771 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4772         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4773         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4774         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4775         return ret_arr;
4776 }
4777
4778 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4779 CHECK(!owner->result_ok);
4780         return APIError_clone(&*owner->contents.err);
4781 }
4782 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4783         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4784         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4785         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4786         uint64_t ret_ref = tag_ptr(ret_copy, true);
4787         return ret_ref;
4788 }
4789
4790 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4791 CHECK(owner->result_ok);
4792         return ThirtyTwoBytes_clone(&*owner->contents.result);
4793 }
4794 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4795         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4796         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4797         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4798         return ret_arr;
4799 }
4800
4801 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4802 CHECK(!owner->result_ok);
4803         return APIError_clone(&*owner->contents.err);
4804 }
4805 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4806         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4807         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4808         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4809         uint64_t ret_ref = tag_ptr(ret_copy, true);
4810         return ret_ref;
4811 }
4812
4813 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4814         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4815         ret.is_owned = false;
4816         return ret;
4817 }
4818 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4819         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4820         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4821         uint64_t ret_ref = 0;
4822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4824         return ret_ref;
4825 }
4826
4827 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4828 CHECK(!owner->result_ok);
4829         return DecodeError_clone(&*owner->contents.err);
4830 }
4831 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4832         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4833         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4834         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4835         uint64_t ret_ref = tag_ptr(ret_copy, true);
4836         return ret_ref;
4837 }
4838
4839 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4840         LDKChannelCounterparty ret = *owner->contents.result;
4841         ret.is_owned = false;
4842         return ret;
4843 }
4844 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4845         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4846         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4847         uint64_t ret_ref = 0;
4848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4850         return ret_ref;
4851 }
4852
4853 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4854 CHECK(!owner->result_ok);
4855         return DecodeError_clone(&*owner->contents.err);
4856 }
4857 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4858         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4860         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4861         uint64_t ret_ref = tag_ptr(ret_copy, true);
4862         return ret_ref;
4863 }
4864
4865 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4866         LDKChannelDetails ret = *owner->contents.result;
4867         ret.is_owned = false;
4868         return ret;
4869 }
4870 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4871         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4872         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4873         uint64_t ret_ref = 0;
4874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4876         return ret_ref;
4877 }
4878
4879 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4880 CHECK(!owner->result_ok);
4881         return DecodeError_clone(&*owner->contents.err);
4882 }
4883 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4884         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4886         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4887         uint64_t ret_ref = tag_ptr(ret_copy, true);
4888         return ret_ref;
4889 }
4890
4891 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4892         LDKPhantomRouteHints ret = *owner->contents.result;
4893         ret.is_owned = false;
4894         return ret;
4895 }
4896 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4897         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4898         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4899         uint64_t ret_ref = 0;
4900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4902         return ret_ref;
4903 }
4904
4905 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4906 CHECK(!owner->result_ok);
4907         return DecodeError_clone(&*owner->contents.err);
4908 }
4909 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4910         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4912         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4913         uint64_t ret_ref = tag_ptr(ret_copy, true);
4914         return ret_ref;
4915 }
4916
4917 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4918         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4919         for (size_t i = 0; i < ret.datalen; i++) {
4920                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4921         }
4922         return ret;
4923 }
4924 typedef struct LDKWatch_JCalls {
4925         atomic_size_t refcnt;
4926         uint32_t instance_ptr;
4927 } LDKWatch_JCalls;
4928 static void LDKWatch_JCalls_free(void* this_arg) {
4929         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4930         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4931                 FREE(j_calls);
4932         }
4933 }
4934 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4935         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4936         LDKOutPoint funding_txo_var = funding_txo;
4937         uint64_t funding_txo_ref = 0;
4938         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4939         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4940         LDKChannelMonitor monitor_var = monitor;
4941         uint64_t monitor_ref = 0;
4942         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4943         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4944         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4945         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
4946         return ret_conv;
4947 }
4948 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4949         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4950         LDKOutPoint funding_txo_var = funding_txo;
4951         uint64_t funding_txo_ref = 0;
4952         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4953         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4954         LDKChannelMonitorUpdate update_var = update;
4955         uint64_t update_ref = 0;
4956         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4957         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
4958         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
4959         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
4960         return ret_conv;
4961 }
4962 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4963         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4964         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
4965         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
4966         ret_constr.datalen = ret->arr_len;
4967         if (ret_constr.datalen > 0)
4968                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
4969         else
4970                 ret_constr.data = NULL;
4971         uint64_t* ret_vals = ret->elems;
4972         for (size_t x = 0; x < ret_constr.datalen; x++) {
4973                 uint64_t ret_conv_49 = ret_vals[x];
4974                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
4975                 CHECK_ACCESS(ret_conv_49_ptr);
4976                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
4977                 FREE(untag_ptr(ret_conv_49));
4978                 ret_constr.data[x] = ret_conv_49_conv;
4979         }
4980         FREE(ret);
4981         return ret_constr;
4982 }
4983 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4984         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4985         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4986 }
4987 static inline LDKWatch LDKWatch_init (JSValue o) {
4988         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4989         atomic_init(&calls->refcnt, 1);
4990         calls->instance_ptr = o;
4991
4992         LDKWatch ret = {
4993                 .this_arg = (void*) calls,
4994                 .watch_channel = watch_channel_LDKWatch_jcall,
4995                 .update_channel = update_channel_LDKWatch_jcall,
4996                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4997                 .free = LDKWatch_JCalls_free,
4998         };
4999         return ret;
5000 }
5001 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5002         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5003         *res_ptr = LDKWatch_init(o);
5004         return tag_ptr(res_ptr, true);
5005 }
5006 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5007         void* this_arg_ptr = untag_ptr(this_arg);
5008         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5009         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5010         LDKOutPoint funding_txo_conv;
5011         funding_txo_conv.inner = untag_ptr(funding_txo);
5012         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5013         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5014         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5015         LDKChannelMonitor monitor_conv;
5016         monitor_conv.inner = untag_ptr(monitor);
5017         monitor_conv.is_owned = ptr_is_owned(monitor);
5018         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5019         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5020         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5021         return ret_conv;
5022 }
5023
5024 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5025         void* this_arg_ptr = untag_ptr(this_arg);
5026         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5027         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5028         LDKOutPoint funding_txo_conv;
5029         funding_txo_conv.inner = untag_ptr(funding_txo);
5030         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5031         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5032         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5033         LDKChannelMonitorUpdate update_conv;
5034         update_conv.inner = untag_ptr(update);
5035         update_conv.is_owned = ptr_is_owned(update);
5036         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5037         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5038         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv));
5039         return ret_conv;
5040 }
5041
5042 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5043         void* this_arg_ptr = untag_ptr(this_arg);
5044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5045         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5046         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5047         uint64_tArray ret_arr = NULL;
5048         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5049         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5050         for (size_t x = 0; x < ret_var.datalen; x++) {
5051                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5052                 *ret_conv_49_conv = ret_var.data[x];
5053                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5054         }
5055         
5056         FREE(ret_var.data);
5057         return ret_arr;
5058 }
5059
5060 typedef struct LDKBroadcasterInterface_JCalls {
5061         atomic_size_t refcnt;
5062         uint32_t instance_ptr;
5063 } LDKBroadcasterInterface_JCalls;
5064 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5065         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5066         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5067                 FREE(j_calls);
5068         }
5069 }
5070 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5071         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5072         LDKTransaction tx_var = tx;
5073         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5074         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5075         Transaction_free(tx_var);
5076         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5077 }
5078 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5079         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5080         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5081 }
5082 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5083         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5084         atomic_init(&calls->refcnt, 1);
5085         calls->instance_ptr = o;
5086
5087         LDKBroadcasterInterface ret = {
5088                 .this_arg = (void*) calls,
5089                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5090                 .free = LDKBroadcasterInterface_JCalls_free,
5091         };
5092         return ret;
5093 }
5094 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5095         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5096         *res_ptr = LDKBroadcasterInterface_init(o);
5097         return tag_ptr(res_ptr, true);
5098 }
5099 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5100         void* this_arg_ptr = untag_ptr(this_arg);
5101         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5102         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5103         LDKTransaction tx_ref;
5104         tx_ref.datalen = tx->arr_len;
5105         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5106         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5107         tx_ref.data_is_owned = true;
5108         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5109 }
5110
5111 typedef struct LDKKeysInterface_JCalls {
5112         atomic_size_t refcnt;
5113         uint32_t instance_ptr;
5114 } LDKKeysInterface_JCalls;
5115 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5116         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5117         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5118                 FREE(j_calls);
5119         }
5120 }
5121 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5122         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5123         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5124         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, recipient_conv, 0, 0, 0, 0, 0);
5125         void* ret_ptr = untag_ptr(ret);
5126         CHECK_ACCESS(ret_ptr);
5127         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5128         FREE(untag_ptr(ret));
5129         return ret_conv;
5130 }
5131 LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5132         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5133         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5134         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, recipient_conv, 0, 0, 0, 0, 0);
5135         void* ret_ptr = untag_ptr(ret);
5136         CHECK_ACCESS(ret_ptr);
5137         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5138         FREE(untag_ptr(ret));
5139         return ret_conv;
5140 }
5141 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5142         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5143         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5144         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5145         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5146         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5147         *tweak_copy = tweak;
5148         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5149         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 23, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5150         void* ret_ptr = untag_ptr(ret);
5151         CHECK_ACCESS(ret_ptr);
5152         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5153         FREE(untag_ptr(ret));
5154         return ret_conv;
5155 }
5156 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5157         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5158         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
5159         LDKCVec_u8Z ret_ref;
5160         ret_ref.datalen = ret->arr_len;
5161         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5162         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5163         return ret_ref;
5164 }
5165 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5166         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5167         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5168         LDKShutdownScript ret_conv;
5169         ret_conv.inner = untag_ptr(ret);
5170         ret_conv.is_owned = ptr_is_owned(ret);
5171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5172         return ret_conv;
5173 }
5174 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5175         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5176         jboolean inbound_conv = inbound;
5177         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5178         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 26, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
5179         void* ret_ptr = untag_ptr(ret);
5180         CHECK_ACCESS(ret_ptr);
5181         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5182         FREE(untag_ptr(ret));
5183         return ret_conv;
5184 }
5185 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5186         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5187         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, 0, 0, 0, 0, 0, 0);
5188         LDKThirtyTwoBytes ret_ref;
5189         CHECK(ret->arr_len == 32);
5190         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5191         return ret_ref;
5192 }
5193 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5194         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5195         LDKu8slice reader_var = reader;
5196         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5197         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5198         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5199         void* ret_ptr = untag_ptr(ret);
5200         CHECK_ACCESS(ret_ptr);
5201         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5202         FREE(untag_ptr(ret));
5203         return ret_conv;
5204 }
5205 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5206         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5207         LDKu8slice hrp_bytes_var = hrp_bytes;
5208         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5209         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5210         LDKCVec_u5Z invoice_data_var = invoice_data;
5211         ptrArray invoice_data_arr = NULL;
5212         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5213         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5214         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5215                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5216                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5217         }
5218         
5219         FREE(invoice_data_var.data);
5220         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5221         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);
5222         void* ret_ptr = untag_ptr(ret);
5223         CHECK_ACCESS(ret_ptr);
5224         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5225         FREE(untag_ptr(ret));
5226         return ret_conv;
5227 }
5228 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5229         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5230         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5231         LDKThirtyTwoBytes ret_ref;
5232         CHECK(ret->arr_len == 32);
5233         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5234         return ret_ref;
5235 }
5236 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5237         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5238         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5239 }
5240 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5241         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5242         atomic_init(&calls->refcnt, 1);
5243         calls->instance_ptr = o;
5244
5245         LDKKeysInterface ret = {
5246                 .this_arg = (void*) calls,
5247                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5248                 .get_node_id = get_node_id_LDKKeysInterface_jcall,
5249                 .ecdh = ecdh_LDKKeysInterface_jcall,
5250                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5251                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5252                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5253                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5254                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5255                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5256                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5257                 .free = LDKKeysInterface_JCalls_free,
5258         };
5259         return ret;
5260 }
5261 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5262         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5263         *res_ptr = LDKKeysInterface_init(o);
5264         return tag_ptr(res_ptr, true);
5265 }
5266 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5267         void* this_arg_ptr = untag_ptr(this_arg);
5268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5269         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5270         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5271         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5272         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5273         return tag_ptr(ret_conv, true);
5274 }
5275
5276 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_id"))) TS_KeysInterface_get_node_id(uint64_t this_arg, uint32_t recipient) {
5277         void* this_arg_ptr = untag_ptr(this_arg);
5278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5279         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5280         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5281         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5282         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5283         return tag_ptr(ret_conv, true);
5284 }
5285
5286 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) {
5287         void* this_arg_ptr = untag_ptr(this_arg);
5288         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5289         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5290         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5291         LDKPublicKey other_key_ref;
5292         CHECK(other_key->arr_len == 33);
5293         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5294         void* tweak_ptr = untag_ptr(tweak);
5295         CHECK_ACCESS(tweak_ptr);
5296         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5297         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5298         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5299         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5300         return tag_ptr(ret_conv, true);
5301 }
5302
5303 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5304         void* this_arg_ptr = untag_ptr(this_arg);
5305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5306         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5307         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5308         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5309         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5310         CVec_u8Z_free(ret_var);
5311         return ret_arr;
5312 }
5313
5314 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5315         void* this_arg_ptr = untag_ptr(this_arg);
5316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5317         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5318         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5319         uint64_t ret_ref = 0;
5320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5322         return ret_ref;
5323 }
5324
5325 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) {
5326         void* this_arg_ptr = untag_ptr(this_arg);
5327         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5328         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5329         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5330         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5331         return tag_ptr(ret_ret, true);
5332 }
5333
5334 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5335         void* this_arg_ptr = untag_ptr(this_arg);
5336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5337         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5338         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5339         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5340         return ret_arr;
5341 }
5342
5343 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5344         void* this_arg_ptr = untag_ptr(this_arg);
5345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5346         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5347         LDKu8slice reader_ref;
5348         reader_ref.datalen = reader->arr_len;
5349         reader_ref.data = reader->elems;
5350         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5351         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5352         FREE(reader);
5353         return tag_ptr(ret_conv, true);
5354 }
5355
5356 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) {
5357         void* this_arg_ptr = untag_ptr(this_arg);
5358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5359         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5360         LDKu8slice hrp_bytes_ref;
5361         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5362         hrp_bytes_ref.data = hrp_bytes->elems;
5363         LDKCVec_u5Z invoice_data_constr;
5364         invoice_data_constr.datalen = invoice_data->arr_len;
5365         if (invoice_data_constr.datalen > 0)
5366                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5367         else
5368                 invoice_data_constr.data = NULL;
5369         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5370         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5371                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5372                 
5373                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5374         }
5375         FREE(invoice_data);
5376         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5377         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5378         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5379         FREE(hrp_bytes);
5380         return tag_ptr(ret_conv, true);
5381 }
5382
5383 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5384         void* this_arg_ptr = untag_ptr(this_arg);
5385         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5386         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5387         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5388         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5389         return ret_arr;
5390 }
5391
5392 typedef struct LDKFeeEstimator_JCalls {
5393         atomic_size_t refcnt;
5394         uint32_t instance_ptr;
5395 } LDKFeeEstimator_JCalls;
5396 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5397         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5398         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5399                 FREE(j_calls);
5400         }
5401 }
5402 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5403         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5404         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5405         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, confirmation_target_conv, 0, 0, 0, 0, 0);
5406 }
5407 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5408         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5410 }
5411 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5412         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5413         atomic_init(&calls->refcnt, 1);
5414         calls->instance_ptr = o;
5415
5416         LDKFeeEstimator ret = {
5417                 .this_arg = (void*) calls,
5418                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5419                 .free = LDKFeeEstimator_JCalls_free,
5420         };
5421         return ret;
5422 }
5423 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5424         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5425         *res_ptr = LDKFeeEstimator_init(o);
5426         return tag_ptr(res_ptr, true);
5427 }
5428 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) {
5429         void* this_arg_ptr = untag_ptr(this_arg);
5430         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5431         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5432         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5433         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5434         return ret_conv;
5435 }
5436
5437 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5438         return ThirtyTwoBytes_clone(&owner->a);
5439 }
5440 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5441         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5442         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5443         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5444         return ret_arr;
5445 }
5446
5447 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5448         LDKChannelManager ret = owner->b;
5449         ret.is_owned = false;
5450         return ret;
5451 }
5452 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5453         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5454         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5455         uint64_t ret_ref = 0;
5456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5458         return ret_ref;
5459 }
5460
5461 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5462 CHECK(owner->result_ok);
5463         return &*owner->contents.result;
5464 }
5465 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5466         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5467         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5468         return ret_ret;
5469 }
5470
5471 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5472 CHECK(!owner->result_ok);
5473         return DecodeError_clone(&*owner->contents.err);
5474 }
5475 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5476         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5478         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5479         uint64_t ret_ref = tag_ptr(ret_copy, true);
5480         return ret_ref;
5481 }
5482
5483 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5484         LDKChannelConfig ret = *owner->contents.result;
5485         ret.is_owned = false;
5486         return ret;
5487 }
5488 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5489         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5490         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5491         uint64_t ret_ref = 0;
5492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5494         return ret_ref;
5495 }
5496
5497 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5498 CHECK(!owner->result_ok);
5499         return DecodeError_clone(&*owner->contents.err);
5500 }
5501 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5502         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5504         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5505         uint64_t ret_ref = tag_ptr(ret_copy, true);
5506         return ret_ref;
5507 }
5508
5509 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5510         LDKOutPoint ret = *owner->contents.result;
5511         ret.is_owned = false;
5512         return ret;
5513 }
5514 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5515         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5516         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5517         uint64_t ret_ref = 0;
5518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5520         return ret_ref;
5521 }
5522
5523 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5524 CHECK(!owner->result_ok);
5525         return DecodeError_clone(&*owner->contents.err);
5526 }
5527 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5528         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5530         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5531         uint64_t ret_ref = tag_ptr(ret_copy, true);
5532         return ret_ref;
5533 }
5534
5535 typedef struct LDKType_JCalls {
5536         atomic_size_t refcnt;
5537         uint32_t instance_ptr;
5538 } LDKType_JCalls;
5539 static void LDKType_JCalls_free(void* this_arg) {
5540         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5541         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5542                 FREE(j_calls);
5543         }
5544 }
5545 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5546         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5547         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
5548 }
5549 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5550         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5551         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5552         LDKStr ret_conv = str_ref_to_owned_c(ret);
5553         return ret_conv;
5554 }
5555 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5556         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5557         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5558         LDKCVec_u8Z ret_ref;
5559         ret_ref.datalen = ret->arr_len;
5560         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5561         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5562         return ret_ref;
5563 }
5564 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5565         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5566         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5567 }
5568 static inline LDKType LDKType_init (JSValue o) {
5569         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5570         atomic_init(&calls->refcnt, 1);
5571         calls->instance_ptr = o;
5572
5573         LDKType ret = {
5574                 .this_arg = (void*) calls,
5575                 .type_id = type_id_LDKType_jcall,
5576                 .debug_str = debug_str_LDKType_jcall,
5577                 .write = write_LDKType_jcall,
5578                 .cloned = LDKType_JCalls_cloned,
5579                 .free = LDKType_JCalls_free,
5580         };
5581         return ret;
5582 }
5583 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5584         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5585         *res_ptr = LDKType_init(o);
5586         return tag_ptr(res_ptr, true);
5587 }
5588 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5589         void* this_arg_ptr = untag_ptr(this_arg);
5590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5591         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5592         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5593         return ret_conv;
5594 }
5595
5596 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5597         void* this_arg_ptr = untag_ptr(this_arg);
5598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5599         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5600         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5601         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5602         Str_free(ret_str);
5603         return ret_conv;
5604 }
5605
5606 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5607         void* this_arg_ptr = untag_ptr(this_arg);
5608         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5609         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5610         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5611         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5612         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5613         CVec_u8Z_free(ret_var);
5614         return ret_arr;
5615 }
5616
5617 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5618         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5619         switch(obj->tag) {
5620                 case LDKCOption_TypeZ_Some: return 0;
5621                 case LDKCOption_TypeZ_None: return 1;
5622                 default: abort();
5623         }
5624 }
5625 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5626         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5627         assert(obj->tag == LDKCOption_TypeZ_Some);
5628                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5629                         *some_ret = Type_clone(&obj->some);
5630         return tag_ptr(some_ret, true);
5631 }
5632 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5633 CHECK(owner->result_ok);
5634         return COption_TypeZ_clone(&*owner->contents.result);
5635 }
5636 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5637         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5638         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5639         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5640         uint64_t ret_ref = tag_ptr(ret_copy, true);
5641         return ret_ref;
5642 }
5643
5644 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5645 CHECK(!owner->result_ok);
5646         return DecodeError_clone(&*owner->contents.err);
5647 }
5648 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5649         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5650         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5651         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5652         uint64_t ret_ref = tag_ptr(ret_copy, true);
5653         return ret_ref;
5654 }
5655
5656 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5657         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5658         switch(obj->tag) {
5659                 case LDKPaymentError_Invoice: return 0;
5660                 case LDKPaymentError_Routing: return 1;
5661                 case LDKPaymentError_Sending: return 2;
5662                 default: abort();
5663         }
5664 }
5665 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5666         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5667         assert(obj->tag == LDKPaymentError_Invoice);
5668                         LDKStr invoice_str = obj->invoice;
5669                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5670         return invoice_conv;
5671 }
5672 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5673         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5674         assert(obj->tag == LDKPaymentError_Routing);
5675                         LDKLightningError routing_var = obj->routing;
5676                         uint64_t routing_ref = 0;
5677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5678                         routing_ref = tag_ptr(routing_var.inner, false);
5679         return routing_ref;
5680 }
5681 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5682         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5683         assert(obj->tag == LDKPaymentError_Sending);
5684                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5685         return sending_ref;
5686 }
5687 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5688 CHECK(owner->result_ok);
5689         return ThirtyTwoBytes_clone(&*owner->contents.result);
5690 }
5691 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5692         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5693         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5694         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5695         return ret_arr;
5696 }
5697
5698 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5699 CHECK(!owner->result_ok);
5700         return PaymentError_clone(&*owner->contents.err);
5701 }
5702 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5703         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5704         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5705         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5706         uint64_t ret_ref = tag_ptr(ret_copy, true);
5707         return ret_ref;
5708 }
5709
5710 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5711         LDKInFlightHtlcs ret = *owner->contents.result;
5712         ret.is_owned = false;
5713         return ret;
5714 }
5715 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
5716         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5717         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
5718         uint64_t ret_ref = 0;
5719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5721         return ret_ref;
5722 }
5723
5724 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5725 CHECK(!owner->result_ok);
5726         return DecodeError_clone(&*owner->contents.err);
5727 }
5728 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
5729         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5730         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5731         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
5732         uint64_t ret_ref = tag_ptr(ret_copy, true);
5733         return ret_ref;
5734 }
5735
5736 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5737         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5738         switch(obj->tag) {
5739                 case LDKParseError_Bech32Error: return 0;
5740                 case LDKParseError_ParseAmountError: return 1;
5741                 case LDKParseError_MalformedSignature: return 2;
5742                 case LDKParseError_BadPrefix: return 3;
5743                 case LDKParseError_UnknownCurrency: return 4;
5744                 case LDKParseError_UnknownSiPrefix: return 5;
5745                 case LDKParseError_MalformedHRP: return 6;
5746                 case LDKParseError_TooShortDataPart: return 7;
5747                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5748                 case LDKParseError_DescriptionDecodeError: return 9;
5749                 case LDKParseError_PaddingError: return 10;
5750                 case LDKParseError_IntegerOverflowError: return 11;
5751                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5752                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5753                 case LDKParseError_InvalidScriptHashLength: return 14;
5754                 case LDKParseError_InvalidRecoveryId: return 15;
5755                 case LDKParseError_InvalidSliceLength: return 16;
5756                 case LDKParseError_Skip: return 17;
5757                 default: abort();
5758         }
5759 }
5760 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5761         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5762         assert(obj->tag == LDKParseError_Bech32Error);
5763                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5764         return bech32_error_ref;
5765 }
5766 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5767         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5768         assert(obj->tag == LDKParseError_ParseAmountError);
5769                         /*obj->parse_amount_error*/
5770         return 0;
5771 }
5772 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5773         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5774         assert(obj->tag == LDKParseError_MalformedSignature);
5775                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5776         return malformed_signature_conv;
5777 }
5778 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5779         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5780         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5781                         /*obj->description_decode_error*/
5782         return 0;
5783 }
5784 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5785         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5786         assert(obj->tag == LDKParseError_InvalidSliceLength);
5787                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5788                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5789         return invalid_slice_length_conv;
5790 }
5791 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5792 CHECK(owner->result_ok);
5793         return SiPrefix_clone(&*owner->contents.result);
5794 }
5795 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5796         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5797         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5798         return ret_conv;
5799 }
5800
5801 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5802 CHECK(!owner->result_ok);
5803         return ParseError_clone(&*owner->contents.err);
5804 }
5805 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5806         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5807         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5808         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5809         uint64_t ret_ref = tag_ptr(ret_copy, true);
5810         return ret_ref;
5811 }
5812
5813 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5814         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5815         switch(obj->tag) {
5816                 case LDKParseOrSemanticError_ParseError: return 0;
5817                 case LDKParseOrSemanticError_SemanticError: return 1;
5818                 default: abort();
5819         }
5820 }
5821 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5822         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5823         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5824                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5825         return parse_error_ref;
5826 }
5827 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5828         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5829         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5830                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5831         return semantic_error_conv;
5832 }
5833 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5834         LDKInvoice ret = *owner->contents.result;
5835         ret.is_owned = false;
5836         return ret;
5837 }
5838 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5839         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5840         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5841         uint64_t ret_ref = 0;
5842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5844         return ret_ref;
5845 }
5846
5847 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5848 CHECK(!owner->result_ok);
5849         return ParseOrSemanticError_clone(&*owner->contents.err);
5850 }
5851 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5852         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5853         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5854         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5855         uint64_t ret_ref = tag_ptr(ret_copy, true);
5856         return ret_ref;
5857 }
5858
5859 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5860         LDKSignedRawInvoice ret = *owner->contents.result;
5861         ret.is_owned = false;
5862         return ret;
5863 }
5864 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5865         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5866         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5867         uint64_t ret_ref = 0;
5868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5870         return ret_ref;
5871 }
5872
5873 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5874 CHECK(!owner->result_ok);
5875         return ParseError_clone(&*owner->contents.err);
5876 }
5877 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5878         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5879         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5880         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5881         uint64_t ret_ref = tag_ptr(ret_copy, true);
5882         return ret_ref;
5883 }
5884
5885 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5886         LDKRawInvoice ret = owner->a;
5887         ret.is_owned = false;
5888         return ret;
5889 }
5890 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5891         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5892         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5893         uint64_t ret_ref = 0;
5894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5896         return ret_ref;
5897 }
5898
5899 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5900         return ThirtyTwoBytes_clone(&owner->b);
5901 }
5902 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5903         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5904         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5905         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5906         return ret_arr;
5907 }
5908
5909 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5910         LDKInvoiceSignature ret = owner->c;
5911         ret.is_owned = false;
5912         return ret;
5913 }
5914 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5915         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5916         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5917         uint64_t ret_ref = 0;
5918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5920         return ret_ref;
5921 }
5922
5923 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5924         LDKPayeePubKey ret = *owner->contents.result;
5925         ret.is_owned = false;
5926         return ret;
5927 }
5928 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5929         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5930         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5931         uint64_t ret_ref = 0;
5932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5934         return ret_ref;
5935 }
5936
5937 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5938 CHECK(!owner->result_ok);
5939         return *owner->contents.err;
5940 }
5941 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5942         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5943         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5944         return ret_conv;
5945 }
5946
5947 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5948         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5949         for (size_t i = 0; i < ret.datalen; i++) {
5950                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5951         }
5952         return ret;
5953 }
5954 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5955         LDKPositiveTimestamp ret = *owner->contents.result;
5956         ret.is_owned = false;
5957         return ret;
5958 }
5959 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
5960         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5961         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5962         uint64_t ret_ref = 0;
5963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5965         return ret_ref;
5966 }
5967
5968 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5969 CHECK(!owner->result_ok);
5970         return CreationError_clone(&*owner->contents.err);
5971 }
5972 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
5973         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
5974         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5975         return ret_conv;
5976 }
5977
5978 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5979 CHECK(owner->result_ok);
5980         return *owner->contents.result;
5981 }
5982 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
5983         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5984         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5985 }
5986
5987 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5988 CHECK(!owner->result_ok);
5989         return SemanticError_clone(&*owner->contents.err);
5990 }
5991 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
5992         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
5993         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5994         return ret_conv;
5995 }
5996
5997 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5998         LDKInvoice ret = *owner->contents.result;
5999         ret.is_owned = false;
6000         return ret;
6001 }
6002 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6003         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6004         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6005         uint64_t ret_ref = 0;
6006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6008         return ret_ref;
6009 }
6010
6011 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6012 CHECK(!owner->result_ok);
6013         return SemanticError_clone(&*owner->contents.err);
6014 }
6015 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6016         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6017         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6018         return ret_conv;
6019 }
6020
6021 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6022         LDKDescription ret = *owner->contents.result;
6023         ret.is_owned = false;
6024         return ret;
6025 }
6026 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6027         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6028         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6029         uint64_t ret_ref = 0;
6030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6032         return ret_ref;
6033 }
6034
6035 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6036 CHECK(!owner->result_ok);
6037         return CreationError_clone(&*owner->contents.err);
6038 }
6039 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6040         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6041         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6042         return ret_conv;
6043 }
6044
6045 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6046         LDKPrivateRoute ret = *owner->contents.result;
6047         ret.is_owned = false;
6048         return ret;
6049 }
6050 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6051         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6052         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6053         uint64_t ret_ref = 0;
6054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6056         return ret_ref;
6057 }
6058
6059 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6060 CHECK(!owner->result_ok);
6061         return CreationError_clone(&*owner->contents.err);
6062 }
6063 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6064         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6065         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6066         return ret_conv;
6067 }
6068
6069 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6070 CHECK(owner->result_ok);
6071         return *owner->contents.result;
6072 }
6073 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6074         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6075         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6076         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6077         return ret_conv;
6078 }
6079
6080 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6081 CHECK(!owner->result_ok);
6082         return *owner->contents.err;
6083 }
6084 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6085         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6086         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6087         return ret_conv;
6088 }
6089
6090 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6091         LDKChannelMonitorUpdate ret = *owner->contents.result;
6092         ret.is_owned = false;
6093         return ret;
6094 }
6095 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6096         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6097         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6098         uint64_t ret_ref = 0;
6099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6101         return ret_ref;
6102 }
6103
6104 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6105 CHECK(!owner->result_ok);
6106         return DecodeError_clone(&*owner->contents.err);
6107 }
6108 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6109         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6110         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6111         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6112         uint64_t ret_ref = tag_ptr(ret_copy, true);
6113         return ret_ref;
6114 }
6115
6116 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6117         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6118         switch(obj->tag) {
6119                 case LDKCOption_MonitorEventZ_Some: return 0;
6120                 case LDKCOption_MonitorEventZ_None: return 1;
6121                 default: abort();
6122         }
6123 }
6124 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6125         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6126         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6127                         uint64_t some_ref = tag_ptr(&obj->some, false);
6128         return some_ref;
6129 }
6130 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6131 CHECK(owner->result_ok);
6132         return COption_MonitorEventZ_clone(&*owner->contents.result);
6133 }
6134 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6135         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6136         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6137         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6138         uint64_t ret_ref = tag_ptr(ret_copy, true);
6139         return ret_ref;
6140 }
6141
6142 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6143 CHECK(!owner->result_ok);
6144         return DecodeError_clone(&*owner->contents.err);
6145 }
6146 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6147         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6148         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6149         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6150         uint64_t ret_ref = tag_ptr(ret_copy, true);
6151         return ret_ref;
6152 }
6153
6154 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6155         LDKHTLCUpdate ret = *owner->contents.result;
6156         ret.is_owned = false;
6157         return ret;
6158 }
6159 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6160         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6161         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6162         uint64_t ret_ref = 0;
6163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6165         return ret_ref;
6166 }
6167
6168 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6169 CHECK(!owner->result_ok);
6170         return DecodeError_clone(&*owner->contents.err);
6171 }
6172 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6173         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6174         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6175         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6176         uint64_t ret_ref = tag_ptr(ret_copy, true);
6177         return ret_ref;
6178 }
6179
6180 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6181         LDKOutPoint ret = owner->a;
6182         ret.is_owned = false;
6183         return ret;
6184 }
6185 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6186         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6187         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6188         uint64_t ret_ref = 0;
6189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6191         return ret_ref;
6192 }
6193
6194 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6195         return CVec_u8Z_clone(&owner->b);
6196 }
6197 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6198         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6199         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6200         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6201         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6202         CVec_u8Z_free(ret_var);
6203         return ret_arr;
6204 }
6205
6206 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6207         return owner->a;
6208 }
6209 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6210         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6211         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6212         return ret_conv;
6213 }
6214
6215 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6216         return CVec_u8Z_clone(&owner->b);
6217 }
6218 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6219         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6220         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6221         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6222         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6223         CVec_u8Z_free(ret_var);
6224         return ret_arr;
6225 }
6226
6227 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6228         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6229         for (size_t i = 0; i < ret.datalen; i++) {
6230                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6231         }
6232         return ret;
6233 }
6234 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6235         return ThirtyTwoBytes_clone(&owner->a);
6236 }
6237 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6238         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6239         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6240         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6241         return ret_arr;
6242 }
6243
6244 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6245         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6246 }
6247 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6248         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6249         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6250         uint64_tArray ret_arr = NULL;
6251         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6252         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6253         for (size_t v = 0; v < ret_var.datalen; v++) {
6254                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6255                 *ret_conv_21_conv = ret_var.data[v];
6256                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6257         }
6258         
6259         FREE(ret_var.data);
6260         return ret_arr;
6261 }
6262
6263 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6264         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 };
6265         for (size_t i = 0; i < ret.datalen; i++) {
6266                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6267         }
6268         return ret;
6269 }
6270 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6271         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6272         for (size_t i = 0; i < ret.datalen; i++) {
6273                 ret.data[i] = Event_clone(&orig->data[i]);
6274         }
6275         return ret;
6276 }
6277 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6278         return owner->a;
6279 }
6280 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6281         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6282         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6283         return ret_conv;
6284 }
6285
6286 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6287         return TxOut_clone(&owner->b);
6288 }
6289 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6290         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6291         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6292         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6293         return tag_ptr(ret_ref, true);
6294 }
6295
6296 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6297         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6298         for (size_t i = 0; i < ret.datalen; i++) {
6299                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6300         }
6301         return ret;
6302 }
6303 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6304         return ThirtyTwoBytes_clone(&owner->a);
6305 }
6306 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6307         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6308         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6309         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6310         return ret_arr;
6311 }
6312
6313 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6314         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6315 }
6316 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6317         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6318         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6319         uint64_tArray ret_arr = NULL;
6320         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6321         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6322         for (size_t u = 0; u < ret_var.datalen; u++) {
6323                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6324                 *ret_conv_20_conv = ret_var.data[u];
6325                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6326         }
6327         
6328         FREE(ret_var.data);
6329         return ret_arr;
6330 }
6331
6332 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6333         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 };
6334         for (size_t i = 0; i < ret.datalen; i++) {
6335                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6336         }
6337         return ret;
6338 }
6339 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6340         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6341         switch(obj->tag) {
6342                 case LDKBalance_ClaimableOnChannelClose: return 0;
6343                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6344                 case LDKBalance_ContentiousClaimable: return 2;
6345                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6346                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6347                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6348                 default: abort();
6349         }
6350 }
6351 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6352         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6353         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6354                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6355         return claimable_amount_satoshis_conv;
6356 }
6357 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6358         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6359         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6360                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6361         return claimable_amount_satoshis_conv;
6362 }
6363 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6364         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6365         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6366                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6367         return confirmation_height_conv;
6368 }
6369 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6370         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6371         assert(obj->tag == LDKBalance_ContentiousClaimable);
6372                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6373         return claimable_amount_satoshis_conv;
6374 }
6375 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6376         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6377         assert(obj->tag == LDKBalance_ContentiousClaimable);
6378                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6379         return timeout_height_conv;
6380 }
6381 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6382         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6383         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6384                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6385         return claimable_amount_satoshis_conv;
6386 }
6387 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6388         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6389         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6390                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6391         return claimable_height_conv;
6392 }
6393 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6394         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6395         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6396                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6397         return claimable_amount_satoshis_conv;
6398 }
6399 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6400         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6401         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6402                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6403         return expiry_height_conv;
6404 }
6405 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6406         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6407         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6408                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6409         return claimable_amount_satoshis_conv;
6410 }
6411 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6412         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6413         for (size_t i = 0; i < ret.datalen; i++) {
6414                 ret.data[i] = Balance_clone(&orig->data[i]);
6415         }
6416         return ret;
6417 }
6418 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6419         return ThirtyTwoBytes_clone(&owner->a);
6420 }
6421 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6422         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6423         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6424         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6425         return ret_arr;
6426 }
6427
6428 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6429         LDKChannelMonitor ret = owner->b;
6430         ret.is_owned = false;
6431         return ret;
6432 }
6433 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6434         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6435         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6436         uint64_t ret_ref = 0;
6437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6439         return ret_ref;
6440 }
6441
6442 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6443 CHECK(owner->result_ok);
6444         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6445 }
6446 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6447         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6448         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6449         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6450         return tag_ptr(ret_conv, true);
6451 }
6452
6453 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6454 CHECK(!owner->result_ok);
6455         return DecodeError_clone(&*owner->contents.err);
6456 }
6457 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6458         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6459         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6460         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6461         uint64_t ret_ref = tag_ptr(ret_copy, true);
6462         return ret_ref;
6463 }
6464
6465 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6466         return owner->a;
6467 }
6468 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6469         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6470         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6471         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6472         return ret_arr;
6473 }
6474
6475 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6476         return Type_clone(&owner->b);
6477 }
6478 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6479         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6480         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6481         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6482         return tag_ptr(ret_ret, true);
6483 }
6484
6485 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6486         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6487         for (size_t i = 0; i < ret.datalen; i++) {
6488                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6489         }
6490         return ret;
6491 }
6492 typedef struct LDKCustomOnionMessageContents_JCalls {
6493         atomic_size_t refcnt;
6494         uint32_t instance_ptr;
6495 } LDKCustomOnionMessageContents_JCalls;
6496 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6497         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6498         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6499                 FREE(j_calls);
6500         }
6501 }
6502 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6503         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6504         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
6505 }
6506 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6507         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6508         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6509         LDKCVec_u8Z ret_ref;
6510         ret_ref.datalen = ret->arr_len;
6511         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6512         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6513         return ret_ref;
6514 }
6515 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6516         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6517         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6518 }
6519 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6520         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6521         atomic_init(&calls->refcnt, 1);
6522         calls->instance_ptr = o;
6523
6524         LDKCustomOnionMessageContents ret = {
6525                 .this_arg = (void*) calls,
6526                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6527                 .write = write_LDKCustomOnionMessageContents_jcall,
6528                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6529                 .free = LDKCustomOnionMessageContents_JCalls_free,
6530         };
6531         return ret;
6532 }
6533 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6534         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6535         *res_ptr = LDKCustomOnionMessageContents_init(o);
6536         return tag_ptr(res_ptr, true);
6537 }
6538 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6539         void* this_arg_ptr = untag_ptr(this_arg);
6540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6541         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6542         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6543         return ret_conv;
6544 }
6545
6546 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6547         void* this_arg_ptr = untag_ptr(this_arg);
6548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6549         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6550         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6551         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6552         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6553         CVec_u8Z_free(ret_var);
6554         return ret_arr;
6555 }
6556
6557 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6558         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6559         switch(obj->tag) {
6560                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6561                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6562                 default: abort();
6563         }
6564 }
6565 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6566         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6567         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6568                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6569                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6570         return tag_ptr(some_ret, true);
6571 }
6572 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6573 CHECK(owner->result_ok);
6574         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6575 }
6576 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6577         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6578         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6579         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6580         uint64_t ret_ref = tag_ptr(ret_copy, true);
6581         return ret_ref;
6582 }
6583
6584 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6585 CHECK(!owner->result_ok);
6586         return DecodeError_clone(&*owner->contents.err);
6587 }
6588 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6589         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6591         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6592         uint64_t ret_ref = tag_ptr(ret_copy, true);
6593         return ret_ref;
6594 }
6595
6596 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6597         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6598         switch(obj->tag) {
6599                 case LDKCOption_NetAddressZ_Some: return 0;
6600                 case LDKCOption_NetAddressZ_None: return 1;
6601                 default: abort();
6602         }
6603 }
6604 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6605         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6606         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6607                         uint64_t some_ref = tag_ptr(&obj->some, false);
6608         return some_ref;
6609 }
6610 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6611 CHECK(owner->result_ok);
6612         return CVec_u8Z_clone(&*owner->contents.result);
6613 }
6614 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6615         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6616         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6619         CVec_u8Z_free(ret_var);
6620         return ret_arr;
6621 }
6622
6623 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6624         LDKPeerHandleError ret = *owner->contents.err;
6625         ret.is_owned = false;
6626         return ret;
6627 }
6628 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6629         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6630         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6631         uint64_t ret_ref = 0;
6632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6634         return ret_ref;
6635 }
6636
6637 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6638 CHECK(owner->result_ok);
6639         return *owner->contents.result;
6640 }
6641 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6642         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6643         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6644 }
6645
6646 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6647         LDKPeerHandleError ret = *owner->contents.err;
6648         ret.is_owned = false;
6649         return ret;
6650 }
6651 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6652         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6653         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6654         uint64_t ret_ref = 0;
6655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6657         return ret_ref;
6658 }
6659
6660 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6661 CHECK(owner->result_ok);
6662         return *owner->contents.result;
6663 }
6664 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6665         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6666         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6667         return ret_conv;
6668 }
6669
6670 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6671         LDKPeerHandleError ret = *owner->contents.err;
6672         ret.is_owned = false;
6673         return ret;
6674 }
6675 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6676         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6677         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6678         uint64_t ret_ref = 0;
6679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6681         return ret_ref;
6682 }
6683
6684 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6685         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6686         switch(obj->tag) {
6687                 case LDKSendError_Secp256k1: return 0;
6688                 case LDKSendError_TooBigPacket: return 1;
6689                 case LDKSendError_TooFewBlindedHops: return 2;
6690                 case LDKSendError_InvalidFirstHop: return 3;
6691                 case LDKSendError_InvalidMessage: return 4;
6692                 case LDKSendError_BufferFull: return 5;
6693                 default: abort();
6694         }
6695 }
6696 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6697         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6698         assert(obj->tag == LDKSendError_Secp256k1);
6699                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6700         return secp256k1_conv;
6701 }
6702 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6703 CHECK(owner->result_ok);
6704         return *owner->contents.result;
6705 }
6706 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6707         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6708         CResult_NoneSendErrorZ_get_ok(owner_conv);
6709 }
6710
6711 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6712 CHECK(!owner->result_ok);
6713         return SendError_clone(&*owner->contents.err);
6714 }
6715 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6716         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6717         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6718         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6719         uint64_t ret_ref = tag_ptr(ret_copy, true);
6720         return ret_ref;
6721 }
6722
6723 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6724         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6725         switch(obj->tag) {
6726                 case LDKGraphSyncError_DecodeError: return 0;
6727                 case LDKGraphSyncError_LightningError: return 1;
6728                 default: abort();
6729         }
6730 }
6731 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6732         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6733         assert(obj->tag == LDKGraphSyncError_DecodeError);
6734                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
6735         return decode_error_ref;
6736 }
6737 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6738         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6739         assert(obj->tag == LDKGraphSyncError_LightningError);
6740                         LDKLightningError lightning_error_var = obj->lightning_error;
6741                         uint64_t lightning_error_ref = 0;
6742                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6743                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6744         return lightning_error_ref;
6745 }
6746 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6747 CHECK(owner->result_ok);
6748         return *owner->contents.result;
6749 }
6750 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6751         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6752         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6753         return ret_conv;
6754 }
6755
6756 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6757 CHECK(!owner->result_ok);
6758         return GraphSyncError_clone(&*owner->contents.err);
6759 }
6760 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6761         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6762         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6763         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6764         uint64_t ret_ref = tag_ptr(ret_copy, true);
6765         return ret_ref;
6766 }
6767
6768 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6769 CHECK(owner->result_ok);
6770         return *owner->contents.result;
6771 }
6772 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6773         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6774         CResult_NoneErrorZ_get_ok(owner_conv);
6775 }
6776
6777 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6778 CHECK(!owner->result_ok);
6779         return *owner->contents.err;
6780 }
6781 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6782         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6783         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6784         return ret_conv;
6785 }
6786
6787 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6788 CHECK(owner->result_ok);
6789         return NetAddress_clone(&*owner->contents.result);
6790 }
6791 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6792         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6793         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6794         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6795         uint64_t ret_ref = tag_ptr(ret_copy, true);
6796         return ret_ref;
6797 }
6798
6799 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6800 CHECK(!owner->result_ok);
6801         return DecodeError_clone(&*owner->contents.err);
6802 }
6803 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6804         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6806         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6807         uint64_t ret_ref = tag_ptr(ret_copy, true);
6808         return ret_ref;
6809 }
6810
6811 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6812         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6813         for (size_t i = 0; i < ret.datalen; i++) {
6814                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6815         }
6816         return ret;
6817 }
6818 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6819         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6820         for (size_t i = 0; i < ret.datalen; i++) {
6821                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6822         }
6823         return ret;
6824 }
6825 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6826         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6827         for (size_t i = 0; i < ret.datalen; i++) {
6828                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6829         }
6830         return ret;
6831 }
6832 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6833         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6834         for (size_t i = 0; i < ret.datalen; i++) {
6835                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6836         }
6837         return ret;
6838 }
6839 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6840         LDKAcceptChannel ret = *owner->contents.result;
6841         ret.is_owned = false;
6842         return ret;
6843 }
6844 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6845         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6846         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6847         uint64_t ret_ref = 0;
6848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6850         return ret_ref;
6851 }
6852
6853 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6854 CHECK(!owner->result_ok);
6855         return DecodeError_clone(&*owner->contents.err);
6856 }
6857 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6858         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6860         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6861         uint64_t ret_ref = tag_ptr(ret_copy, true);
6862         return ret_ref;
6863 }
6864
6865 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6866         LDKAnnouncementSignatures ret = *owner->contents.result;
6867         ret.is_owned = false;
6868         return ret;
6869 }
6870 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6871         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6872         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6873         uint64_t ret_ref = 0;
6874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6876         return ret_ref;
6877 }
6878
6879 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6880 CHECK(!owner->result_ok);
6881         return DecodeError_clone(&*owner->contents.err);
6882 }
6883 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6884         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6886         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6887         uint64_t ret_ref = tag_ptr(ret_copy, true);
6888         return ret_ref;
6889 }
6890
6891 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6892         LDKChannelReestablish ret = *owner->contents.result;
6893         ret.is_owned = false;
6894         return ret;
6895 }
6896 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6897         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6898         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6899         uint64_t ret_ref = 0;
6900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6902         return ret_ref;
6903 }
6904
6905 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6906 CHECK(!owner->result_ok);
6907         return DecodeError_clone(&*owner->contents.err);
6908 }
6909 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6910         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6912         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6913         uint64_t ret_ref = tag_ptr(ret_copy, true);
6914         return ret_ref;
6915 }
6916
6917 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6918         LDKClosingSigned ret = *owner->contents.result;
6919         ret.is_owned = false;
6920         return ret;
6921 }
6922 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6923         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6924         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6925         uint64_t ret_ref = 0;
6926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6928         return ret_ref;
6929 }
6930
6931 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6932 CHECK(!owner->result_ok);
6933         return DecodeError_clone(&*owner->contents.err);
6934 }
6935 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6936         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6937         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6938         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6939         uint64_t ret_ref = tag_ptr(ret_copy, true);
6940         return ret_ref;
6941 }
6942
6943 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6944         LDKClosingSignedFeeRange ret = *owner->contents.result;
6945         ret.is_owned = false;
6946         return ret;
6947 }
6948 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6949         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6950         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6951         uint64_t ret_ref = 0;
6952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6954         return ret_ref;
6955 }
6956
6957 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6958 CHECK(!owner->result_ok);
6959         return DecodeError_clone(&*owner->contents.err);
6960 }
6961 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6962         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6963         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6964         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6965         uint64_t ret_ref = tag_ptr(ret_copy, true);
6966         return ret_ref;
6967 }
6968
6969 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6970         LDKCommitmentSigned ret = *owner->contents.result;
6971         ret.is_owned = false;
6972         return ret;
6973 }
6974 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6975         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6976         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6977         uint64_t ret_ref = 0;
6978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6980         return ret_ref;
6981 }
6982
6983 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6984 CHECK(!owner->result_ok);
6985         return DecodeError_clone(&*owner->contents.err);
6986 }
6987 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6988         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6989         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6990         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6991         uint64_t ret_ref = tag_ptr(ret_copy, true);
6992         return ret_ref;
6993 }
6994
6995 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6996         LDKFundingCreated ret = *owner->contents.result;
6997         ret.is_owned = false;
6998         return ret;
6999 }
7000 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7001         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7002         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7003         uint64_t ret_ref = 0;
7004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7006         return ret_ref;
7007 }
7008
7009 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7010 CHECK(!owner->result_ok);
7011         return DecodeError_clone(&*owner->contents.err);
7012 }
7013 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7014         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7016         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7017         uint64_t ret_ref = tag_ptr(ret_copy, true);
7018         return ret_ref;
7019 }
7020
7021 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7022         LDKFundingSigned ret = *owner->contents.result;
7023         ret.is_owned = false;
7024         return ret;
7025 }
7026 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7027         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7028         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7029         uint64_t ret_ref = 0;
7030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7032         return ret_ref;
7033 }
7034
7035 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7036 CHECK(!owner->result_ok);
7037         return DecodeError_clone(&*owner->contents.err);
7038 }
7039 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7040         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7042         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7043         uint64_t ret_ref = tag_ptr(ret_copy, true);
7044         return ret_ref;
7045 }
7046
7047 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7048         LDKChannelReady ret = *owner->contents.result;
7049         ret.is_owned = false;
7050         return ret;
7051 }
7052 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7053         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7054         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7055         uint64_t ret_ref = 0;
7056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7058         return ret_ref;
7059 }
7060
7061 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7062 CHECK(!owner->result_ok);
7063         return DecodeError_clone(&*owner->contents.err);
7064 }
7065 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7066         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7068         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7069         uint64_t ret_ref = tag_ptr(ret_copy, true);
7070         return ret_ref;
7071 }
7072
7073 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7074         LDKInit ret = *owner->contents.result;
7075         ret.is_owned = false;
7076         return ret;
7077 }
7078 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7079         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7080         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7081         uint64_t ret_ref = 0;
7082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7084         return ret_ref;
7085 }
7086
7087 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7088 CHECK(!owner->result_ok);
7089         return DecodeError_clone(&*owner->contents.err);
7090 }
7091 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7092         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7094         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7095         uint64_t ret_ref = tag_ptr(ret_copy, true);
7096         return ret_ref;
7097 }
7098
7099 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7100         LDKOpenChannel ret = *owner->contents.result;
7101         ret.is_owned = false;
7102         return ret;
7103 }
7104 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7105         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7106         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7107         uint64_t ret_ref = 0;
7108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7110         return ret_ref;
7111 }
7112
7113 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7114 CHECK(!owner->result_ok);
7115         return DecodeError_clone(&*owner->contents.err);
7116 }
7117 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7118         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7119         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7120         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7121         uint64_t ret_ref = tag_ptr(ret_copy, true);
7122         return ret_ref;
7123 }
7124
7125 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7126         LDKRevokeAndACK ret = *owner->contents.result;
7127         ret.is_owned = false;
7128         return ret;
7129 }
7130 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7131         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7132         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7133         uint64_t ret_ref = 0;
7134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7136         return ret_ref;
7137 }
7138
7139 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7140 CHECK(!owner->result_ok);
7141         return DecodeError_clone(&*owner->contents.err);
7142 }
7143 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7144         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7145         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7146         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7147         uint64_t ret_ref = tag_ptr(ret_copy, true);
7148         return ret_ref;
7149 }
7150
7151 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7152         LDKShutdown ret = *owner->contents.result;
7153         ret.is_owned = false;
7154         return ret;
7155 }
7156 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7157         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7158         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7159         uint64_t ret_ref = 0;
7160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7162         return ret_ref;
7163 }
7164
7165 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7166 CHECK(!owner->result_ok);
7167         return DecodeError_clone(&*owner->contents.err);
7168 }
7169 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7170         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7171         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7172         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7173         uint64_t ret_ref = tag_ptr(ret_copy, true);
7174         return ret_ref;
7175 }
7176
7177 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7178         LDKUpdateFailHTLC ret = *owner->contents.result;
7179         ret.is_owned = false;
7180         return ret;
7181 }
7182 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7183         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7184         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7185         uint64_t ret_ref = 0;
7186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7188         return ret_ref;
7189 }
7190
7191 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7192 CHECK(!owner->result_ok);
7193         return DecodeError_clone(&*owner->contents.err);
7194 }
7195 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7196         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7197         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7198         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7199         uint64_t ret_ref = tag_ptr(ret_copy, true);
7200         return ret_ref;
7201 }
7202
7203 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7204         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7205         ret.is_owned = false;
7206         return ret;
7207 }
7208 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7209         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7210         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7211         uint64_t ret_ref = 0;
7212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7214         return ret_ref;
7215 }
7216
7217 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7218 CHECK(!owner->result_ok);
7219         return DecodeError_clone(&*owner->contents.err);
7220 }
7221 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7222         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7224         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7225         uint64_t ret_ref = tag_ptr(ret_copy, true);
7226         return ret_ref;
7227 }
7228
7229 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7230         LDKUpdateFee ret = *owner->contents.result;
7231         ret.is_owned = false;
7232         return ret;
7233 }
7234 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7235         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7236         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7237         uint64_t ret_ref = 0;
7238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7240         return ret_ref;
7241 }
7242
7243 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7244 CHECK(!owner->result_ok);
7245         return DecodeError_clone(&*owner->contents.err);
7246 }
7247 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7248         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7249         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7250         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7251         uint64_t ret_ref = tag_ptr(ret_copy, true);
7252         return ret_ref;
7253 }
7254
7255 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7256         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7257         ret.is_owned = false;
7258         return ret;
7259 }
7260 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7261         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7262         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7263         uint64_t ret_ref = 0;
7264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7266         return ret_ref;
7267 }
7268
7269 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7270 CHECK(!owner->result_ok);
7271         return DecodeError_clone(&*owner->contents.err);
7272 }
7273 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7274         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7275         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7276         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7277         uint64_t ret_ref = tag_ptr(ret_copy, true);
7278         return ret_ref;
7279 }
7280
7281 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7282         LDKUpdateAddHTLC ret = *owner->contents.result;
7283         ret.is_owned = false;
7284         return ret;
7285 }
7286 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7287         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7288         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7289         uint64_t ret_ref = 0;
7290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7292         return ret_ref;
7293 }
7294
7295 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7296 CHECK(!owner->result_ok);
7297         return DecodeError_clone(&*owner->contents.err);
7298 }
7299 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7300         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7301         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7302         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7303         uint64_t ret_ref = tag_ptr(ret_copy, true);
7304         return ret_ref;
7305 }
7306
7307 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7308         LDKOnionMessage ret = *owner->contents.result;
7309         ret.is_owned = false;
7310         return ret;
7311 }
7312 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7313         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7314         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7315         uint64_t ret_ref = 0;
7316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7318         return ret_ref;
7319 }
7320
7321 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7322 CHECK(!owner->result_ok);
7323         return DecodeError_clone(&*owner->contents.err);
7324 }
7325 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7326         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7327         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7328         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7329         uint64_t ret_ref = tag_ptr(ret_copy, true);
7330         return ret_ref;
7331 }
7332
7333 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7334         LDKPing ret = *owner->contents.result;
7335         ret.is_owned = false;
7336         return ret;
7337 }
7338 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7339         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7340         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7341         uint64_t ret_ref = 0;
7342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7344         return ret_ref;
7345 }
7346
7347 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7348 CHECK(!owner->result_ok);
7349         return DecodeError_clone(&*owner->contents.err);
7350 }
7351 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7352         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7353         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7354         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
7355         uint64_t ret_ref = tag_ptr(ret_copy, true);
7356         return ret_ref;
7357 }
7358
7359 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7360         LDKPong ret = *owner->contents.result;
7361         ret.is_owned = false;
7362         return ret;
7363 }
7364 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7365         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7366         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7367         uint64_t ret_ref = 0;
7368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7370         return ret_ref;
7371 }
7372
7373 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7374 CHECK(!owner->result_ok);
7375         return DecodeError_clone(&*owner->contents.err);
7376 }
7377 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7378         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7380         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
7381         uint64_t ret_ref = tag_ptr(ret_copy, true);
7382         return ret_ref;
7383 }
7384
7385 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7386         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7387         ret.is_owned = false;
7388         return ret;
7389 }
7390 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7391         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7392         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7393         uint64_t ret_ref = 0;
7394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7396         return ret_ref;
7397 }
7398
7399 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7400 CHECK(!owner->result_ok);
7401         return DecodeError_clone(&*owner->contents.err);
7402 }
7403 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7404         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7405         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7406         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7407         uint64_t ret_ref = tag_ptr(ret_copy, true);
7408         return ret_ref;
7409 }
7410
7411 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7412         LDKChannelAnnouncement ret = *owner->contents.result;
7413         ret.is_owned = false;
7414         return ret;
7415 }
7416 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7417         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7418         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7419         uint64_t ret_ref = 0;
7420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7422         return ret_ref;
7423 }
7424
7425 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7426 CHECK(!owner->result_ok);
7427         return DecodeError_clone(&*owner->contents.err);
7428 }
7429 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7430         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7432         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7433         uint64_t ret_ref = tag_ptr(ret_copy, true);
7434         return ret_ref;
7435 }
7436
7437 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7438         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7439         ret.is_owned = false;
7440         return ret;
7441 }
7442 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7443         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7444         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7445         uint64_t ret_ref = 0;
7446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7448         return ret_ref;
7449 }
7450
7451 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7452 CHECK(!owner->result_ok);
7453         return DecodeError_clone(&*owner->contents.err);
7454 }
7455 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7456         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7457         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7458         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7459         uint64_t ret_ref = tag_ptr(ret_copy, true);
7460         return ret_ref;
7461 }
7462
7463 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7464         LDKChannelUpdate ret = *owner->contents.result;
7465         ret.is_owned = false;
7466         return ret;
7467 }
7468 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7469         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7470         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7471         uint64_t ret_ref = 0;
7472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7474         return ret_ref;
7475 }
7476
7477 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7478 CHECK(!owner->result_ok);
7479         return DecodeError_clone(&*owner->contents.err);
7480 }
7481 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7482         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7483         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7484         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7485         uint64_t ret_ref = tag_ptr(ret_copy, true);
7486         return ret_ref;
7487 }
7488
7489 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7490         LDKErrorMessage ret = *owner->contents.result;
7491         ret.is_owned = false;
7492         return ret;
7493 }
7494 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7495         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7496         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7497         uint64_t ret_ref = 0;
7498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7500         return ret_ref;
7501 }
7502
7503 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7504 CHECK(!owner->result_ok);
7505         return DecodeError_clone(&*owner->contents.err);
7506 }
7507 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7508         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7509         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7510         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7511         uint64_t ret_ref = tag_ptr(ret_copy, true);
7512         return ret_ref;
7513 }
7514
7515 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7516         LDKWarningMessage ret = *owner->contents.result;
7517         ret.is_owned = false;
7518         return ret;
7519 }
7520 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7521         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7522         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7523         uint64_t ret_ref = 0;
7524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7526         return ret_ref;
7527 }
7528
7529 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7530 CHECK(!owner->result_ok);
7531         return DecodeError_clone(&*owner->contents.err);
7532 }
7533 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7534         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7535         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7536         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7537         uint64_t ret_ref = tag_ptr(ret_copy, true);
7538         return ret_ref;
7539 }
7540
7541 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7542         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7543         ret.is_owned = false;
7544         return ret;
7545 }
7546 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7547         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7548         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7549         uint64_t ret_ref = 0;
7550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7552         return ret_ref;
7553 }
7554
7555 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7556 CHECK(!owner->result_ok);
7557         return DecodeError_clone(&*owner->contents.err);
7558 }
7559 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7560         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7561         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7562         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7563         uint64_t ret_ref = tag_ptr(ret_copy, true);
7564         return ret_ref;
7565 }
7566
7567 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7568         LDKNodeAnnouncement ret = *owner->contents.result;
7569         ret.is_owned = false;
7570         return ret;
7571 }
7572 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7573         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7574         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7575         uint64_t ret_ref = 0;
7576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7578         return ret_ref;
7579 }
7580
7581 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7582 CHECK(!owner->result_ok);
7583         return DecodeError_clone(&*owner->contents.err);
7584 }
7585 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7586         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7587         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7588         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7589         uint64_t ret_ref = tag_ptr(ret_copy, true);
7590         return ret_ref;
7591 }
7592
7593 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7594         LDKQueryShortChannelIds ret = *owner->contents.result;
7595         ret.is_owned = false;
7596         return ret;
7597 }
7598 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7599         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7600         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7601         uint64_t ret_ref = 0;
7602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7604         return ret_ref;
7605 }
7606
7607 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7608 CHECK(!owner->result_ok);
7609         return DecodeError_clone(&*owner->contents.err);
7610 }
7611 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7612         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7614         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7615         uint64_t ret_ref = tag_ptr(ret_copy, true);
7616         return ret_ref;
7617 }
7618
7619 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7620         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7621         ret.is_owned = false;
7622         return ret;
7623 }
7624 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7625         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7626         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7627         uint64_t ret_ref = 0;
7628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7630         return ret_ref;
7631 }
7632
7633 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7634 CHECK(!owner->result_ok);
7635         return DecodeError_clone(&*owner->contents.err);
7636 }
7637 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7638         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7640         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7641         uint64_t ret_ref = tag_ptr(ret_copy, true);
7642         return ret_ref;
7643 }
7644
7645 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7646         LDKQueryChannelRange ret = *owner->contents.result;
7647         ret.is_owned = false;
7648         return ret;
7649 }
7650 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7651         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7652         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7653         uint64_t ret_ref = 0;
7654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7656         return ret_ref;
7657 }
7658
7659 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7660 CHECK(!owner->result_ok);
7661         return DecodeError_clone(&*owner->contents.err);
7662 }
7663 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7664         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7666         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7667         uint64_t ret_ref = tag_ptr(ret_copy, true);
7668         return ret_ref;
7669 }
7670
7671 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7672         LDKReplyChannelRange ret = *owner->contents.result;
7673         ret.is_owned = false;
7674         return ret;
7675 }
7676 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7677         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7678         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7679         uint64_t ret_ref = 0;
7680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7682         return ret_ref;
7683 }
7684
7685 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7686 CHECK(!owner->result_ok);
7687         return DecodeError_clone(&*owner->contents.err);
7688 }
7689 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7690         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7691         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7692         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7693         uint64_t ret_ref = tag_ptr(ret_copy, true);
7694         return ret_ref;
7695 }
7696
7697 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7698         LDKGossipTimestampFilter ret = *owner->contents.result;
7699         ret.is_owned = false;
7700         return ret;
7701 }
7702 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7703         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7704         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7705         uint64_t ret_ref = 0;
7706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7708         return ret_ref;
7709 }
7710
7711 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7712 CHECK(!owner->result_ok);
7713         return DecodeError_clone(&*owner->contents.err);
7714 }
7715 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7716         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7717         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7718         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7719         uint64_t ret_ref = tag_ptr(ret_copy, true);
7720         return ret_ref;
7721 }
7722
7723 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7724         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7725         switch(obj->tag) {
7726                 case LDKSignOrCreationError_SignError: return 0;
7727                 case LDKSignOrCreationError_CreationError: return 1;
7728                 default: abort();
7729         }
7730 }
7731 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7732         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7733         assert(obj->tag == LDKSignOrCreationError_CreationError);
7734                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7735         return creation_error_conv;
7736 }
7737 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7738         LDKInvoice ret = *owner->contents.result;
7739         ret.is_owned = false;
7740         return ret;
7741 }
7742 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7743         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7744         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7745         uint64_t ret_ref = 0;
7746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7748         return ret_ref;
7749 }
7750
7751 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7752 CHECK(!owner->result_ok);
7753         return SignOrCreationError_clone(&*owner->contents.err);
7754 }
7755 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7756         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7757         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7758         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7759         uint64_t ret_ref = tag_ptr(ret_copy, true);
7760         return ret_ref;
7761 }
7762
7763 typedef struct LDKFilter_JCalls {
7764         atomic_size_t refcnt;
7765         uint32_t instance_ptr;
7766 } LDKFilter_JCalls;
7767 static void LDKFilter_JCalls_free(void* this_arg) {
7768         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7769         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7770                 FREE(j_calls);
7771         }
7772 }
7773 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7774         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7775         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7776         memcpy(txid_arr->elems, *txid, 32);
7777         LDKu8slice script_pubkey_var = script_pubkey;
7778         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7779         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7780         js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7781 }
7782 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7783         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7784         LDKWatchedOutput output_var = output;
7785         uint64_t output_ref = 0;
7786         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7787         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7788         js_invoke_function_buuuuu(j_calls->instance_ptr, 38, output_ref, 0, 0, 0, 0, 0);
7789 }
7790 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7791         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7792         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7793 }
7794 static inline LDKFilter LDKFilter_init (JSValue o) {
7795         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7796         atomic_init(&calls->refcnt, 1);
7797         calls->instance_ptr = o;
7798
7799         LDKFilter ret = {
7800                 .this_arg = (void*) calls,
7801                 .register_tx = register_tx_LDKFilter_jcall,
7802                 .register_output = register_output_LDKFilter_jcall,
7803                 .free = LDKFilter_JCalls_free,
7804         };
7805         return ret;
7806 }
7807 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7808         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7809         *res_ptr = LDKFilter_init(o);
7810         return tag_ptr(res_ptr, true);
7811 }
7812 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7813         void* this_arg_ptr = untag_ptr(this_arg);
7814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7815         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7816         unsigned char txid_arr[32];
7817         CHECK(txid->arr_len == 32);
7818         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7819         unsigned char (*txid_ref)[32] = &txid_arr;
7820         LDKu8slice script_pubkey_ref;
7821         script_pubkey_ref.datalen = script_pubkey->arr_len;
7822         script_pubkey_ref.data = script_pubkey->elems;
7823         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7824         FREE(script_pubkey);
7825 }
7826
7827 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7828         void* this_arg_ptr = untag_ptr(this_arg);
7829         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7830         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7831         LDKWatchedOutput output_conv;
7832         output_conv.inner = untag_ptr(output);
7833         output_conv.is_owned = ptr_is_owned(output);
7834         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7835         output_conv = WatchedOutput_clone(&output_conv);
7836         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7837 }
7838
7839 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7840         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7841         switch(obj->tag) {
7842                 case LDKCOption_FilterZ_Some: return 0;
7843                 case LDKCOption_FilterZ_None: return 1;
7844                 default: abort();
7845         }
7846 }
7847 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7848         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7849         assert(obj->tag == LDKCOption_FilterZ_Some);
7850                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7851                         *some_ret = obj->some;
7852                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7853                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7854                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7855                                 LDKFilter_JCalls_cloned(&(*some_ret));
7856                         }
7857         return tag_ptr(some_ret, true);
7858 }
7859 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7860         LDKLockedChannelMonitor ret = *owner->contents.result;
7861         ret.is_owned = false;
7862         return ret;
7863 }
7864 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7865         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7866         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7867         uint64_t ret_ref = 0;
7868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7870         return ret_ref;
7871 }
7872
7873 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7874 CHECK(!owner->result_ok);
7875         return *owner->contents.err;
7876 }
7877 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7878         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7879         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7880 }
7881
7882 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7883         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7884         for (size_t i = 0; i < ret.datalen; i++) {
7885                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7886         }
7887         return ret;
7888 }
7889 typedef struct LDKMessageSendEventsProvider_JCalls {
7890         atomic_size_t refcnt;
7891         uint32_t instance_ptr;
7892 } LDKMessageSendEventsProvider_JCalls;
7893 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7894         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7895         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7896                 FREE(j_calls);
7897         }
7898 }
7899 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7900         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7901         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
7902         LDKCVec_MessageSendEventZ ret_constr;
7903         ret_constr.datalen = ret->arr_len;
7904         if (ret_constr.datalen > 0)
7905                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7906         else
7907                 ret_constr.data = NULL;
7908         uint64_t* ret_vals = ret->elems;
7909         for (size_t s = 0; s < ret_constr.datalen; s++) {
7910                 uint64_t ret_conv_18 = ret_vals[s];
7911                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7912                 CHECK_ACCESS(ret_conv_18_ptr);
7913                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7914                 FREE(untag_ptr(ret_conv_18));
7915                 ret_constr.data[s] = ret_conv_18_conv;
7916         }
7917         FREE(ret);
7918         return ret_constr;
7919 }
7920 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7921         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7922         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7923 }
7924 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7925         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7926         atomic_init(&calls->refcnt, 1);
7927         calls->instance_ptr = o;
7928
7929         LDKMessageSendEventsProvider ret = {
7930                 .this_arg = (void*) calls,
7931                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7932                 .free = LDKMessageSendEventsProvider_JCalls_free,
7933         };
7934         return ret;
7935 }
7936 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7937         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7938         *res_ptr = LDKMessageSendEventsProvider_init(o);
7939         return tag_ptr(res_ptr, true);
7940 }
7941 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) {
7942         void* this_arg_ptr = untag_ptr(this_arg);
7943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7944         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7945         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7946         uint64_tArray ret_arr = NULL;
7947         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7948         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7949         for (size_t s = 0; s < ret_var.datalen; s++) {
7950                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7951                 *ret_conv_18_copy = ret_var.data[s];
7952                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7953                 ret_arr_ptr[s] = ret_conv_18_ref;
7954         }
7955         
7956         FREE(ret_var.data);
7957         return ret_arr;
7958 }
7959
7960 typedef struct LDKOnionMessageProvider_JCalls {
7961         atomic_size_t refcnt;
7962         uint32_t instance_ptr;
7963 } LDKOnionMessageProvider_JCalls;
7964 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
7965         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7966         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7967                 FREE(j_calls);
7968         }
7969 }
7970 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
7971         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7972         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
7973         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
7974         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
7975         LDKOnionMessage ret_conv;
7976         ret_conv.inner = untag_ptr(ret);
7977         ret_conv.is_owned = ptr_is_owned(ret);
7978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
7979         return ret_conv;
7980 }
7981 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
7982         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
7983         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7984 }
7985 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
7986         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
7987         atomic_init(&calls->refcnt, 1);
7988         calls->instance_ptr = o;
7989
7990         LDKOnionMessageProvider ret = {
7991                 .this_arg = (void*) calls,
7992                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
7993                 .free = LDKOnionMessageProvider_JCalls_free,
7994         };
7995         return ret;
7996 }
7997 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
7998         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
7999         *res_ptr = LDKOnionMessageProvider_init(o);
8000         return tag_ptr(res_ptr, true);
8001 }
8002 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) {
8003         void* this_arg_ptr = untag_ptr(this_arg);
8004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8005         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8006         LDKPublicKey peer_node_id_ref;
8007         CHECK(peer_node_id->arr_len == 33);
8008         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8009         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8010         uint64_t ret_ref = 0;
8011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8013         return ret_ref;
8014 }
8015
8016 typedef struct LDKEventHandler_JCalls {
8017         atomic_size_t refcnt;
8018         uint32_t instance_ptr;
8019 } LDKEventHandler_JCalls;
8020 static void LDKEventHandler_JCalls_free(void* this_arg) {
8021         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8022         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8023                 FREE(j_calls);
8024         }
8025 }
8026 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8027         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8028         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8029         *ret_event = Event_clone(event);
8030         uint64_t ref_event = tag_ptr(ret_event, true);
8031         js_invoke_function_buuuuu(j_calls->instance_ptr, 41, ref_event, 0, 0, 0, 0, 0);
8032 }
8033 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8034         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8035         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8036 }
8037 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8038         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8039         atomic_init(&calls->refcnt, 1);
8040         calls->instance_ptr = o;
8041
8042         LDKEventHandler ret = {
8043                 .this_arg = (void*) calls,
8044                 .handle_event = handle_event_LDKEventHandler_jcall,
8045                 .free = LDKEventHandler_JCalls_free,
8046         };
8047         return ret;
8048 }
8049 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8050         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8051         *res_ptr = LDKEventHandler_init(o);
8052         return tag_ptr(res_ptr, true);
8053 }
8054 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8055         void* this_arg_ptr = untag_ptr(this_arg);
8056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8057         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8058         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
8059         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8060 }
8061
8062 typedef struct LDKEventsProvider_JCalls {
8063         atomic_size_t refcnt;
8064         uint32_t instance_ptr;
8065 } LDKEventsProvider_JCalls;
8066 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8067         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8068         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8069                 FREE(j_calls);
8070         }
8071 }
8072 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8073         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8074         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8075         *handler_ret = handler;
8076         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8077 }
8078 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8079         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8080         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8081 }
8082 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8083         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8084         atomic_init(&calls->refcnt, 1);
8085         calls->instance_ptr = o;
8086
8087         LDKEventsProvider ret = {
8088                 .this_arg = (void*) calls,
8089                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8090                 .free = LDKEventsProvider_JCalls_free,
8091         };
8092         return ret;
8093 }
8094 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8095         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8096         *res_ptr = LDKEventsProvider_init(o);
8097         return tag_ptr(res_ptr, true);
8098 }
8099 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8100         void* this_arg_ptr = untag_ptr(this_arg);
8101         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8102         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8103         void* handler_ptr = untag_ptr(handler);
8104         CHECK_ACCESS(handler_ptr);
8105         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8106         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8108                 LDKEventHandler_JCalls_cloned(&handler_conv);
8109         }
8110         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8111 }
8112
8113 typedef struct LDKScore_JCalls {
8114         atomic_size_t refcnt;
8115         uint32_t instance_ptr;
8116 } LDKScore_JCalls;
8117 static void LDKScore_JCalls_free(void* this_arg) {
8118         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8119         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8120                 FREE(j_calls);
8121         }
8122 }
8123 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8124         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8125         int64_t short_channel_id_conv = short_channel_id;
8126         LDKNodeId source_var = *source;
8127         uint64_t source_ref = 0;
8128         source_var = NodeId_clone(&source_var);
8129         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8130         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8131         LDKNodeId target_var = *target;
8132         uint64_t target_ref = 0;
8133         target_var = NodeId_clone(&target_var);
8134         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8135         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8136         LDKChannelUsage usage_var = usage;
8137         uint64_t usage_ref = 0;
8138         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8139         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8140         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 43, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8141 }
8142 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8143         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8144         LDKCVec_RouteHopZ path_var = path;
8145         uint64_tArray path_arr = NULL;
8146         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8147         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8148         for (size_t k = 0; k < path_var.datalen; k++) {
8149                 LDKRouteHop path_conv_10_var = path_var.data[k];
8150                 uint64_t path_conv_10_ref = 0;
8151                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8152                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8153                 path_arr_ptr[k] = path_conv_10_ref;
8154         }
8155         
8156         FREE(path_var.data);
8157         int64_t short_channel_id_conv = short_channel_id;
8158         js_invoke_function_ubuuuu(j_calls->instance_ptr, 44, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8159 }
8160 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8161         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8162         LDKCVec_RouteHopZ path_var = path;
8163         uint64_tArray path_arr = NULL;
8164         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8165         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8166         for (size_t k = 0; k < path_var.datalen; k++) {
8167                 LDKRouteHop path_conv_10_var = path_var.data[k];
8168                 uint64_t path_conv_10_ref = 0;
8169                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8170                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8171                 path_arr_ptr[k] = path_conv_10_ref;
8172         }
8173         
8174         FREE(path_var.data);
8175         js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8176 }
8177 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8178         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8179         LDKCVec_RouteHopZ path_var = path;
8180         uint64_tArray path_arr = NULL;
8181         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8182         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8183         for (size_t k = 0; k < path_var.datalen; k++) {
8184                 LDKRouteHop path_conv_10_var = path_var.data[k];
8185                 uint64_t path_conv_10_ref = 0;
8186                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8187                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8188                 path_arr_ptr[k] = path_conv_10_ref;
8189         }
8190         
8191         FREE(path_var.data);
8192         int64_t short_channel_id_conv = short_channel_id;
8193         js_invoke_function_ubuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8194 }
8195 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8196         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8197         LDKCVec_RouteHopZ path_var = path;
8198         uint64_tArray path_arr = NULL;
8199         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8200         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8201         for (size_t k = 0; k < path_var.datalen; k++) {
8202                 LDKRouteHop path_conv_10_var = path_var.data[k];
8203                 uint64_t path_conv_10_ref = 0;
8204                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8205                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8206                 path_arr_ptr[k] = path_conv_10_ref;
8207         }
8208         
8209         FREE(path_var.data);
8210         js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8211 }
8212 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8213         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8214         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
8215         LDKCVec_u8Z ret_ref;
8216         ret_ref.datalen = ret->arr_len;
8217         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8218         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8219         return ret_ref;
8220 }
8221 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8222         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8223         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8224 }
8225 static inline LDKScore LDKScore_init (JSValue o) {
8226         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8227         atomic_init(&calls->refcnt, 1);
8228         calls->instance_ptr = o;
8229
8230         LDKScore ret = {
8231                 .this_arg = (void*) calls,
8232                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8233                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8234                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8235                 .probe_failed = probe_failed_LDKScore_jcall,
8236                 .probe_successful = probe_successful_LDKScore_jcall,
8237                 .write = write_LDKScore_jcall,
8238                 .free = LDKScore_JCalls_free,
8239         };
8240         return ret;
8241 }
8242 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8243         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8244         *res_ptr = LDKScore_init(o);
8245         return tag_ptr(res_ptr, true);
8246 }
8247 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) {
8248         void* this_arg_ptr = untag_ptr(this_arg);
8249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8250         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8251         LDKNodeId source_conv;
8252         source_conv.inner = untag_ptr(source);
8253         source_conv.is_owned = ptr_is_owned(source);
8254         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8255         source_conv.is_owned = false;
8256         LDKNodeId target_conv;
8257         target_conv.inner = untag_ptr(target);
8258         target_conv.is_owned = ptr_is_owned(target);
8259         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8260         target_conv.is_owned = false;
8261         LDKChannelUsage usage_conv;
8262         usage_conv.inner = untag_ptr(usage);
8263         usage_conv.is_owned = ptr_is_owned(usage);
8264         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8265         usage_conv = ChannelUsage_clone(&usage_conv);
8266         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8267         return ret_conv;
8268 }
8269
8270 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) {
8271         void* this_arg_ptr = untag_ptr(this_arg);
8272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8273         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8274         LDKCVec_RouteHopZ path_constr;
8275         path_constr.datalen = path->arr_len;
8276         if (path_constr.datalen > 0)
8277                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8278         else
8279                 path_constr.data = NULL;
8280         uint64_t* path_vals = path->elems;
8281         for (size_t k = 0; k < path_constr.datalen; k++) {
8282                 uint64_t path_conv_10 = path_vals[k];
8283                 LDKRouteHop path_conv_10_conv;
8284                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8285                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8286                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8287                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8288                 path_constr.data[k] = path_conv_10_conv;
8289         }
8290         FREE(path);
8291         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8292 }
8293
8294 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8295         void* this_arg_ptr = untag_ptr(this_arg);
8296         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8297         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8298         LDKCVec_RouteHopZ path_constr;
8299         path_constr.datalen = path->arr_len;
8300         if (path_constr.datalen > 0)
8301                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8302         else
8303                 path_constr.data = NULL;
8304         uint64_t* path_vals = path->elems;
8305         for (size_t k = 0; k < path_constr.datalen; k++) {
8306                 uint64_t path_conv_10 = path_vals[k];
8307                 LDKRouteHop path_conv_10_conv;
8308                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8309                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8310                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8311                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8312                 path_constr.data[k] = path_conv_10_conv;
8313         }
8314         FREE(path);
8315         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8316 }
8317
8318 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8319         void* this_arg_ptr = untag_ptr(this_arg);
8320         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8321         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8322         LDKCVec_RouteHopZ path_constr;
8323         path_constr.datalen = path->arr_len;
8324         if (path_constr.datalen > 0)
8325                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8326         else
8327                 path_constr.data = NULL;
8328         uint64_t* path_vals = path->elems;
8329         for (size_t k = 0; k < path_constr.datalen; k++) {
8330                 uint64_t path_conv_10 = path_vals[k];
8331                 LDKRouteHop path_conv_10_conv;
8332                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8333                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8334                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8335                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8336                 path_constr.data[k] = path_conv_10_conv;
8337         }
8338         FREE(path);
8339         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8340 }
8341
8342 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8343         void* this_arg_ptr = untag_ptr(this_arg);
8344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8345         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8346         LDKCVec_RouteHopZ path_constr;
8347         path_constr.datalen = path->arr_len;
8348         if (path_constr.datalen > 0)
8349                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8350         else
8351                 path_constr.data = NULL;
8352         uint64_t* path_vals = path->elems;
8353         for (size_t k = 0; k < path_constr.datalen; k++) {
8354                 uint64_t path_conv_10 = path_vals[k];
8355                 LDKRouteHop path_conv_10_conv;
8356                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8357                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8358                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8359                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8360                 path_constr.data[k] = path_conv_10_conv;
8361         }
8362         FREE(path);
8363         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8364 }
8365
8366 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8367         void* this_arg_ptr = untag_ptr(this_arg);
8368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8369         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8370         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8373         CVec_u8Z_free(ret_var);
8374         return ret_arr;
8375 }
8376
8377 typedef struct LDKLockableScore_JCalls {
8378         atomic_size_t refcnt;
8379         uint32_t instance_ptr;
8380 } LDKLockableScore_JCalls;
8381 static void LDKLockableScore_JCalls_free(void* this_arg) {
8382         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8383         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8384                 FREE(j_calls);
8385         }
8386 }
8387 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8388         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8389         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
8390         void* ret_ptr = untag_ptr(ret);
8391         CHECK_ACCESS(ret_ptr);
8392         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8393         if (ret_conv.free == LDKScore_JCalls_free) {
8394                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8395                 LDKScore_JCalls_cloned(&ret_conv);
8396         }// WARNING: we may need a move here but no clone is available for LDKScore
8397         
8398         return ret_conv;
8399 }
8400 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8401         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8402         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8403 }
8404 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8405         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8406         atomic_init(&calls->refcnt, 1);
8407         calls->instance_ptr = o;
8408
8409         LDKLockableScore ret = {
8410                 .this_arg = (void*) calls,
8411                 .lock = lock_LDKLockableScore_jcall,
8412                 .free = LDKLockableScore_JCalls_free,
8413         };
8414         return ret;
8415 }
8416 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8417         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8418         *res_ptr = LDKLockableScore_init(o);
8419         return tag_ptr(res_ptr, true);
8420 }
8421 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8422         void* this_arg_ptr = untag_ptr(this_arg);
8423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8424         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8425         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8426         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8427         return tag_ptr(ret_ret, true);
8428 }
8429
8430 typedef struct LDKWriteableScore_JCalls {
8431         atomic_size_t refcnt;
8432         uint32_t instance_ptr;
8433         LDKLockableScore_JCalls* LockableScore;
8434 } LDKWriteableScore_JCalls;
8435 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8436         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8437         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8438                 FREE(j_calls);
8439         }
8440 }
8441 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8442         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8443         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8444         LDKCVec_u8Z ret_ref;
8445         ret_ref.datalen = ret->arr_len;
8446         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8447         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8448         return ret_ref;
8449 }
8450 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8451         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8452         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8453         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8454 }
8455 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8456         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8457         atomic_init(&calls->refcnt, 1);
8458         calls->instance_ptr = o;
8459
8460         LDKWriteableScore ret = {
8461                 .this_arg = (void*) calls,
8462                 .write = write_LDKWriteableScore_jcall,
8463                 .free = LDKWriteableScore_JCalls_free,
8464                 .LockableScore = LDKLockableScore_init(LockableScore),
8465         };
8466         calls->LockableScore = ret.LockableScore.this_arg;
8467         return ret;
8468 }
8469 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8470         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8471         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8472         return tag_ptr(res_ptr, true);
8473 }
8474 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8475         void* this_arg_ptr = untag_ptr(this_arg);
8476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8477         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8478         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8479         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8480         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8481         CVec_u8Z_free(ret_var);
8482         return ret_arr;
8483 }
8484
8485 typedef struct LDKPersister_JCalls {
8486         atomic_size_t refcnt;
8487         uint32_t instance_ptr;
8488 } LDKPersister_JCalls;
8489 static void LDKPersister_JCalls_free(void* this_arg) {
8490         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8491         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8492                 FREE(j_calls);
8493         }
8494 }
8495 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8496         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8497         LDKChannelManager channel_manager_var = *channel_manager;
8498         uint64_t channel_manager_ref = 0;
8499         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8500         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8501         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8502         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, channel_manager_ref, 0, 0, 0, 0, 0);
8503         void* ret_ptr = untag_ptr(ret);
8504         CHECK_ACCESS(ret_ptr);
8505         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8506         FREE(untag_ptr(ret));
8507         return ret_conv;
8508 }
8509 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8510         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8511         LDKNetworkGraph network_graph_var = *network_graph;
8512         uint64_t network_graph_ref = 0;
8513         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8514         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8515         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8516         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, network_graph_ref, 0, 0, 0, 0, 0);
8517         void* ret_ptr = untag_ptr(ret);
8518         CHECK_ACCESS(ret_ptr);
8519         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8520         FREE(untag_ptr(ret));
8521         return ret_conv;
8522 }
8523 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8524         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8525         // WARNING: This object doesn't live past this scope, needs clone!
8526         uint64_t ret_scorer = tag_ptr(scorer, false);
8527         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, ret_scorer, 0, 0, 0, 0, 0);
8528         void* ret_ptr = untag_ptr(ret);
8529         CHECK_ACCESS(ret_ptr);
8530         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8531         FREE(untag_ptr(ret));
8532         return ret_conv;
8533 }
8534 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8535         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8536         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8537 }
8538 static inline LDKPersister LDKPersister_init (JSValue o) {
8539         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8540         atomic_init(&calls->refcnt, 1);
8541         calls->instance_ptr = o;
8542
8543         LDKPersister ret = {
8544                 .this_arg = (void*) calls,
8545                 .persist_manager = persist_manager_LDKPersister_jcall,
8546                 .persist_graph = persist_graph_LDKPersister_jcall,
8547                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8548                 .free = LDKPersister_JCalls_free,
8549         };
8550         return ret;
8551 }
8552 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8553         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8554         *res_ptr = LDKPersister_init(o);
8555         return tag_ptr(res_ptr, true);
8556 }
8557 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8558         void* this_arg_ptr = untag_ptr(this_arg);
8559         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8560         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8561         LDKChannelManager channel_manager_conv;
8562         channel_manager_conv.inner = untag_ptr(channel_manager);
8563         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8564         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8565         channel_manager_conv.is_owned = false;
8566         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8567         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8568         return tag_ptr(ret_conv, true);
8569 }
8570
8571 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8572         void* this_arg_ptr = untag_ptr(this_arg);
8573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8574         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8575         LDKNetworkGraph network_graph_conv;
8576         network_graph_conv.inner = untag_ptr(network_graph);
8577         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8578         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8579         network_graph_conv.is_owned = false;
8580         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8581         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8582         return tag_ptr(ret_conv, true);
8583 }
8584
8585 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8586         void* this_arg_ptr = untag_ptr(this_arg);
8587         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8588         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8589         void* scorer_ptr = untag_ptr(scorer);
8590         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8591         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8592         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8593         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8594         return tag_ptr(ret_conv, true);
8595 }
8596
8597 typedef struct LDKFutureCallback_JCalls {
8598         atomic_size_t refcnt;
8599         uint32_t instance_ptr;
8600 } LDKFutureCallback_JCalls;
8601 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8602         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8603         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8604                 FREE(j_calls);
8605         }
8606 }
8607 void call_LDKFutureCallback_jcall(const void* this_arg) {
8608         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8609         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
8610 }
8611 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8612         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8613         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8614 }
8615 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8616         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8617         atomic_init(&calls->refcnt, 1);
8618         calls->instance_ptr = o;
8619
8620         LDKFutureCallback ret = {
8621                 .this_arg = (void*) calls,
8622                 .call = call_LDKFutureCallback_jcall,
8623                 .free = LDKFutureCallback_JCalls_free,
8624         };
8625         return ret;
8626 }
8627 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8628         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8629         *res_ptr = LDKFutureCallback_init(o);
8630         return tag_ptr(res_ptr, true);
8631 }
8632 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8633         void* this_arg_ptr = untag_ptr(this_arg);
8634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8635         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8636         (this_arg_conv->call)(this_arg_conv->this_arg);
8637 }
8638
8639 typedef struct LDKListen_JCalls {
8640         atomic_size_t refcnt;
8641         uint32_t instance_ptr;
8642 } LDKListen_JCalls;
8643 static void LDKListen_JCalls_free(void* this_arg) {
8644         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8645         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8646                 FREE(j_calls);
8647         }
8648 }
8649 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8650         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8651         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8652         memcpy(header_arr->elems, *header, 80);
8653         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8654         uint64_tArray txdata_arr = NULL;
8655         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8656         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8657         for (size_t c = 0; c < txdata_var.datalen; c++) {
8658                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8659                 *txdata_conv_28_conv = txdata_var.data[c];
8660                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8661         }
8662         
8663         FREE(txdata_var.data);
8664         int32_t height_conv = height;
8665         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8666 }
8667 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8668         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8669         LDKu8slice block_var = block;
8670         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8671         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8672         int32_t height_conv = height;
8673         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8674 }
8675 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8676         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8677         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8678         memcpy(header_arr->elems, *header, 80);
8679         int32_t height_conv = height;
8680         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8681 }
8682 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8683         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8684         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8685 }
8686 static inline LDKListen LDKListen_init (JSValue o) {
8687         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8688         atomic_init(&calls->refcnt, 1);
8689         calls->instance_ptr = o;
8690
8691         LDKListen ret = {
8692                 .this_arg = (void*) calls,
8693                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8694                 .block_connected = block_connected_LDKListen_jcall,
8695                 .block_disconnected = block_disconnected_LDKListen_jcall,
8696                 .free = LDKListen_JCalls_free,
8697         };
8698         return ret;
8699 }
8700 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8701         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8702         *res_ptr = LDKListen_init(o);
8703         return tag_ptr(res_ptr, true);
8704 }
8705 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) {
8706         void* this_arg_ptr = untag_ptr(this_arg);
8707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8708         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8709         unsigned char header_arr[80];
8710         CHECK(header->arr_len == 80);
8711         memcpy(header_arr, header->elems, 80); FREE(header);
8712         unsigned char (*header_ref)[80] = &header_arr;
8713         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8714         txdata_constr.datalen = txdata->arr_len;
8715         if (txdata_constr.datalen > 0)
8716                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8717         else
8718                 txdata_constr.data = NULL;
8719         uint64_t* txdata_vals = txdata->elems;
8720         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8721                 uint64_t txdata_conv_28 = txdata_vals[c];
8722                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8723                 CHECK_ACCESS(txdata_conv_28_ptr);
8724                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8725                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8726                 txdata_constr.data[c] = txdata_conv_28_conv;
8727         }
8728         FREE(txdata);
8729         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8730 }
8731
8732 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8733         void* this_arg_ptr = untag_ptr(this_arg);
8734         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8735         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8736         LDKu8slice block_ref;
8737         block_ref.datalen = block->arr_len;
8738         block_ref.data = block->elems;
8739         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8740         FREE(block);
8741 }
8742
8743 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8744         void* this_arg_ptr = untag_ptr(this_arg);
8745         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8746         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8747         unsigned char header_arr[80];
8748         CHECK(header->arr_len == 80);
8749         memcpy(header_arr, header->elems, 80); FREE(header);
8750         unsigned char (*header_ref)[80] = &header_arr;
8751         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8752 }
8753
8754 typedef struct LDKConfirm_JCalls {
8755         atomic_size_t refcnt;
8756         uint32_t instance_ptr;
8757 } LDKConfirm_JCalls;
8758 static void LDKConfirm_JCalls_free(void* this_arg) {
8759         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8760         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8761                 FREE(j_calls);
8762         }
8763 }
8764 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8765         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8766         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8767         memcpy(header_arr->elems, *header, 80);
8768         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8769         uint64_tArray txdata_arr = NULL;
8770         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8771         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8772         for (size_t c = 0; c < txdata_var.datalen; c++) {
8773                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8774                 *txdata_conv_28_conv = txdata_var.data[c];
8775                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8776         }
8777         
8778         FREE(txdata_var.data);
8779         int32_t height_conv = height;
8780         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8781 }
8782 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8783         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8784         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8785         memcpy(txid_arr->elems, *txid, 32);
8786         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8787 }
8788 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8789         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8790         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8791         memcpy(header_arr->elems, *header, 80);
8792         int32_t height_conv = height;
8793         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8794 }
8795 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8796         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8797         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
8798         LDKCVec_TxidZ ret_constr;
8799         ret_constr.datalen = ret->arr_len;
8800         if (ret_constr.datalen > 0)
8801                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8802         else
8803                 ret_constr.data = NULL;
8804         int8_tArray* ret_vals = (void*) ret->elems;
8805         for (size_t m = 0; m < ret_constr.datalen; m++) {
8806                 int8_tArray ret_conv_12 = ret_vals[m];
8807                 LDKThirtyTwoBytes ret_conv_12_ref;
8808                 CHECK(ret_conv_12->arr_len == 32);
8809                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8810                 ret_constr.data[m] = ret_conv_12_ref;
8811         }
8812         FREE(ret);
8813         return ret_constr;
8814 }
8815 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8816         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8817         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8818 }
8819 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8820         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8821         atomic_init(&calls->refcnt, 1);
8822         calls->instance_ptr = o;
8823
8824         LDKConfirm ret = {
8825                 .this_arg = (void*) calls,
8826                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8827                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8828                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8829                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8830                 .free = LDKConfirm_JCalls_free,
8831         };
8832         return ret;
8833 }
8834 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8835         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8836         *res_ptr = LDKConfirm_init(o);
8837         return tag_ptr(res_ptr, true);
8838 }
8839 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) {
8840         void* this_arg_ptr = untag_ptr(this_arg);
8841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8842         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8843         unsigned char header_arr[80];
8844         CHECK(header->arr_len == 80);
8845         memcpy(header_arr, header->elems, 80); FREE(header);
8846         unsigned char (*header_ref)[80] = &header_arr;
8847         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8848         txdata_constr.datalen = txdata->arr_len;
8849         if (txdata_constr.datalen > 0)
8850                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8851         else
8852                 txdata_constr.data = NULL;
8853         uint64_t* txdata_vals = txdata->elems;
8854         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8855                 uint64_t txdata_conv_28 = txdata_vals[c];
8856                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8857                 CHECK_ACCESS(txdata_conv_28_ptr);
8858                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8859                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8860                 txdata_constr.data[c] = txdata_conv_28_conv;
8861         }
8862         FREE(txdata);
8863         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8864 }
8865
8866 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8867         void* this_arg_ptr = untag_ptr(this_arg);
8868         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8869         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8870         unsigned char txid_arr[32];
8871         CHECK(txid->arr_len == 32);
8872         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8873         unsigned char (*txid_ref)[32] = &txid_arr;
8874         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8875 }
8876
8877 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8878         void* this_arg_ptr = untag_ptr(this_arg);
8879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8880         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8881         unsigned char header_arr[80];
8882         CHECK(header->arr_len == 80);
8883         memcpy(header_arr, header->elems, 80); FREE(header);
8884         unsigned char (*header_ref)[80] = &header_arr;
8885         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8886 }
8887
8888 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8889         void* this_arg_ptr = untag_ptr(this_arg);
8890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8891         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8892         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8893         ptrArray ret_arr = NULL;
8894         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8895         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8896         for (size_t m = 0; m < ret_var.datalen; m++) {
8897                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8898                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8899                 ret_arr_ptr[m] = ret_conv_12_arr;
8900         }
8901         
8902         FREE(ret_var.data);
8903         return ret_arr;
8904 }
8905
8906 typedef struct LDKPersist_JCalls {
8907         atomic_size_t refcnt;
8908         uint32_t instance_ptr;
8909 } LDKPersist_JCalls;
8910 static void LDKPersist_JCalls_free(void* this_arg) {
8911         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8912         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8913                 FREE(j_calls);
8914         }
8915 }
8916 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8917         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8918         LDKOutPoint channel_id_var = channel_id;
8919         uint64_t channel_id_ref = 0;
8920         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8921         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8922         LDKChannelMonitor data_var = *data;
8923         uint64_t data_ref = 0;
8924         data_var = ChannelMonitor_clone(&data_var);
8925         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8926         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8927         LDKMonitorUpdateId update_id_var = update_id;
8928         uint64_t update_id_ref = 0;
8929         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8930         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8931         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 62, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8932         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
8933         return ret_conv;
8934 }
8935 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8936         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8937         LDKOutPoint channel_id_var = channel_id;
8938         uint64_t channel_id_ref = 0;
8939         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8940         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8941         LDKChannelMonitorUpdate update_var = *update;
8942         uint64_t update_ref = 0;
8943         update_var = ChannelMonitorUpdate_clone(&update_var);
8944         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8945         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8946         LDKChannelMonitor data_var = *data;
8947         uint64_t data_ref = 0;
8948         data_var = ChannelMonitor_clone(&data_var);
8949         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8950         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8951         LDKMonitorUpdateId update_id_var = update_id;
8952         uint64_t update_id_ref = 0;
8953         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8954         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8955         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 63, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8956         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
8957         return ret_conv;
8958 }
8959 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8960         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8962 }
8963 static inline LDKPersist LDKPersist_init (JSValue o) {
8964         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8965         atomic_init(&calls->refcnt, 1);
8966         calls->instance_ptr = o;
8967
8968         LDKPersist ret = {
8969                 .this_arg = (void*) calls,
8970                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8971                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8972                 .free = LDKPersist_JCalls_free,
8973         };
8974         return ret;
8975 }
8976 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8977         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8978         *res_ptr = LDKPersist_init(o);
8979         return tag_ptr(res_ptr, true);
8980 }
8981 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) {
8982         void* this_arg_ptr = untag_ptr(this_arg);
8983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8984         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8985         LDKOutPoint channel_id_conv;
8986         channel_id_conv.inner = untag_ptr(channel_id);
8987         channel_id_conv.is_owned = ptr_is_owned(channel_id);
8988         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8989         channel_id_conv = OutPoint_clone(&channel_id_conv);
8990         LDKChannelMonitor data_conv;
8991         data_conv.inner = untag_ptr(data);
8992         data_conv.is_owned = ptr_is_owned(data);
8993         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8994         data_conv.is_owned = false;
8995         LDKMonitorUpdateId update_id_conv;
8996         update_id_conv.inner = untag_ptr(update_id);
8997         update_id_conv.is_owned = ptr_is_owned(update_id);
8998         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8999         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9000         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));
9001         return ret_conv;
9002 }
9003
9004 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) {
9005         void* this_arg_ptr = untag_ptr(this_arg);
9006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9007         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9008         LDKOutPoint channel_id_conv;
9009         channel_id_conv.inner = untag_ptr(channel_id);
9010         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9011         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9012         channel_id_conv = OutPoint_clone(&channel_id_conv);
9013         LDKChannelMonitorUpdate update_conv;
9014         update_conv.inner = untag_ptr(update);
9015         update_conv.is_owned = ptr_is_owned(update);
9016         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9017         update_conv.is_owned = false;
9018         LDKChannelMonitor data_conv;
9019         data_conv.inner = untag_ptr(data);
9020         data_conv.is_owned = ptr_is_owned(data);
9021         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9022         data_conv.is_owned = false;
9023         LDKMonitorUpdateId update_id_conv;
9024         update_id_conv.inner = untag_ptr(update_id);
9025         update_id_conv.is_owned = ptr_is_owned(update_id);
9026         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9027         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9028         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));
9029         return ret_conv;
9030 }
9031
9032 typedef struct LDKChannelMessageHandler_JCalls {
9033         atomic_size_t refcnt;
9034         uint32_t instance_ptr;
9035         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9036 } LDKChannelMessageHandler_JCalls;
9037 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9038         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9039         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9040                 FREE(j_calls);
9041         }
9042 }
9043 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9044         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9045         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9046         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9047         LDKInitFeatures their_features_var = their_features;
9048         uint64_t their_features_ref = 0;
9049         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9050         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9051         LDKOpenChannel msg_var = *msg;
9052         uint64_t msg_ref = 0;
9053         msg_var = OpenChannel_clone(&msg_var);
9054         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9055         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9056         js_invoke_function_ubbuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9057 }
9058 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9060         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9061         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9062         LDKInitFeatures their_features_var = their_features;
9063         uint64_t their_features_ref = 0;
9064         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9065         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9066         LDKAcceptChannel msg_var = *msg;
9067         uint64_t msg_ref = 0;
9068         msg_var = AcceptChannel_clone(&msg_var);
9069         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9070         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9071         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9072 }
9073 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9074         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9075         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9076         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9077         LDKFundingCreated msg_var = *msg;
9078         uint64_t msg_ref = 0;
9079         msg_var = FundingCreated_clone(&msg_var);
9080         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9081         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9082         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9083 }
9084 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9085         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9086         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9087         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9088         LDKFundingSigned msg_var = *msg;
9089         uint64_t msg_ref = 0;
9090         msg_var = FundingSigned_clone(&msg_var);
9091         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9092         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9093         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9094 }
9095 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9096         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9097         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9098         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9099         LDKChannelReady msg_var = *msg;
9100         uint64_t msg_ref = 0;
9101         msg_var = ChannelReady_clone(&msg_var);
9102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9103         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9104         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9105 }
9106 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9107         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9108         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9109         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9110         LDKInitFeatures their_features_var = *their_features;
9111         uint64_t their_features_ref = 0;
9112         their_features_var = InitFeatures_clone(&their_features_var);
9113         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9114         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9115         LDKShutdown msg_var = *msg;
9116         uint64_t msg_ref = 0;
9117         msg_var = Shutdown_clone(&msg_var);
9118         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9119         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9120         js_invoke_function_ubbuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9121 }
9122 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9123         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9124         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9125         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9126         LDKClosingSigned msg_var = *msg;
9127         uint64_t msg_ref = 0;
9128         msg_var = ClosingSigned_clone(&msg_var);
9129         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9130         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9131         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9132 }
9133 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9134         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9135         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9136         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9137         LDKUpdateAddHTLC msg_var = *msg;
9138         uint64_t msg_ref = 0;
9139         msg_var = UpdateAddHTLC_clone(&msg_var);
9140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9141         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9142         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9143 }
9144 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9145         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9146         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9147         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9148         LDKUpdateFulfillHTLC msg_var = *msg;
9149         uint64_t msg_ref = 0;
9150         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9151         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9152         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9153         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9154 }
9155 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9156         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9157         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9158         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9159         LDKUpdateFailHTLC msg_var = *msg;
9160         uint64_t msg_ref = 0;
9161         msg_var = UpdateFailHTLC_clone(&msg_var);
9162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9163         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9164         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9165 }
9166 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9167         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9168         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9169         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9170         LDKUpdateFailMalformedHTLC msg_var = *msg;
9171         uint64_t msg_ref = 0;
9172         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9174         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9175         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9176 }
9177 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9178         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9179         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9180         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9181         LDKCommitmentSigned msg_var = *msg;
9182         uint64_t msg_ref = 0;
9183         msg_var = CommitmentSigned_clone(&msg_var);
9184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9185         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9186         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9187 }
9188 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9189         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9190         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9191         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9192         LDKRevokeAndACK msg_var = *msg;
9193         uint64_t msg_ref = 0;
9194         msg_var = RevokeAndACK_clone(&msg_var);
9195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9196         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9197         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9198 }
9199 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9200         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9201         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9202         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9203         LDKUpdateFee msg_var = *msg;
9204         uint64_t msg_ref = 0;
9205         msg_var = UpdateFee_clone(&msg_var);
9206         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9207         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9208         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9209 }
9210 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9211         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9212         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9213         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9214         LDKAnnouncementSignatures msg_var = *msg;
9215         uint64_t msg_ref = 0;
9216         msg_var = AnnouncementSignatures_clone(&msg_var);
9217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9218         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9219         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9220 }
9221 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9222         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9223         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9224         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9225         jboolean no_connection_possible_conv = no_connection_possible;
9226         js_invoke_function_uuuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9227 }
9228 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9229         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9230         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9231         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9232         LDKInit msg_var = *msg;
9233         uint64_t msg_ref = 0;
9234         msg_var = Init_clone(&msg_var);
9235         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9236         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9237         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9238         void* ret_ptr = untag_ptr(ret);
9239         CHECK_ACCESS(ret_ptr);
9240         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9241         FREE(untag_ptr(ret));
9242         return ret_conv;
9243 }
9244 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9245         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9246         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9247         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9248         LDKChannelReestablish msg_var = *msg;
9249         uint64_t msg_ref = 0;
9250         msg_var = ChannelReestablish_clone(&msg_var);
9251         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9252         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9253         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9254 }
9255 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9256         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9257         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9258         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9259         LDKChannelUpdate msg_var = *msg;
9260         uint64_t msg_ref = 0;
9261         msg_var = ChannelUpdate_clone(&msg_var);
9262         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9263         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9264         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9265 }
9266 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9267         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9268         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9269         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9270         LDKErrorMessage msg_var = *msg;
9271         uint64_t msg_ref = 0;
9272         msg_var = ErrorMessage_clone(&msg_var);
9273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9274         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9275         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9276 }
9277 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9278         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9279         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 84, 0, 0, 0, 0, 0, 0);
9280         LDKNodeFeatures ret_conv;
9281         ret_conv.inner = untag_ptr(ret);
9282         ret_conv.is_owned = ptr_is_owned(ret);
9283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9284         return ret_conv;
9285 }
9286 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9287         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9288         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9289         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9290         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9291         LDKInitFeatures ret_conv;
9292         ret_conv.inner = untag_ptr(ret);
9293         ret_conv.is_owned = ptr_is_owned(ret);
9294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9295         return ret_conv;
9296 }
9297 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9298         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9299         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9300         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9301 }
9302 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9303         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9304         atomic_init(&calls->refcnt, 1);
9305         calls->instance_ptr = o;
9306
9307         LDKChannelMessageHandler ret = {
9308                 .this_arg = (void*) calls,
9309                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9310                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9311                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9312                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9313                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9314                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9315                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9316                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9317                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9318                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9319                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9320                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9321                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9322                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9323                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9324                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9325                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9326                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9327                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9328                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9329                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9330                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9331                 .free = LDKChannelMessageHandler_JCalls_free,
9332                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9333         };
9334         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9335         return ret;
9336 }
9337 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9338         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9339         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9340         return tag_ptr(res_ptr, true);
9341 }
9342 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) {
9343         void* this_arg_ptr = untag_ptr(this_arg);
9344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9345         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9346         LDKPublicKey their_node_id_ref;
9347         CHECK(their_node_id->arr_len == 33);
9348         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9349         LDKInitFeatures their_features_conv;
9350         their_features_conv.inner = untag_ptr(their_features);
9351         their_features_conv.is_owned = ptr_is_owned(their_features);
9352         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9353         their_features_conv = InitFeatures_clone(&their_features_conv);
9354         LDKOpenChannel msg_conv;
9355         msg_conv.inner = untag_ptr(msg);
9356         msg_conv.is_owned = ptr_is_owned(msg);
9357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9358         msg_conv.is_owned = false;
9359         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9360 }
9361
9362 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) {
9363         void* this_arg_ptr = untag_ptr(this_arg);
9364         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9365         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9366         LDKPublicKey their_node_id_ref;
9367         CHECK(their_node_id->arr_len == 33);
9368         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9369         LDKInitFeatures their_features_conv;
9370         their_features_conv.inner = untag_ptr(their_features);
9371         their_features_conv.is_owned = ptr_is_owned(their_features);
9372         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9373         their_features_conv = InitFeatures_clone(&their_features_conv);
9374         LDKAcceptChannel msg_conv;
9375         msg_conv.inner = untag_ptr(msg);
9376         msg_conv.is_owned = ptr_is_owned(msg);
9377         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9378         msg_conv.is_owned = false;
9379         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9380 }
9381
9382 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) {
9383         void* this_arg_ptr = untag_ptr(this_arg);
9384         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9385         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9386         LDKPublicKey their_node_id_ref;
9387         CHECK(their_node_id->arr_len == 33);
9388         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9389         LDKFundingCreated msg_conv;
9390         msg_conv.inner = untag_ptr(msg);
9391         msg_conv.is_owned = ptr_is_owned(msg);
9392         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9393         msg_conv.is_owned = false;
9394         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9395 }
9396
9397 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) {
9398         void* this_arg_ptr = untag_ptr(this_arg);
9399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9400         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9401         LDKPublicKey their_node_id_ref;
9402         CHECK(their_node_id->arr_len == 33);
9403         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9404         LDKFundingSigned msg_conv;
9405         msg_conv.inner = untag_ptr(msg);
9406         msg_conv.is_owned = ptr_is_owned(msg);
9407         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9408         msg_conv.is_owned = false;
9409         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9410 }
9411
9412 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) {
9413         void* this_arg_ptr = untag_ptr(this_arg);
9414         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9415         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9416         LDKPublicKey their_node_id_ref;
9417         CHECK(their_node_id->arr_len == 33);
9418         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9419         LDKChannelReady msg_conv;
9420         msg_conv.inner = untag_ptr(msg);
9421         msg_conv.is_owned = ptr_is_owned(msg);
9422         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9423         msg_conv.is_owned = false;
9424         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9425 }
9426
9427 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) {
9428         void* this_arg_ptr = untag_ptr(this_arg);
9429         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9430         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9431         LDKPublicKey their_node_id_ref;
9432         CHECK(their_node_id->arr_len == 33);
9433         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9434         LDKInitFeatures their_features_conv;
9435         their_features_conv.inner = untag_ptr(their_features);
9436         their_features_conv.is_owned = ptr_is_owned(their_features);
9437         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9438         their_features_conv.is_owned = false;
9439         LDKShutdown msg_conv;
9440         msg_conv.inner = untag_ptr(msg);
9441         msg_conv.is_owned = ptr_is_owned(msg);
9442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9443         msg_conv.is_owned = false;
9444         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9445 }
9446
9447 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) {
9448         void* this_arg_ptr = untag_ptr(this_arg);
9449         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9450         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9451         LDKPublicKey their_node_id_ref;
9452         CHECK(their_node_id->arr_len == 33);
9453         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9454         LDKClosingSigned msg_conv;
9455         msg_conv.inner = untag_ptr(msg);
9456         msg_conv.is_owned = ptr_is_owned(msg);
9457         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9458         msg_conv.is_owned = false;
9459         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9460 }
9461
9462 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) {
9463         void* this_arg_ptr = untag_ptr(this_arg);
9464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9465         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9466         LDKPublicKey their_node_id_ref;
9467         CHECK(their_node_id->arr_len == 33);
9468         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9469         LDKUpdateAddHTLC msg_conv;
9470         msg_conv.inner = untag_ptr(msg);
9471         msg_conv.is_owned = ptr_is_owned(msg);
9472         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9473         msg_conv.is_owned = false;
9474         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9475 }
9476
9477 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) {
9478         void* this_arg_ptr = untag_ptr(this_arg);
9479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9480         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9481         LDKPublicKey their_node_id_ref;
9482         CHECK(their_node_id->arr_len == 33);
9483         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9484         LDKUpdateFulfillHTLC msg_conv;
9485         msg_conv.inner = untag_ptr(msg);
9486         msg_conv.is_owned = ptr_is_owned(msg);
9487         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9488         msg_conv.is_owned = false;
9489         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9490 }
9491
9492 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) {
9493         void* this_arg_ptr = untag_ptr(this_arg);
9494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9495         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9496         LDKPublicKey their_node_id_ref;
9497         CHECK(their_node_id->arr_len == 33);
9498         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9499         LDKUpdateFailHTLC msg_conv;
9500         msg_conv.inner = untag_ptr(msg);
9501         msg_conv.is_owned = ptr_is_owned(msg);
9502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9503         msg_conv.is_owned = false;
9504         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9505 }
9506
9507 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) {
9508         void* this_arg_ptr = untag_ptr(this_arg);
9509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9510         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9511         LDKPublicKey their_node_id_ref;
9512         CHECK(their_node_id->arr_len == 33);
9513         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9514         LDKUpdateFailMalformedHTLC msg_conv;
9515         msg_conv.inner = untag_ptr(msg);
9516         msg_conv.is_owned = ptr_is_owned(msg);
9517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9518         msg_conv.is_owned = false;
9519         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9520 }
9521
9522 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) {
9523         void* this_arg_ptr = untag_ptr(this_arg);
9524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9525         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9526         LDKPublicKey their_node_id_ref;
9527         CHECK(their_node_id->arr_len == 33);
9528         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9529         LDKCommitmentSigned msg_conv;
9530         msg_conv.inner = untag_ptr(msg);
9531         msg_conv.is_owned = ptr_is_owned(msg);
9532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9533         msg_conv.is_owned = false;
9534         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9535 }
9536
9537 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) {
9538         void* this_arg_ptr = untag_ptr(this_arg);
9539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9540         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9541         LDKPublicKey their_node_id_ref;
9542         CHECK(their_node_id->arr_len == 33);
9543         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9544         LDKRevokeAndACK msg_conv;
9545         msg_conv.inner = untag_ptr(msg);
9546         msg_conv.is_owned = ptr_is_owned(msg);
9547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9548         msg_conv.is_owned = false;
9549         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9550 }
9551
9552 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) {
9553         void* this_arg_ptr = untag_ptr(this_arg);
9554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9555         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9556         LDKPublicKey their_node_id_ref;
9557         CHECK(their_node_id->arr_len == 33);
9558         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9559         LDKUpdateFee msg_conv;
9560         msg_conv.inner = untag_ptr(msg);
9561         msg_conv.is_owned = ptr_is_owned(msg);
9562         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9563         msg_conv.is_owned = false;
9564         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9565 }
9566
9567 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) {
9568         void* this_arg_ptr = untag_ptr(this_arg);
9569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9570         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9571         LDKPublicKey their_node_id_ref;
9572         CHECK(their_node_id->arr_len == 33);
9573         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9574         LDKAnnouncementSignatures msg_conv;
9575         msg_conv.inner = untag_ptr(msg);
9576         msg_conv.is_owned = ptr_is_owned(msg);
9577         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9578         msg_conv.is_owned = false;
9579         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9580 }
9581
9582 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) {
9583         void* this_arg_ptr = untag_ptr(this_arg);
9584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9585         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9586         LDKPublicKey their_node_id_ref;
9587         CHECK(their_node_id->arr_len == 33);
9588         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9589         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9590 }
9591
9592 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) {
9593         void* this_arg_ptr = untag_ptr(this_arg);
9594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9595         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9596         LDKPublicKey their_node_id_ref;
9597         CHECK(their_node_id->arr_len == 33);
9598         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9599         LDKInit msg_conv;
9600         msg_conv.inner = untag_ptr(msg);
9601         msg_conv.is_owned = ptr_is_owned(msg);
9602         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9603         msg_conv.is_owned = false;
9604         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9605         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9606         return tag_ptr(ret_conv, true);
9607 }
9608
9609 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) {
9610         void* this_arg_ptr = untag_ptr(this_arg);
9611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9612         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9613         LDKPublicKey their_node_id_ref;
9614         CHECK(their_node_id->arr_len == 33);
9615         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9616         LDKChannelReestablish msg_conv;
9617         msg_conv.inner = untag_ptr(msg);
9618         msg_conv.is_owned = ptr_is_owned(msg);
9619         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9620         msg_conv.is_owned = false;
9621         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9622 }
9623
9624 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) {
9625         void* this_arg_ptr = untag_ptr(this_arg);
9626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9627         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9628         LDKPublicKey their_node_id_ref;
9629         CHECK(their_node_id->arr_len == 33);
9630         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9631         LDKChannelUpdate msg_conv;
9632         msg_conv.inner = untag_ptr(msg);
9633         msg_conv.is_owned = ptr_is_owned(msg);
9634         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9635         msg_conv.is_owned = false;
9636         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9637 }
9638
9639 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9640         void* this_arg_ptr = untag_ptr(this_arg);
9641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9642         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9643         LDKPublicKey their_node_id_ref;
9644         CHECK(their_node_id->arr_len == 33);
9645         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9646         LDKErrorMessage msg_conv;
9647         msg_conv.inner = untag_ptr(msg);
9648         msg_conv.is_owned = ptr_is_owned(msg);
9649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9650         msg_conv.is_owned = false;
9651         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9652 }
9653
9654 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9655         void* this_arg_ptr = untag_ptr(this_arg);
9656         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9657         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9658         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9659         uint64_t ret_ref = 0;
9660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9662         return ret_ref;
9663 }
9664
9665 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9666         void* this_arg_ptr = untag_ptr(this_arg);
9667         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9668         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9669         LDKPublicKey their_node_id_ref;
9670         CHECK(their_node_id->arr_len == 33);
9671         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9672         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9673         uint64_t ret_ref = 0;
9674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9676         return ret_ref;
9677 }
9678
9679 typedef struct LDKRoutingMessageHandler_JCalls {
9680         atomic_size_t refcnt;
9681         uint32_t instance_ptr;
9682         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9683 } LDKRoutingMessageHandler_JCalls;
9684 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9685         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9686         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9687                 FREE(j_calls);
9688         }
9689 }
9690 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9691         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9692         LDKNodeAnnouncement msg_var = *msg;
9693         uint64_t msg_ref = 0;
9694         msg_var = NodeAnnouncement_clone(&msg_var);
9695         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9696         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9697         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 86, msg_ref, 0, 0, 0, 0, 0);
9698         void* ret_ptr = untag_ptr(ret);
9699         CHECK_ACCESS(ret_ptr);
9700         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9701         FREE(untag_ptr(ret));
9702         return ret_conv;
9703 }
9704 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9705         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9706         LDKChannelAnnouncement msg_var = *msg;
9707         uint64_t msg_ref = 0;
9708         msg_var = ChannelAnnouncement_clone(&msg_var);
9709         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9710         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9711         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0);
9712         void* ret_ptr = untag_ptr(ret);
9713         CHECK_ACCESS(ret_ptr);
9714         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9715         FREE(untag_ptr(ret));
9716         return ret_conv;
9717 }
9718 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9719         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9720         LDKChannelUpdate msg_var = *msg;
9721         uint64_t msg_ref = 0;
9722         msg_var = ChannelUpdate_clone(&msg_var);
9723         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9724         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9725         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
9726         void* ret_ptr = untag_ptr(ret);
9727         CHECK_ACCESS(ret_ptr);
9728         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9729         FREE(untag_ptr(ret));
9730         return ret_conv;
9731 }
9732 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
9733         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9734         int64_t starting_point_conv = starting_point;
9735         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, starting_point_conv, 0, 0, 0, 0, 0);
9736         void* ret_ptr = untag_ptr(ret);
9737         CHECK_ACCESS(ret_ptr);
9738         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
9739         FREE(untag_ptr(ret));
9740         return ret_conv;
9741 }
9742 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
9743         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9744         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9745         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9746         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 90, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
9747         LDKNodeAnnouncement ret_conv;
9748         ret_conv.inner = untag_ptr(ret);
9749         ret_conv.is_owned = ptr_is_owned(ret);
9750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9751         return ret_conv;
9752 }
9753 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9754         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9755         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9756         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9757         LDKInit init_var = *init;
9758         uint64_t init_ref = 0;
9759         init_var = Init_clone(&init_var);
9760         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9761         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9762         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9763         void* ret_ptr = untag_ptr(ret);
9764         CHECK_ACCESS(ret_ptr);
9765         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9766         FREE(untag_ptr(ret));
9767         return ret_conv;
9768 }
9769 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9770         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9771         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9772         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9773         LDKReplyChannelRange msg_var = msg;
9774         uint64_t msg_ref = 0;
9775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9776         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9777         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9778         void* ret_ptr = untag_ptr(ret);
9779         CHECK_ACCESS(ret_ptr);
9780         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9781         FREE(untag_ptr(ret));
9782         return ret_conv;
9783 }
9784 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9785         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9786         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9787         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9788         LDKReplyShortChannelIdsEnd msg_var = msg;
9789         uint64_t msg_ref = 0;
9790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9791         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9792         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9793         void* ret_ptr = untag_ptr(ret);
9794         CHECK_ACCESS(ret_ptr);
9795         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9796         FREE(untag_ptr(ret));
9797         return ret_conv;
9798 }
9799 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9800         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9801         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9802         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9803         LDKQueryChannelRange msg_var = msg;
9804         uint64_t msg_ref = 0;
9805         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9806         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9807         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9808         void* ret_ptr = untag_ptr(ret);
9809         CHECK_ACCESS(ret_ptr);
9810         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9811         FREE(untag_ptr(ret));
9812         return ret_conv;
9813 }
9814 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9815         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9816         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9817         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9818         LDKQueryShortChannelIds msg_var = msg;
9819         uint64_t msg_ref = 0;
9820         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9821         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9822         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9823         void* ret_ptr = untag_ptr(ret);
9824         CHECK_ACCESS(ret_ptr);
9825         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9826         FREE(untag_ptr(ret));
9827         return ret_conv;
9828 }
9829 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
9830         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9831         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 96, 0, 0, 0, 0, 0, 0);
9832         LDKNodeFeatures ret_conv;
9833         ret_conv.inner = untag_ptr(ret);
9834         ret_conv.is_owned = ptr_is_owned(ret);
9835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9836         return ret_conv;
9837 }
9838 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9839         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9840         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9841         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9842         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9843         LDKInitFeatures ret_conv;
9844         ret_conv.inner = untag_ptr(ret);
9845         ret_conv.is_owned = ptr_is_owned(ret);
9846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9847         return ret_conv;
9848 }
9849 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9850         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9851         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9852         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9853 }
9854 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9855         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9856         atomic_init(&calls->refcnt, 1);
9857         calls->instance_ptr = o;
9858
9859         LDKRoutingMessageHandler ret = {
9860                 .this_arg = (void*) calls,
9861                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9862                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9863                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9864                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
9865                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
9866                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9867                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9868                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9869                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9870                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9871                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
9872                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
9873                 .free = LDKRoutingMessageHandler_JCalls_free,
9874                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9875         };
9876         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9877         return ret;
9878 }
9879 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9880         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9881         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9882         return tag_ptr(res_ptr, true);
9883 }
9884 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9885         void* this_arg_ptr = untag_ptr(this_arg);
9886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9887         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9888         LDKNodeAnnouncement msg_conv;
9889         msg_conv.inner = untag_ptr(msg);
9890         msg_conv.is_owned = ptr_is_owned(msg);
9891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9892         msg_conv.is_owned = false;
9893         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9894         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9895         return tag_ptr(ret_conv, true);
9896 }
9897
9898 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9899         void* this_arg_ptr = untag_ptr(this_arg);
9900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9901         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9902         LDKChannelAnnouncement msg_conv;
9903         msg_conv.inner = untag_ptr(msg);
9904         msg_conv.is_owned = ptr_is_owned(msg);
9905         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9906         msg_conv.is_owned = false;
9907         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9908         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9909         return tag_ptr(ret_conv, true);
9910 }
9911
9912 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9913         void* this_arg_ptr = untag_ptr(this_arg);
9914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9915         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9916         LDKChannelUpdate msg_conv;
9917         msg_conv.inner = untag_ptr(msg);
9918         msg_conv.is_owned = ptr_is_owned(msg);
9919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9920         msg_conv.is_owned = false;
9921         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9922         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9923         return tag_ptr(ret_conv, true);
9924 }
9925
9926 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) {
9927         void* this_arg_ptr = untag_ptr(this_arg);
9928         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9929         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9930         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
9931         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
9932         uint64_t ret_ref = tag_ptr(ret_copy, true);
9933         return ret_ref;
9934 }
9935
9936 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) {
9937         void* this_arg_ptr = untag_ptr(this_arg);
9938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9939         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9940         LDKPublicKey starting_point_ref;
9941         CHECK(starting_point->arr_len == 33);
9942         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9943         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
9944         uint64_t ret_ref = 0;
9945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9947         return ret_ref;
9948 }
9949
9950 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) {
9951         void* this_arg_ptr = untag_ptr(this_arg);
9952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9953         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9954         LDKPublicKey their_node_id_ref;
9955         CHECK(their_node_id->arr_len == 33);
9956         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9957         LDKInit init_conv;
9958         init_conv.inner = untag_ptr(init);
9959         init_conv.is_owned = ptr_is_owned(init);
9960         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9961         init_conv.is_owned = false;
9962         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9963         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9964         return tag_ptr(ret_conv, true);
9965 }
9966
9967 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) {
9968         void* this_arg_ptr = untag_ptr(this_arg);
9969         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9970         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9971         LDKPublicKey their_node_id_ref;
9972         CHECK(their_node_id->arr_len == 33);
9973         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9974         LDKReplyChannelRange msg_conv;
9975         msg_conv.inner = untag_ptr(msg);
9976         msg_conv.is_owned = ptr_is_owned(msg);
9977         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9978         msg_conv = ReplyChannelRange_clone(&msg_conv);
9979         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9980         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9981         return tag_ptr(ret_conv, true);
9982 }
9983
9984 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) {
9985         void* this_arg_ptr = untag_ptr(this_arg);
9986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9987         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9988         LDKPublicKey their_node_id_ref;
9989         CHECK(their_node_id->arr_len == 33);
9990         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9991         LDKReplyShortChannelIdsEnd msg_conv;
9992         msg_conv.inner = untag_ptr(msg);
9993         msg_conv.is_owned = ptr_is_owned(msg);
9994         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9995         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9996         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9997         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9998         return tag_ptr(ret_conv, true);
9999 }
10000
10001 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) {
10002         void* this_arg_ptr = untag_ptr(this_arg);
10003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10004         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10005         LDKPublicKey their_node_id_ref;
10006         CHECK(their_node_id->arr_len == 33);
10007         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10008         LDKQueryChannelRange msg_conv;
10009         msg_conv.inner = untag_ptr(msg);
10010         msg_conv.is_owned = ptr_is_owned(msg);
10011         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10012         msg_conv = QueryChannelRange_clone(&msg_conv);
10013         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10014         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10015         return tag_ptr(ret_conv, true);
10016 }
10017
10018 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) {
10019         void* this_arg_ptr = untag_ptr(this_arg);
10020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10021         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10022         LDKPublicKey their_node_id_ref;
10023         CHECK(their_node_id->arr_len == 33);
10024         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10025         LDKQueryShortChannelIds msg_conv;
10026         msg_conv.inner = untag_ptr(msg);
10027         msg_conv.is_owned = ptr_is_owned(msg);
10028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10029         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10031         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10032         return tag_ptr(ret_conv, true);
10033 }
10034
10035 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10036         void* this_arg_ptr = untag_ptr(this_arg);
10037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10038         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10039         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10040         uint64_t ret_ref = 0;
10041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10043         return ret_ref;
10044 }
10045
10046 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10047         void* this_arg_ptr = untag_ptr(this_arg);
10048         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10049         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10050         LDKPublicKey their_node_id_ref;
10051         CHECK(their_node_id->arr_len == 33);
10052         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10053         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10054         uint64_t ret_ref = 0;
10055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10057         return ret_ref;
10058 }
10059
10060 typedef struct LDKOnionMessageHandler_JCalls {
10061         atomic_size_t refcnt;
10062         uint32_t instance_ptr;
10063         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10064 } LDKOnionMessageHandler_JCalls;
10065 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10066         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10067         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10068                 FREE(j_calls);
10069         }
10070 }
10071 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10072         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10073         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10074         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10075         LDKOnionMessage msg_var = *msg;
10076         uint64_t msg_ref = 0;
10077         msg_var = OnionMessage_clone(&msg_var);
10078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10079         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10080         js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10081 }
10082 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10083         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10084         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10085         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10086         LDKInit init_var = *init;
10087         uint64_t init_ref = 0;
10088         init_var = Init_clone(&init_var);
10089         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10090         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10091         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10092         void* ret_ptr = untag_ptr(ret);
10093         CHECK_ACCESS(ret_ptr);
10094         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10095         FREE(untag_ptr(ret));
10096         return ret_conv;
10097 }
10098 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10099         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10100         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10101         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10102         jboolean no_connection_possible_conv = no_connection_possible;
10103         js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10104 }
10105 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10106         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10107         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, 0, 0, 0, 0, 0, 0);
10108         LDKNodeFeatures ret_conv;
10109         ret_conv.inner = untag_ptr(ret);
10110         ret_conv.is_owned = ptr_is_owned(ret);
10111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10112         return ret_conv;
10113 }
10114 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10115         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10116         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10117         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10118         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10119         LDKInitFeatures ret_conv;
10120         ret_conv.inner = untag_ptr(ret);
10121         ret_conv.is_owned = ptr_is_owned(ret);
10122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10123         return ret_conv;
10124 }
10125 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10126         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10127         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10128         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10129 }
10130 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10131         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10132         atomic_init(&calls->refcnt, 1);
10133         calls->instance_ptr = o;
10134
10135         LDKOnionMessageHandler ret = {
10136                 .this_arg = (void*) calls,
10137                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10138                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10139                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10140                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10141                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10142                 .free = LDKOnionMessageHandler_JCalls_free,
10143                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10144         };
10145         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10146         return ret;
10147 }
10148 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10149         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10150         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10151         return tag_ptr(res_ptr, true);
10152 }
10153 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) {
10154         void* this_arg_ptr = untag_ptr(this_arg);
10155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10156         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10157         LDKPublicKey peer_node_id_ref;
10158         CHECK(peer_node_id->arr_len == 33);
10159         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10160         LDKOnionMessage msg_conv;
10161         msg_conv.inner = untag_ptr(msg);
10162         msg_conv.is_owned = ptr_is_owned(msg);
10163         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10164         msg_conv.is_owned = false;
10165         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10166 }
10167
10168 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) {
10169         void* this_arg_ptr = untag_ptr(this_arg);
10170         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10171         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10172         LDKPublicKey their_node_id_ref;
10173         CHECK(their_node_id->arr_len == 33);
10174         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10175         LDKInit init_conv;
10176         init_conv.inner = untag_ptr(init);
10177         init_conv.is_owned = ptr_is_owned(init);
10178         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10179         init_conv.is_owned = false;
10180         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10181         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10182         return tag_ptr(ret_conv, true);
10183 }
10184
10185 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) {
10186         void* this_arg_ptr = untag_ptr(this_arg);
10187         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10188         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10189         LDKPublicKey their_node_id_ref;
10190         CHECK(their_node_id->arr_len == 33);
10191         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10192         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10193 }
10194
10195 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10196         void* this_arg_ptr = untag_ptr(this_arg);
10197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10198         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10199         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10200         uint64_t ret_ref = 0;
10201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10203         return ret_ref;
10204 }
10205
10206 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10207         void* this_arg_ptr = untag_ptr(this_arg);
10208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10209         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10210         LDKPublicKey their_node_id_ref;
10211         CHECK(their_node_id->arr_len == 33);
10212         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10213         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10214         uint64_t ret_ref = 0;
10215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10217         return ret_ref;
10218 }
10219
10220 typedef struct LDKCustomMessageReader_JCalls {
10221         atomic_size_t refcnt;
10222         uint32_t instance_ptr;
10223 } LDKCustomMessageReader_JCalls;
10224 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10225         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10226         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10227                 FREE(j_calls);
10228         }
10229 }
10230 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10231         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10232         int16_t message_type_conv = message_type;
10233         LDKu8slice buffer_var = buffer;
10234         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10235         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10236         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10237         void* ret_ptr = untag_ptr(ret);
10238         CHECK_ACCESS(ret_ptr);
10239         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10240         FREE(untag_ptr(ret));
10241         return ret_conv;
10242 }
10243 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10244         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10245         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10246 }
10247 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10248         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10249         atomic_init(&calls->refcnt, 1);
10250         calls->instance_ptr = o;
10251
10252         LDKCustomMessageReader ret = {
10253                 .this_arg = (void*) calls,
10254                 .read = read_LDKCustomMessageReader_jcall,
10255                 .free = LDKCustomMessageReader_JCalls_free,
10256         };
10257         return ret;
10258 }
10259 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10260         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10261         *res_ptr = LDKCustomMessageReader_init(o);
10262         return tag_ptr(res_ptr, true);
10263 }
10264 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10265         void* this_arg_ptr = untag_ptr(this_arg);
10266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10267         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10268         LDKu8slice buffer_ref;
10269         buffer_ref.datalen = buffer->arr_len;
10270         buffer_ref.data = buffer->elems;
10271         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10272         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10273         FREE(buffer);
10274         return tag_ptr(ret_conv, true);
10275 }
10276
10277 typedef struct LDKCustomMessageHandler_JCalls {
10278         atomic_size_t refcnt;
10279         uint32_t instance_ptr;
10280         LDKCustomMessageReader_JCalls* CustomMessageReader;
10281 } LDKCustomMessageHandler_JCalls;
10282 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10283         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10284         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10285                 FREE(j_calls);
10286         }
10287 }
10288 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10289         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10290         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10291         *msg_ret = msg;
10292         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10293         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10294         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);
10295         void* ret_ptr = untag_ptr(ret);
10296         CHECK_ACCESS(ret_ptr);
10297         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10298         FREE(untag_ptr(ret));
10299         return ret_conv;
10300 }
10301 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10302         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10303         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10304         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10305         ret_constr.datalen = ret->arr_len;
10306         if (ret_constr.datalen > 0)
10307                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10308         else
10309                 ret_constr.data = NULL;
10310         uint64_t* ret_vals = ret->elems;
10311         for (size_t z = 0; z < ret_constr.datalen; z++) {
10312                 uint64_t ret_conv_25 = ret_vals[z];
10313                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10314                 CHECK_ACCESS(ret_conv_25_ptr);
10315                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10316                 FREE(untag_ptr(ret_conv_25));
10317                 ret_constr.data[z] = ret_conv_25_conv;
10318         }
10319         FREE(ret);
10320         return ret_constr;
10321 }
10322 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10323         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10324         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10325         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10326 }
10327 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10328         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10329         atomic_init(&calls->refcnt, 1);
10330         calls->instance_ptr = o;
10331
10332         LDKCustomMessageHandler ret = {
10333                 .this_arg = (void*) calls,
10334                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10335                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10336                 .free = LDKCustomMessageHandler_JCalls_free,
10337                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10338         };
10339         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10340         return ret;
10341 }
10342 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10343         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10344         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10345         return tag_ptr(res_ptr, true);
10346 }
10347 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) {
10348         void* this_arg_ptr = untag_ptr(this_arg);
10349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10350         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10351         void* msg_ptr = untag_ptr(msg);
10352         CHECK_ACCESS(msg_ptr);
10353         LDKType msg_conv = *(LDKType*)(msg_ptr);
10354         if (msg_conv.free == LDKType_JCalls_free) {
10355                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10356                 LDKType_JCalls_cloned(&msg_conv);
10357         }
10358         LDKPublicKey sender_node_id_ref;
10359         CHECK(sender_node_id->arr_len == 33);
10360         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10361         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10362         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10363         return tag_ptr(ret_conv, true);
10364 }
10365
10366 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10367         void* this_arg_ptr = untag_ptr(this_arg);
10368         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10369         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10370         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10371         uint64_tArray ret_arr = NULL;
10372         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10373         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10374         for (size_t z = 0; z < ret_var.datalen; z++) {
10375                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10376                 *ret_conv_25_conv = ret_var.data[z];
10377                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10378         }
10379         
10380         FREE(ret_var.data);
10381         return ret_arr;
10382 }
10383
10384 typedef struct LDKCustomOnionMessageHandler_JCalls {
10385         atomic_size_t refcnt;
10386         uint32_t instance_ptr;
10387 } LDKCustomOnionMessageHandler_JCalls;
10388 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
10389         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10390         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10391                 FREE(j_calls);
10392         }
10393 }
10394 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
10395         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10396         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
10397         *msg_ret = msg;
10398         js_invoke_function_buuuuu(j_calls->instance_ptr, 106, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
10399 }
10400 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
10401         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10402         int64_t message_type_conv = message_type;
10403         LDKu8slice buffer_var = buffer;
10404         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10405         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10406         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10407         void* ret_ptr = untag_ptr(ret);
10408         CHECK_ACCESS(ret_ptr);
10409         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
10410         FREE(untag_ptr(ret));
10411         return ret_conv;
10412 }
10413 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
10414         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
10415         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10416 }
10417 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
10418         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
10419         atomic_init(&calls->refcnt, 1);
10420         calls->instance_ptr = o;
10421
10422         LDKCustomOnionMessageHandler ret = {
10423                 .this_arg = (void*) calls,
10424                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
10425                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
10426                 .free = LDKCustomOnionMessageHandler_JCalls_free,
10427         };
10428         return ret;
10429 }
10430 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
10431         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
10432         *res_ptr = LDKCustomOnionMessageHandler_init(o);
10433         return tag_ptr(res_ptr, true);
10434 }
10435 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
10436         void* this_arg_ptr = untag_ptr(this_arg);
10437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10438         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10439         void* msg_ptr = untag_ptr(msg);
10440         CHECK_ACCESS(msg_ptr);
10441         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
10442         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
10443                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10444                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
10445         }
10446         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
10447 }
10448
10449 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) {
10450         void* this_arg_ptr = untag_ptr(this_arg);
10451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10452         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10453         LDKu8slice buffer_ref;
10454         buffer_ref.datalen = buffer->arr_len;
10455         buffer_ref.data = buffer->elems;
10456         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
10457         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
10458         FREE(buffer);
10459         return tag_ptr(ret_conv, true);
10460 }
10461
10462 typedef struct LDKSocketDescriptor_JCalls {
10463         atomic_size_t refcnt;
10464         uint32_t instance_ptr;
10465 } LDKSocketDescriptor_JCalls;
10466 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10467         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10468         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10469                 FREE(j_calls);
10470         }
10471 }
10472 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10473         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10474         LDKu8slice data_var = data;
10475         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10476         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10477         jboolean resume_read_conv = resume_read;
10478         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10479 }
10480 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10481         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10482         js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0);
10483 }
10484 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10485         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10486         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10487         *other_arg_clone = SocketDescriptor_clone(other_arg);
10488         return js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10489 }
10490 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10491         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10492         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, 0, 0, 0, 0, 0, 0);
10493 }
10494 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10495         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10496         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10497 }
10498 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10499         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10500         atomic_init(&calls->refcnt, 1);
10501         calls->instance_ptr = o;
10502
10503         LDKSocketDescriptor ret = {
10504                 .this_arg = (void*) calls,
10505                 .send_data = send_data_LDKSocketDescriptor_jcall,
10506                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10507                 .eq = eq_LDKSocketDescriptor_jcall,
10508                 .hash = hash_LDKSocketDescriptor_jcall,
10509                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10510                 .free = LDKSocketDescriptor_JCalls_free,
10511         };
10512         return ret;
10513 }
10514 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10515         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10516         *res_ptr = LDKSocketDescriptor_init(o);
10517         return tag_ptr(res_ptr, true);
10518 }
10519 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10520         void* this_arg_ptr = untag_ptr(this_arg);
10521         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10522         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10523         LDKu8slice data_ref;
10524         data_ref.datalen = data->arr_len;
10525         data_ref.data = data->elems;
10526         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10527         FREE(data);
10528         return ret_conv;
10529 }
10530
10531 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10532         void* this_arg_ptr = untag_ptr(this_arg);
10533         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10534         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10535         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10536 }
10537
10538 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10539         void* this_arg_ptr = untag_ptr(this_arg);
10540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10541         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10542         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10543         return ret_conv;
10544 }
10545
10546 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10547         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10548         switch(obj->tag) {
10549                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10550                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10551                 case LDKEffectiveCapacity_Total: return 2;
10552                 case LDKEffectiveCapacity_Infinite: return 3;
10553                 case LDKEffectiveCapacity_Unknown: return 4;
10554                 default: abort();
10555         }
10556 }
10557 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10558         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10559         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10560                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10561         return liquidity_msat_conv;
10562 }
10563 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10564         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10565         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10566                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10567         return amount_msat_conv;
10568 }
10569 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10570         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10571         assert(obj->tag == LDKEffectiveCapacity_Total);
10572                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10573         return capacity_msat_conv;
10574 }
10575 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10576         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10577         assert(obj->tag == LDKEffectiveCapacity_Total);
10578                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
10579         return htlc_maximum_msat_ref;
10580 }
10581 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
10582         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10583         switch(obj->tag) {
10584                 case LDKDestination_Node: return 0;
10585                 case LDKDestination_BlindedRoute: return 1;
10586                 default: abort();
10587         }
10588 }
10589 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
10590         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10591         assert(obj->tag == LDKDestination_Node);
10592                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
10593                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
10594         return node_arr;
10595 }
10596 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedRoute_get_blinded_route"))) TS_LDKDestination_BlindedRoute_get_blinded_route(uint64_t ptr) {
10597         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10598         assert(obj->tag == LDKDestination_BlindedRoute);
10599                         LDKBlindedRoute blinded_route_var = obj->blinded_route;
10600                         uint64_t blinded_route_ref = 0;
10601                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var);
10602                         blinded_route_ref = tag_ptr(blinded_route_var.inner, false);
10603         return blinded_route_ref;
10604 }
10605 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
10606         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10607         switch(obj->tag) {
10608                 case LDKFallback_SegWitProgram: return 0;
10609                 case LDKFallback_PubKeyHash: return 1;
10610                 case LDKFallback_ScriptHash: return 2;
10611                 default: abort();
10612         }
10613 }
10614 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
10615         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10616         assert(obj->tag == LDKFallback_SegWitProgram);
10617                         uint8_t version_val = obj->seg_wit_program.version._0;
10618         return version_val;
10619 }
10620 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
10621         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10622         assert(obj->tag == LDKFallback_SegWitProgram);
10623                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10624                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10625                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
10626         return program_arr;
10627 }
10628 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
10629         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10630         assert(obj->tag == LDKFallback_PubKeyHash);
10631                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10632                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10633         return pub_key_hash_arr;
10634 }
10635 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
10636         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10637         assert(obj->tag == LDKFallback_ScriptHash);
10638                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10639                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10640         return script_hash_arr;
10641 }
10642 typedef struct LDKPayer_JCalls {
10643         atomic_size_t refcnt;
10644         uint32_t instance_ptr;
10645 } LDKPayer_JCalls;
10646 static void LDKPayer_JCalls_free(void* this_arg) {
10647         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10648         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10649                 FREE(j_calls);
10650         }
10651 }
10652 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10653         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10654         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
10655         LDKPublicKey ret_ref;
10656         CHECK(ret->arr_len == 33);
10657         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10658         return ret_ref;
10659 }
10660 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10661         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10662         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0);
10663         LDKCVec_ChannelDetailsZ ret_constr;
10664         ret_constr.datalen = ret->arr_len;
10665         if (ret_constr.datalen > 0)
10666                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10667         else
10668                 ret_constr.data = NULL;
10669         uint64_t* ret_vals = ret->elems;
10670         for (size_t q = 0; q < ret_constr.datalen; q++) {
10671                 uint64_t ret_conv_16 = ret_vals[q];
10672                 LDKChannelDetails ret_conv_16_conv;
10673                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
10674                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
10675                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10676                 ret_constr.data[q] = ret_conv_16_conv;
10677         }
10678         FREE(ret);
10679         return ret_constr;
10680 }
10681 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10682         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10683         LDKRoute route_var = *route;
10684         uint64_t route_ref = 0;
10685         route_var = Route_clone(&route_var);
10686         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10687         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10688         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10689         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10690         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10691         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10692         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);
10693         void* ret_ptr = untag_ptr(ret);
10694         CHECK_ACCESS(ret_ptr);
10695         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10696         FREE(untag_ptr(ret));
10697         return ret_conv;
10698 }
10699 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10700         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10701         LDKRoute route_var = *route;
10702         uint64_t route_ref = 0;
10703         route_var = Route_clone(&route_var);
10704         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10705         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10706         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10707         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10708         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 115, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
10709         void* ret_ptr = untag_ptr(ret);
10710         CHECK_ACCESS(ret_ptr);
10711         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10712         FREE(untag_ptr(ret));
10713         return ret_conv;
10714 }
10715 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10716         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10717         LDKRoute route_var = *route;
10718         uint64_t route_ref = 0;
10719         route_var = Route_clone(&route_var);
10720         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10721         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10722         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10723         memcpy(payment_id_arr->elems, payment_id.data, 32);
10724         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
10725         void* ret_ptr = untag_ptr(ret);
10726         CHECK_ACCESS(ret_ptr);
10727         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10728         FREE(untag_ptr(ret));
10729         return ret_conv;
10730 }
10731 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10732         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10733         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10734         memcpy(payment_id_arr->elems, payment_id.data, 32);
10735         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
10736 }
10737 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10738         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10739         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10740 }
10741 static inline LDKPayer LDKPayer_init (JSValue o) {
10742         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10743         atomic_init(&calls->refcnt, 1);
10744         calls->instance_ptr = o;
10745
10746         LDKPayer ret = {
10747                 .this_arg = (void*) calls,
10748                 .node_id = node_id_LDKPayer_jcall,
10749                 .first_hops = first_hops_LDKPayer_jcall,
10750                 .send_payment = send_payment_LDKPayer_jcall,
10751                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10752                 .retry_payment = retry_payment_LDKPayer_jcall,
10753                 .abandon_payment = abandon_payment_LDKPayer_jcall,
10754                 .free = LDKPayer_JCalls_free,
10755         };
10756         return ret;
10757 }
10758 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10759         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10760         *res_ptr = LDKPayer_init(o);
10761         return tag_ptr(res_ptr, true);
10762 }
10763 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
10764         void* this_arg_ptr = untag_ptr(this_arg);
10765         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10766         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10767         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10768         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10769         return ret_arr;
10770 }
10771
10772 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
10773         void* this_arg_ptr = untag_ptr(this_arg);
10774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10775         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10776         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10777         uint64_tArray ret_arr = NULL;
10778         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10779         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10780         for (size_t q = 0; q < ret_var.datalen; q++) {
10781                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10782                 uint64_t ret_conv_16_ref = 0;
10783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10784                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
10785                 ret_arr_ptr[q] = ret_conv_16_ref;
10786         }
10787         
10788         FREE(ret_var.data);
10789         return ret_arr;
10790 }
10791
10792 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) {
10793         void* this_arg_ptr = untag_ptr(this_arg);
10794         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10795         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10796         LDKRoute route_conv;
10797         route_conv.inner = untag_ptr(route);
10798         route_conv.is_owned = ptr_is_owned(route);
10799         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10800         route_conv.is_owned = false;
10801         LDKThirtyTwoBytes payment_hash_ref;
10802         CHECK(payment_hash->arr_len == 32);
10803         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10804         LDKThirtyTwoBytes payment_secret_ref;
10805         CHECK(payment_secret->arr_len == 32);
10806         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10807         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10808         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10809         return tag_ptr(ret_conv, true);
10810 }
10811
10812 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) {
10813         void* this_arg_ptr = untag_ptr(this_arg);
10814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10815         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10816         LDKRoute route_conv;
10817         route_conv.inner = untag_ptr(route);
10818         route_conv.is_owned = ptr_is_owned(route);
10819         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10820         route_conv.is_owned = false;
10821         LDKThirtyTwoBytes payment_preimage_ref;
10822         CHECK(payment_preimage->arr_len == 32);
10823         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10824         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10825         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10826         return tag_ptr(ret_conv, true);
10827 }
10828
10829 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
10830         void* this_arg_ptr = untag_ptr(this_arg);
10831         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10832         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10833         LDKRoute route_conv;
10834         route_conv.inner = untag_ptr(route);
10835         route_conv.is_owned = ptr_is_owned(route);
10836         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10837         route_conv.is_owned = false;
10838         LDKThirtyTwoBytes payment_id_ref;
10839         CHECK(payment_id->arr_len == 32);
10840         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10841         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10842         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10843         return tag_ptr(ret_conv, true);
10844 }
10845
10846 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
10847         void* this_arg_ptr = untag_ptr(this_arg);
10848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10849         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10850         LDKThirtyTwoBytes payment_id_ref;
10851         CHECK(payment_id->arr_len == 32);
10852         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10853         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10854 }
10855
10856 typedef struct LDKRouter_JCalls {
10857         atomic_size_t refcnt;
10858         uint32_t instance_ptr;
10859 } LDKRouter_JCalls;
10860 static void LDKRouter_JCalls_free(void* this_arg) {
10861         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10862         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10863                 FREE(j_calls);
10864         }
10865 }
10866 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) {
10867         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10868         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10869         memcpy(payer_arr->elems, payer.compressed_form, 33);
10870         LDKRouteParameters route_params_var = *route_params;
10871         uint64_t route_params_ref = 0;
10872         route_params_var = RouteParameters_clone(&route_params_var);
10873         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10874         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10875         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10876         memcpy(payment_hash_arr->elems, *payment_hash, 32);
10877         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10878         uint64_tArray first_hops_arr = NULL;
10879         if (first_hops != NULL) {
10880                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10881                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10882                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10883                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10884                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10885                         uint64_t first_hops_conv_16_ref = 0;
10886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10887                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10888                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10889                 }
10890         
10891         }
10892         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10893         uint64_t inflight_htlcs_ref = 0;
10894         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10895         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10896         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);
10897         void* ret_ptr = untag_ptr(ret);
10898         CHECK_ACCESS(ret_ptr);
10899         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10900         FREE(untag_ptr(ret));
10901         return ret_conv;
10902 }
10903 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10904         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10905         LDKCVec_RouteHopZ path_var = path;
10906         uint64_tArray path_arr = NULL;
10907         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10908         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10909         for (size_t k = 0; k < path_var.datalen; k++) {
10910                 LDKRouteHop path_conv_10_var = path_var.data[k];
10911                 uint64_t path_conv_10_ref = 0;
10912                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10913                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10914                 path_arr_ptr[k] = path_conv_10_ref;
10915         }
10916         
10917         FREE(path_var.data);
10918         int64_t short_channel_id_conv = short_channel_id;
10919         js_invoke_function_ubuuuu(j_calls->instance_ptr, 119, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10920 }
10921 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10922         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10923         LDKCVec_RouteHopZ path_var = path;
10924         uint64_tArray path_arr = NULL;
10925         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10926         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10927         for (size_t k = 0; k < path_var.datalen; k++) {
10928                 LDKRouteHop path_conv_10_var = path_var.data[k];
10929                 uint64_t path_conv_10_ref = 0;
10930                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10931                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10932                 path_arr_ptr[k] = path_conv_10_ref;
10933         }
10934         
10935         FREE(path_var.data);
10936         js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10937 }
10938 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10939         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10940         LDKCVec_RouteHopZ path_var = path;
10941         uint64_tArray path_arr = NULL;
10942         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10943         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10944         for (size_t k = 0; k < path_var.datalen; k++) {
10945                 LDKRouteHop path_conv_10_var = path_var.data[k];
10946                 uint64_t path_conv_10_ref = 0;
10947                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10948                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10949                 path_arr_ptr[k] = path_conv_10_ref;
10950         }
10951         
10952         FREE(path_var.data);
10953         js_invoke_function_uuuuuu(j_calls->instance_ptr, 121, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10954 }
10955 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10956         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10957         LDKCVec_RouteHopZ path_var = path;
10958         uint64_tArray path_arr = NULL;
10959         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10960         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10961         for (size_t k = 0; k < path_var.datalen; k++) {
10962                 LDKRouteHop path_conv_10_var = path_var.data[k];
10963                 uint64_t path_conv_10_ref = 0;
10964                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10965                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10966                 path_arr_ptr[k] = path_conv_10_ref;
10967         }
10968         
10969         FREE(path_var.data);
10970         int64_t short_channel_id_conv = short_channel_id;
10971         js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10972 }
10973 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10974         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10975         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10976 }
10977 static inline LDKRouter LDKRouter_init (JSValue o) {
10978         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10979         atomic_init(&calls->refcnt, 1);
10980         calls->instance_ptr = o;
10981
10982         LDKRouter ret = {
10983                 .this_arg = (void*) calls,
10984                 .find_route = find_route_LDKRouter_jcall,
10985                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
10986                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
10987                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
10988                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
10989                 .free = LDKRouter_JCalls_free,
10990         };
10991         return ret;
10992 }
10993 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10994         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10995         *res_ptr = LDKRouter_init(o);
10996         return tag_ptr(res_ptr, true);
10997 }
10998 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) {
10999         void* this_arg_ptr = untag_ptr(this_arg);
11000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11001         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11002         LDKPublicKey payer_ref;
11003         CHECK(payer->arr_len == 33);
11004         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11005         LDKRouteParameters route_params_conv;
11006         route_params_conv.inner = untag_ptr(route_params);
11007         route_params_conv.is_owned = ptr_is_owned(route_params);
11008         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11009         route_params_conv.is_owned = false;
11010         unsigned char payment_hash_arr[32];
11011         CHECK(payment_hash->arr_len == 32);
11012         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
11013         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11014         LDKCVec_ChannelDetailsZ first_hops_constr;
11015         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11016         if (first_hops != 0) {
11017                 first_hops_constr.datalen = first_hops->arr_len;
11018                 if (first_hops_constr.datalen > 0)
11019                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11020                 else
11021                         first_hops_constr.data = NULL;
11022                 uint64_t* first_hops_vals = first_hops->elems;
11023                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11024                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11025                         LDKChannelDetails first_hops_conv_16_conv;
11026                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11027                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11028                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11029                         first_hops_conv_16_conv.is_owned = false;
11030                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11031                 }
11032                 FREE(first_hops);
11033                 first_hops_ptr = &first_hops_constr;
11034         }
11035         LDKInFlightHtlcs inflight_htlcs_conv;
11036         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11037         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11038         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11039         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
11040         
11041         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11042         *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);
11043         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11044         return tag_ptr(ret_conv, true);
11045 }
11046
11047 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) {
11048         void* this_arg_ptr = untag_ptr(this_arg);
11049         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11050         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11051         LDKCVec_RouteHopZ path_constr;
11052         path_constr.datalen = path->arr_len;
11053         if (path_constr.datalen > 0)
11054                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11055         else
11056                 path_constr.data = NULL;
11057         uint64_t* path_vals = path->elems;
11058         for (size_t k = 0; k < path_constr.datalen; k++) {
11059                 uint64_t path_conv_10 = path_vals[k];
11060                 LDKRouteHop path_conv_10_conv;
11061                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11062                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11063                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11064                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11065                 path_constr.data[k] = path_conv_10_conv;
11066         }
11067         FREE(path);
11068         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11069 }
11070
11071 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
11072         void* this_arg_ptr = untag_ptr(this_arg);
11073         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11074         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11075         LDKCVec_RouteHopZ path_constr;
11076         path_constr.datalen = path->arr_len;
11077         if (path_constr.datalen > 0)
11078                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11079         else
11080                 path_constr.data = NULL;
11081         uint64_t* path_vals = path->elems;
11082         for (size_t k = 0; k < path_constr.datalen; k++) {
11083                 uint64_t path_conv_10 = path_vals[k];
11084                 LDKRouteHop path_conv_10_conv;
11085                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11086                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11087                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11088                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11089                 path_constr.data[k] = path_conv_10_conv;
11090         }
11091         FREE(path);
11092         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11093 }
11094
11095 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11096         void* this_arg_ptr = untag_ptr(this_arg);
11097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11098         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11099         LDKCVec_RouteHopZ path_constr;
11100         path_constr.datalen = path->arr_len;
11101         if (path_constr.datalen > 0)
11102                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11103         else
11104                 path_constr.data = NULL;
11105         uint64_t* path_vals = path->elems;
11106         for (size_t k = 0; k < path_constr.datalen; k++) {
11107                 uint64_t path_conv_10 = path_vals[k];
11108                 LDKRouteHop path_conv_10_conv;
11109                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11110                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11111                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11112                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11113                 path_constr.data[k] = path_conv_10_conv;
11114         }
11115         FREE(path);
11116         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11117 }
11118
11119 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) {
11120         void* this_arg_ptr = untag_ptr(this_arg);
11121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11122         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11123         LDKCVec_RouteHopZ path_constr;
11124         path_constr.datalen = path->arr_len;
11125         if (path_constr.datalen > 0)
11126                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11127         else
11128                 path_constr.data = NULL;
11129         uint64_t* path_vals = path->elems;
11130         for (size_t k = 0; k < path_constr.datalen; k++) {
11131                 uint64_t path_conv_10 = path_vals[k];
11132                 LDKRouteHop path_conv_10_conv;
11133                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11134                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11135                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11136                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11137                 path_constr.data[k] = path_conv_10_conv;
11138         }
11139         FREE(path);
11140         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11141 }
11142
11143 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11144         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11145         switch(obj->tag) {
11146                 case LDKRetry_Attempts: return 0;
11147                 default: abort();
11148         }
11149 }
11150 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11151         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11152         assert(obj->tag == LDKRetry_Attempts);
11153                         uint32_t attempts_conv = obj->attempts;
11154         return attempts_conv;
11155 }
11156 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11157         LDKStr ret_str = _ldk_get_compiled_version();
11158         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11159         Str_free(ret_str);
11160         return ret_conv;
11161 }
11162
11163 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11164         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11165         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11166         Str_free(ret_str);
11167         return ret_conv;
11168 }
11169
11170 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11171         LDKThirtyTwoBytes big_endian_bytes_ref;
11172         CHECK(big_endian_bytes->arr_len == 32);
11173         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11174         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11175         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11176         return tag_ptr(ret_ref, true);
11177 }
11178
11179 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11180         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11181         *ret_copy = Bech32Error_clone(arg);
11182         uint64_t ret_ref = tag_ptr(ret_copy, true);
11183         return ret_ref;
11184 }
11185 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11186         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11187         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11188         return ret_conv;
11189 }
11190
11191 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11192         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11193         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11194         *ret_copy = Bech32Error_clone(orig_conv);
11195         uint64_t ret_ref = tag_ptr(ret_copy, true);
11196         return ret_ref;
11197 }
11198
11199 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11200         if (!ptr_is_owned(o)) return;
11201         void* o_ptr = untag_ptr(o);
11202         CHECK_ACCESS(o_ptr);
11203         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11204         FREE(untag_ptr(o));
11205         Bech32Error_free(o_conv);
11206 }
11207
11208 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11209         LDKTransaction _res_ref;
11210         _res_ref.datalen = _res->arr_len;
11211         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11212         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11213         _res_ref.data_is_owned = true;
11214         Transaction_free(_res_ref);
11215 }
11216
11217 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11218         LDKCVec_u8Z script_pubkey_ref;
11219         script_pubkey_ref.datalen = script_pubkey->arr_len;
11220         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11221         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11222         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11223         *ret_ref = TxOut_new(script_pubkey_ref, value);
11224         return tag_ptr(ret_ref, true);
11225 }
11226
11227 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11228         if (!ptr_is_owned(_res)) return;
11229         void* _res_ptr = untag_ptr(_res);
11230         CHECK_ACCESS(_res_ptr);
11231         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11232         FREE(untag_ptr(_res));
11233         TxOut_free(_res_conv);
11234 }
11235
11236 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11237         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11238         *ret_ref = TxOut_clone(arg);
11239         return tag_ptr(ret_ref, true);
11240 }
11241 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11242         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11243         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11244         return ret_conv;
11245 }
11246
11247 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11248         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11249         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11250         *ret_ref = TxOut_clone(orig_conv);
11251         return tag_ptr(ret_ref, true);
11252 }
11253
11254 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11255         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11256         Str_free(dummy);
11257 }
11258
11259 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11260         LDKCVec_PublicKeyZ _res_constr;
11261         _res_constr.datalen = _res->arr_len;
11262         if (_res_constr.datalen > 0)
11263                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11264         else
11265                 _res_constr.data = NULL;
11266         int8_tArray* _res_vals = (void*) _res->elems;
11267         for (size_t m = 0; m < _res_constr.datalen; m++) {
11268                 int8_tArray _res_conv_12 = _res_vals[m];
11269                 LDKPublicKey _res_conv_12_ref;
11270                 CHECK(_res_conv_12->arr_len == 33);
11271                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11272                 _res_constr.data[m] = _res_conv_12_ref;
11273         }
11274         FREE(_res);
11275         CVec_PublicKeyZ_free(_res_constr);
11276 }
11277
11278 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_ok"))) TS_CResult_BlindedRouteNoneZ_ok(uint64_t o) {
11279         LDKBlindedRoute o_conv;
11280         o_conv.inner = untag_ptr(o);
11281         o_conv.is_owned = ptr_is_owned(o);
11282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11283         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11284         
11285         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11286         *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv);
11287         return tag_ptr(ret_conv, true);
11288 }
11289
11290 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_err"))) TS_CResult_BlindedRouteNoneZ_err() {
11291         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11292         *ret_conv = CResult_BlindedRouteNoneZ_err();
11293         return tag_ptr(ret_conv, true);
11294 }
11295
11296 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_is_ok"))) TS_CResult_BlindedRouteNoneZ_is_ok(uint64_t o) {
11297         LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o);
11298         jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv);
11299         return ret_conv;
11300 }
11301
11302 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_free"))) TS_CResult_BlindedRouteNoneZ_free(uint64_t _res) {
11303         if (!ptr_is_owned(_res)) return;
11304         void* _res_ptr = untag_ptr(_res);
11305         CHECK_ACCESS(_res_ptr);
11306         LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr);
11307         FREE(untag_ptr(_res));
11308         CResult_BlindedRouteNoneZ_free(_res_conv);
11309 }
11310
11311 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_ok(uint64_t o) {
11312         LDKBlindedRoute o_conv;
11313         o_conv.inner = untag_ptr(o);
11314         o_conv.is_owned = ptr_is_owned(o);
11315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11316         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11317         
11318         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11319         *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv);
11320         return tag_ptr(ret_conv, true);
11321 }
11322
11323 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_err"))) TS_CResult_BlindedRouteDecodeErrorZ_err(uint64_t e) {
11324         void* e_ptr = untag_ptr(e);
11325         CHECK_ACCESS(e_ptr);
11326         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11327         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11328         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11329         *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv);
11330         return tag_ptr(ret_conv, true);
11331 }
11332
11333 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_is_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_is_ok(uint64_t o) {
11334         LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o);
11335         jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv);
11336         return ret_conv;
11337 }
11338
11339 void  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_free"))) TS_CResult_BlindedRouteDecodeErrorZ_free(uint64_t _res) {
11340         if (!ptr_is_owned(_res)) return;
11341         void* _res_ptr = untag_ptr(_res);
11342         CHECK_ACCESS(_res_ptr);
11343         LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr);
11344         FREE(untag_ptr(_res));
11345         CResult_BlindedRouteDecodeErrorZ_free(_res_conv);
11346 }
11347
11348 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
11349         LDKBlindedHop o_conv;
11350         o_conv.inner = untag_ptr(o);
11351         o_conv.is_owned = ptr_is_owned(o);
11352         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11353         // WARNING: we need a move here but no clone is available for LDKBlindedHop
11354         
11355         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11356         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
11357         return tag_ptr(ret_conv, true);
11358 }
11359
11360 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
11361         void* e_ptr = untag_ptr(e);
11362         CHECK_ACCESS(e_ptr);
11363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11365         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11366         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
11367         return tag_ptr(ret_conv, true);
11368 }
11369
11370 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
11371         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
11372         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
11373         return ret_conv;
11374 }
11375
11376 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
11377         if (!ptr_is_owned(_res)) return;
11378         void* _res_ptr = untag_ptr(_res);
11379         CHECK_ACCESS(_res_ptr);
11380         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
11381         FREE(untag_ptr(_res));
11382         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
11383 }
11384
11385 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11386         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11387         *ret_conv = CResult_NoneNoneZ_ok();
11388         return tag_ptr(ret_conv, true);
11389 }
11390
11391 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11392         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11393         *ret_conv = CResult_NoneNoneZ_err();
11394         return tag_ptr(ret_conv, true);
11395 }
11396
11397 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11398         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11399         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11400         return ret_conv;
11401 }
11402
11403 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11404         if (!ptr_is_owned(_res)) return;
11405         void* _res_ptr = untag_ptr(_res);
11406         CHECK_ACCESS(_res_ptr);
11407         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11408         FREE(untag_ptr(_res));
11409         CResult_NoneNoneZ_free(_res_conv);
11410 }
11411
11412 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11413         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11414         *ret_conv = CResult_NoneNoneZ_clone(arg);
11415         return tag_ptr(ret_conv, true);
11416 }
11417 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11418         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11419         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11420         return ret_conv;
11421 }
11422
11423 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11424         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11425         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11426         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11427         return tag_ptr(ret_conv, true);
11428 }
11429
11430 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11431         LDKCounterpartyCommitmentSecrets o_conv;
11432         o_conv.inner = untag_ptr(o);
11433         o_conv.is_owned = ptr_is_owned(o);
11434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11435         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11436         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11437         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11438         return tag_ptr(ret_conv, true);
11439 }
11440
11441 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11442         void* e_ptr = untag_ptr(e);
11443         CHECK_ACCESS(e_ptr);
11444         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11445         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11446         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11447         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11448         return tag_ptr(ret_conv, true);
11449 }
11450
11451 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11452         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11453         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11454         return ret_conv;
11455 }
11456
11457 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11458         if (!ptr_is_owned(_res)) return;
11459         void* _res_ptr = untag_ptr(_res);
11460         CHECK_ACCESS(_res_ptr);
11461         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11462         FREE(untag_ptr(_res));
11463         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11464 }
11465
11466 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11467         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11468         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11469         return tag_ptr(ret_conv, true);
11470 }
11471 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11472         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11473         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11474         return ret_conv;
11475 }
11476
11477 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11478         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11479         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11480         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11481         return tag_ptr(ret_conv, true);
11482 }
11483
11484 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11485         LDKSecretKey o_ref;
11486         CHECK(o->arr_len == 32);
11487         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11488         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11489         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11490         return tag_ptr(ret_conv, true);
11491 }
11492
11493 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11494         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11495         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11496         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11497         return tag_ptr(ret_conv, true);
11498 }
11499
11500 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
11501         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
11502         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11503         return ret_conv;
11504 }
11505
11506 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
11507         if (!ptr_is_owned(_res)) return;
11508         void* _res_ptr = untag_ptr(_res);
11509         CHECK_ACCESS(_res_ptr);
11510         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11511         FREE(untag_ptr(_res));
11512         CResult_SecretKeyErrorZ_free(_res_conv);
11513 }
11514
11515 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11516         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11517         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11518         return tag_ptr(ret_conv, true);
11519 }
11520 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
11521         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
11522         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11523         return ret_conv;
11524 }
11525
11526 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
11527         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
11528         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11529         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11530         return tag_ptr(ret_conv, true);
11531 }
11532
11533 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11534         LDKPublicKey o_ref;
11535         CHECK(o->arr_len == 33);
11536         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11537         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11538         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11539         return tag_ptr(ret_conv, true);
11540 }
11541
11542 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11543         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11544         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11545         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11546         return tag_ptr(ret_conv, true);
11547 }
11548
11549 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
11550         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
11551         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11552         return ret_conv;
11553 }
11554
11555 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
11556         if (!ptr_is_owned(_res)) return;
11557         void* _res_ptr = untag_ptr(_res);
11558         CHECK_ACCESS(_res_ptr);
11559         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11560         FREE(untag_ptr(_res));
11561         CResult_PublicKeyErrorZ_free(_res_conv);
11562 }
11563
11564 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11565         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11566         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11567         return tag_ptr(ret_conv, true);
11568 }
11569 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
11570         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
11571         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11572         return ret_conv;
11573 }
11574
11575 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
11576         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
11577         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11578         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11579         return tag_ptr(ret_conv, true);
11580 }
11581
11582 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11583         LDKTxCreationKeys o_conv;
11584         o_conv.inner = untag_ptr(o);
11585         o_conv.is_owned = ptr_is_owned(o);
11586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11587         o_conv = TxCreationKeys_clone(&o_conv);
11588         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11589         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11590         return tag_ptr(ret_conv, true);
11591 }
11592
11593 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11594         void* e_ptr = untag_ptr(e);
11595         CHECK_ACCESS(e_ptr);
11596         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11597         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11598         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11599         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11600         return tag_ptr(ret_conv, true);
11601 }
11602
11603 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11604         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11605         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11606         return ret_conv;
11607 }
11608
11609 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11610         if (!ptr_is_owned(_res)) return;
11611         void* _res_ptr = untag_ptr(_res);
11612         CHECK_ACCESS(_res_ptr);
11613         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11614         FREE(untag_ptr(_res));
11615         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11616 }
11617
11618 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11619         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11620         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11621         return tag_ptr(ret_conv, true);
11622 }
11623 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11624         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11625         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11626         return ret_conv;
11627 }
11628
11629 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11630         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11631         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11632         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11633         return tag_ptr(ret_conv, true);
11634 }
11635
11636 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11637         LDKChannelPublicKeys o_conv;
11638         o_conv.inner = untag_ptr(o);
11639         o_conv.is_owned = ptr_is_owned(o);
11640         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11641         o_conv = ChannelPublicKeys_clone(&o_conv);
11642         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11643         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11644         return tag_ptr(ret_conv, true);
11645 }
11646
11647 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11648         void* e_ptr = untag_ptr(e);
11649         CHECK_ACCESS(e_ptr);
11650         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11651         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11652         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11653         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11654         return tag_ptr(ret_conv, true);
11655 }
11656
11657 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11658         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11659         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11660         return ret_conv;
11661 }
11662
11663 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11664         if (!ptr_is_owned(_res)) return;
11665         void* _res_ptr = untag_ptr(_res);
11666         CHECK_ACCESS(_res_ptr);
11667         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11668         FREE(untag_ptr(_res));
11669         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11670 }
11671
11672 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11673         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11674         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11675         return tag_ptr(ret_conv, true);
11676 }
11677 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11678         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11679         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11680         return ret_conv;
11681 }
11682
11683 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11684         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11685         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11686         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11687         return tag_ptr(ret_conv, true);
11688 }
11689
11690 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
11691         LDKTxCreationKeys o_conv;
11692         o_conv.inner = untag_ptr(o);
11693         o_conv.is_owned = ptr_is_owned(o);
11694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11695         o_conv = TxCreationKeys_clone(&o_conv);
11696         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11697         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11698         return tag_ptr(ret_conv, true);
11699 }
11700
11701 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11702         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11703         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11704         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11705         return tag_ptr(ret_conv, true);
11706 }
11707
11708 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
11709         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
11710         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11711         return ret_conv;
11712 }
11713
11714 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
11715         if (!ptr_is_owned(_res)) return;
11716         void* _res_ptr = untag_ptr(_res);
11717         CHECK_ACCESS(_res_ptr);
11718         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11719         FREE(untag_ptr(_res));
11720         CResult_TxCreationKeysErrorZ_free(_res_conv);
11721 }
11722
11723 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11724         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11725         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11726         return tag_ptr(ret_conv, true);
11727 }
11728 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
11729         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
11730         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11731         return ret_conv;
11732 }
11733
11734 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
11735         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
11736         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11737         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11738         return tag_ptr(ret_conv, true);
11739 }
11740
11741 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11742         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11743         *ret_copy = COption_u32Z_some(o);
11744         uint64_t ret_ref = tag_ptr(ret_copy, true);
11745         return ret_ref;
11746 }
11747
11748 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11749         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11750         *ret_copy = COption_u32Z_none();
11751         uint64_t ret_ref = tag_ptr(ret_copy, true);
11752         return ret_ref;
11753 }
11754
11755 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11756         if (!ptr_is_owned(_res)) return;
11757         void* _res_ptr = untag_ptr(_res);
11758         CHECK_ACCESS(_res_ptr);
11759         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11760         FREE(untag_ptr(_res));
11761         COption_u32Z_free(_res_conv);
11762 }
11763
11764 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11765         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11766         *ret_copy = COption_u32Z_clone(arg);
11767         uint64_t ret_ref = tag_ptr(ret_copy, true);
11768         return ret_ref;
11769 }
11770 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11771         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11772         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11773         return ret_conv;
11774 }
11775
11776 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11777         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11778         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11779         *ret_copy = COption_u32Z_clone(orig_conv);
11780         uint64_t ret_ref = tag_ptr(ret_copy, true);
11781         return ret_ref;
11782 }
11783
11784 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11785         LDKHTLCOutputInCommitment o_conv;
11786         o_conv.inner = untag_ptr(o);
11787         o_conv.is_owned = ptr_is_owned(o);
11788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11789         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11790         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11791         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11792         return tag_ptr(ret_conv, true);
11793 }
11794
11795 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11796         void* e_ptr = untag_ptr(e);
11797         CHECK_ACCESS(e_ptr);
11798         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11799         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11800         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11801         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11802         return tag_ptr(ret_conv, true);
11803 }
11804
11805 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11806         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11807         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11808         return ret_conv;
11809 }
11810
11811 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11812         if (!ptr_is_owned(_res)) return;
11813         void* _res_ptr = untag_ptr(_res);
11814         CHECK_ACCESS(_res_ptr);
11815         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11816         FREE(untag_ptr(_res));
11817         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11818 }
11819
11820 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11821         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11822         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11823         return tag_ptr(ret_conv, true);
11824 }
11825 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
11826         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
11827         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11828         return ret_conv;
11829 }
11830
11831 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
11832         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
11833         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11834         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11835         return tag_ptr(ret_conv, true);
11836 }
11837
11838 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11839         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11840         return ret_conv;
11841 }
11842
11843 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11844         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11845         return ret_conv;
11846 }
11847
11848 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11849         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11850         COption_NoneZ_free(_res_conv);
11851 }
11852
11853 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11854         LDKCounterpartyChannelTransactionParameters o_conv;
11855         o_conv.inner = untag_ptr(o);
11856         o_conv.is_owned = ptr_is_owned(o);
11857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11858         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11859         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11860         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11861         return tag_ptr(ret_conv, true);
11862 }
11863
11864 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11865         void* e_ptr = untag_ptr(e);
11866         CHECK_ACCESS(e_ptr);
11867         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11868         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11869         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11870         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11871         return tag_ptr(ret_conv, true);
11872 }
11873
11874 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11875         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11876         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11877         return ret_conv;
11878 }
11879
11880 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11881         if (!ptr_is_owned(_res)) return;
11882         void* _res_ptr = untag_ptr(_res);
11883         CHECK_ACCESS(_res_ptr);
11884         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11885         FREE(untag_ptr(_res));
11886         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11887 }
11888
11889 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11890         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11891         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11892         return tag_ptr(ret_conv, true);
11893 }
11894 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11895         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11896         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11897         return ret_conv;
11898 }
11899
11900 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11901         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11902         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11903         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11904         return tag_ptr(ret_conv, true);
11905 }
11906
11907 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11908         LDKChannelTransactionParameters o_conv;
11909         o_conv.inner = untag_ptr(o);
11910         o_conv.is_owned = ptr_is_owned(o);
11911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11912         o_conv = ChannelTransactionParameters_clone(&o_conv);
11913         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11914         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11915         return tag_ptr(ret_conv, true);
11916 }
11917
11918 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11919         void* e_ptr = untag_ptr(e);
11920         CHECK_ACCESS(e_ptr);
11921         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11922         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11923         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11924         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11925         return tag_ptr(ret_conv, true);
11926 }
11927
11928 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11929         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11930         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11931         return ret_conv;
11932 }
11933
11934 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11935         if (!ptr_is_owned(_res)) return;
11936         void* _res_ptr = untag_ptr(_res);
11937         CHECK_ACCESS(_res_ptr);
11938         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11939         FREE(untag_ptr(_res));
11940         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11941 }
11942
11943 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11944         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11945         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11946         return tag_ptr(ret_conv, true);
11947 }
11948 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11949         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11950         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11951         return ret_conv;
11952 }
11953
11954 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11955         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11956         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11957         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11958         return tag_ptr(ret_conv, true);
11959 }
11960
11961 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11962         LDKCVec_SignatureZ _res_constr;
11963         _res_constr.datalen = _res->arr_len;
11964         if (_res_constr.datalen > 0)
11965                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11966         else
11967                 _res_constr.data = NULL;
11968         int8_tArray* _res_vals = (void*) _res->elems;
11969         for (size_t m = 0; m < _res_constr.datalen; m++) {
11970                 int8_tArray _res_conv_12 = _res_vals[m];
11971                 LDKSignature _res_conv_12_ref;
11972                 CHECK(_res_conv_12->arr_len == 64);
11973                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11974                 _res_constr.data[m] = _res_conv_12_ref;
11975         }
11976         FREE(_res);
11977         CVec_SignatureZ_free(_res_constr);
11978 }
11979
11980 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11981         LDKHolderCommitmentTransaction o_conv;
11982         o_conv.inner = untag_ptr(o);
11983         o_conv.is_owned = ptr_is_owned(o);
11984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11985         o_conv = HolderCommitmentTransaction_clone(&o_conv);
11986         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11987         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11988         return tag_ptr(ret_conv, true);
11989 }
11990
11991 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11992         void* e_ptr = untag_ptr(e);
11993         CHECK_ACCESS(e_ptr);
11994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11996         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11997         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11998         return tag_ptr(ret_conv, true);
11999 }
12000
12001 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12002         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12003         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12004         return ret_conv;
12005 }
12006
12007 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12008         if (!ptr_is_owned(_res)) return;
12009         void* _res_ptr = untag_ptr(_res);
12010         CHECK_ACCESS(_res_ptr);
12011         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12012         FREE(untag_ptr(_res));
12013         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12014 }
12015
12016 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12017         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12018         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12019         return tag_ptr(ret_conv, true);
12020 }
12021 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12022         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12023         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12024         return ret_conv;
12025 }
12026
12027 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12028         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12029         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12030         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12031         return tag_ptr(ret_conv, true);
12032 }
12033
12034 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12035         LDKBuiltCommitmentTransaction o_conv;
12036         o_conv.inner = untag_ptr(o);
12037         o_conv.is_owned = ptr_is_owned(o);
12038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12039         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12040         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12041         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12042         return tag_ptr(ret_conv, true);
12043 }
12044
12045 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12046         void* e_ptr = untag_ptr(e);
12047         CHECK_ACCESS(e_ptr);
12048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12050         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12051         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12052         return tag_ptr(ret_conv, true);
12053 }
12054
12055 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12056         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12057         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12058         return ret_conv;
12059 }
12060
12061 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12062         if (!ptr_is_owned(_res)) return;
12063         void* _res_ptr = untag_ptr(_res);
12064         CHECK_ACCESS(_res_ptr);
12065         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12066         FREE(untag_ptr(_res));
12067         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12068 }
12069
12070 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12071         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12072         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12073         return tag_ptr(ret_conv, true);
12074 }
12075 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12076         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12077         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12078         return ret_conv;
12079 }
12080
12081 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12082         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12083         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12084         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12085         return tag_ptr(ret_conv, true);
12086 }
12087
12088 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12089         LDKTrustedClosingTransaction o_conv;
12090         o_conv.inner = untag_ptr(o);
12091         o_conv.is_owned = ptr_is_owned(o);
12092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12093         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12094         
12095         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12096         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12097         return tag_ptr(ret_conv, true);
12098 }
12099
12100 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12101         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12102         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12103         return tag_ptr(ret_conv, true);
12104 }
12105
12106 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12107         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12108         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12109         return ret_conv;
12110 }
12111
12112 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12113         if (!ptr_is_owned(_res)) return;
12114         void* _res_ptr = untag_ptr(_res);
12115         CHECK_ACCESS(_res_ptr);
12116         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12117         FREE(untag_ptr(_res));
12118         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12119 }
12120
12121 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12122         LDKCommitmentTransaction o_conv;
12123         o_conv.inner = untag_ptr(o);
12124         o_conv.is_owned = ptr_is_owned(o);
12125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12126         o_conv = CommitmentTransaction_clone(&o_conv);
12127         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12128         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12129         return tag_ptr(ret_conv, true);
12130 }
12131
12132 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12133         void* e_ptr = untag_ptr(e);
12134         CHECK_ACCESS(e_ptr);
12135         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12136         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12137         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12138         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12139         return tag_ptr(ret_conv, true);
12140 }
12141
12142 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12143         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12144         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12145         return ret_conv;
12146 }
12147
12148 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12149         if (!ptr_is_owned(_res)) return;
12150         void* _res_ptr = untag_ptr(_res);
12151         CHECK_ACCESS(_res_ptr);
12152         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12153         FREE(untag_ptr(_res));
12154         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12155 }
12156
12157 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12158         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12159         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12160         return tag_ptr(ret_conv, true);
12161 }
12162 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12163         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12164         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12165         return ret_conv;
12166 }
12167
12168 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12169         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12170         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12171         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12172         return tag_ptr(ret_conv, true);
12173 }
12174
12175 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12176         LDKTrustedCommitmentTransaction o_conv;
12177         o_conv.inner = untag_ptr(o);
12178         o_conv.is_owned = ptr_is_owned(o);
12179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12180         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12181         
12182         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12183         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12184         return tag_ptr(ret_conv, true);
12185 }
12186
12187 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12188         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12189         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12190         return tag_ptr(ret_conv, true);
12191 }
12192
12193 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12194         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12195         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12196         return ret_conv;
12197 }
12198
12199 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12200         if (!ptr_is_owned(_res)) return;
12201         void* _res_ptr = untag_ptr(_res);
12202         CHECK_ACCESS(_res_ptr);
12203         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12204         FREE(untag_ptr(_res));
12205         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12206 }
12207
12208 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12209         LDKCVec_SignatureZ o_constr;
12210         o_constr.datalen = o->arr_len;
12211         if (o_constr.datalen > 0)
12212                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12213         else
12214                 o_constr.data = NULL;
12215         int8_tArray* o_vals = (void*) o->elems;
12216         for (size_t m = 0; m < o_constr.datalen; m++) {
12217                 int8_tArray o_conv_12 = o_vals[m];
12218                 LDKSignature o_conv_12_ref;
12219                 CHECK(o_conv_12->arr_len == 64);
12220                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12221                 o_constr.data[m] = o_conv_12_ref;
12222         }
12223         FREE(o);
12224         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12225         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12226         return tag_ptr(ret_conv, true);
12227 }
12228
12229 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12230         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12231         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12232         return tag_ptr(ret_conv, true);
12233 }
12234
12235 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12236         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12237         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12238         return ret_conv;
12239 }
12240
12241 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12242         if (!ptr_is_owned(_res)) return;
12243         void* _res_ptr = untag_ptr(_res);
12244         CHECK_ACCESS(_res_ptr);
12245         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12246         FREE(untag_ptr(_res));
12247         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12248 }
12249
12250 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12251         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12252         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12253         return tag_ptr(ret_conv, true);
12254 }
12255 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12256         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12257         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12258         return ret_conv;
12259 }
12260
12261 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12262         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12263         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12264         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12265         return tag_ptr(ret_conv, true);
12266 }
12267
12268 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12269         LDKShutdownScript o_conv;
12270         o_conv.inner = untag_ptr(o);
12271         o_conv.is_owned = ptr_is_owned(o);
12272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12273         o_conv = ShutdownScript_clone(&o_conv);
12274         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12275         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12276         return tag_ptr(ret_conv, true);
12277 }
12278
12279 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12280         void* e_ptr = untag_ptr(e);
12281         CHECK_ACCESS(e_ptr);
12282         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12283         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12284         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12285         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12286         return tag_ptr(ret_conv, true);
12287 }
12288
12289 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12290         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12291         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12292         return ret_conv;
12293 }
12294
12295 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12296         if (!ptr_is_owned(_res)) return;
12297         void* _res_ptr = untag_ptr(_res);
12298         CHECK_ACCESS(_res_ptr);
12299         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12300         FREE(untag_ptr(_res));
12301         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12302 }
12303
12304 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12305         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12306         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12307         return tag_ptr(ret_conv, true);
12308 }
12309 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12310         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12311         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12312         return ret_conv;
12313 }
12314
12315 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12316         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12317         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12318         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12319         return tag_ptr(ret_conv, true);
12320 }
12321
12322 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12323         LDKShutdownScript o_conv;
12324         o_conv.inner = untag_ptr(o);
12325         o_conv.is_owned = ptr_is_owned(o);
12326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12327         o_conv = ShutdownScript_clone(&o_conv);
12328         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12329         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12330         return tag_ptr(ret_conv, true);
12331 }
12332
12333 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12334         LDKInvalidShutdownScript e_conv;
12335         e_conv.inner = untag_ptr(e);
12336         e_conv.is_owned = ptr_is_owned(e);
12337         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12338         e_conv = InvalidShutdownScript_clone(&e_conv);
12339         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12340         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12341         return tag_ptr(ret_conv, true);
12342 }
12343
12344 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12345         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12346         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12347         return ret_conv;
12348 }
12349
12350 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12351         if (!ptr_is_owned(_res)) return;
12352         void* _res_ptr = untag_ptr(_res);
12353         CHECK_ACCESS(_res_ptr);
12354         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12355         FREE(untag_ptr(_res));
12356         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12357 }
12358
12359 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12360         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12361         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12362         return tag_ptr(ret_conv, true);
12363 }
12364 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12365         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12366         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12367         return ret_conv;
12368 }
12369
12370 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12371         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12372         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12373         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12374         return tag_ptr(ret_conv, true);
12375 }
12376
12377 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12378         LDKRouteHop o_conv;
12379         o_conv.inner = untag_ptr(o);
12380         o_conv.is_owned = ptr_is_owned(o);
12381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12382         o_conv = RouteHop_clone(&o_conv);
12383         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12384         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12385         return tag_ptr(ret_conv, true);
12386 }
12387
12388 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12389         void* e_ptr = untag_ptr(e);
12390         CHECK_ACCESS(e_ptr);
12391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12393         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12394         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12395         return tag_ptr(ret_conv, true);
12396 }
12397
12398 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12399         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12400         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12401         return ret_conv;
12402 }
12403
12404 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12405         if (!ptr_is_owned(_res)) return;
12406         void* _res_ptr = untag_ptr(_res);
12407         CHECK_ACCESS(_res_ptr);
12408         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12409         FREE(untag_ptr(_res));
12410         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12411 }
12412
12413 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12414         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12415         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12416         return tag_ptr(ret_conv, true);
12417 }
12418 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12419         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12420         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12421         return ret_conv;
12422 }
12423
12424 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12425         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12426         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12427         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12428         return tag_ptr(ret_conv, true);
12429 }
12430
12431 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12432         LDKCVec_RouteHopZ _res_constr;
12433         _res_constr.datalen = _res->arr_len;
12434         if (_res_constr.datalen > 0)
12435                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12436         else
12437                 _res_constr.data = NULL;
12438         uint64_t* _res_vals = _res->elems;
12439         for (size_t k = 0; k < _res_constr.datalen; k++) {
12440                 uint64_t _res_conv_10 = _res_vals[k];
12441                 LDKRouteHop _res_conv_10_conv;
12442                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12443                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12444                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12445                 _res_constr.data[k] = _res_conv_10_conv;
12446         }
12447         FREE(_res);
12448         CVec_RouteHopZ_free(_res_constr);
12449 }
12450
12451 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12452         LDKCVec_CVec_RouteHopZZ _res_constr;
12453         _res_constr.datalen = _res->arr_len;
12454         if (_res_constr.datalen > 0)
12455                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12456         else
12457                 _res_constr.data = NULL;
12458         uint64_tArray* _res_vals = (void*) _res->elems;
12459         for (size_t m = 0; m < _res_constr.datalen; m++) {
12460                 uint64_tArray _res_conv_12 = _res_vals[m];
12461                 LDKCVec_RouteHopZ _res_conv_12_constr;
12462                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12463                 if (_res_conv_12_constr.datalen > 0)
12464                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12465                 else
12466                         _res_conv_12_constr.data = NULL;
12467                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
12468                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12469                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12470                         LDKRouteHop _res_conv_12_conv_10_conv;
12471                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
12472                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
12473                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12474                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12475                 }
12476                 FREE(_res_conv_12);
12477                 _res_constr.data[m] = _res_conv_12_constr;
12478         }
12479         FREE(_res);
12480         CVec_CVec_RouteHopZZ_free(_res_constr);
12481 }
12482
12483 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
12484         LDKRoute o_conv;
12485         o_conv.inner = untag_ptr(o);
12486         o_conv.is_owned = ptr_is_owned(o);
12487         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12488         o_conv = Route_clone(&o_conv);
12489         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12490         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12491         return tag_ptr(ret_conv, true);
12492 }
12493
12494 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
12495         void* e_ptr = untag_ptr(e);
12496         CHECK_ACCESS(e_ptr);
12497         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12498         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12499         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12500         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12501         return tag_ptr(ret_conv, true);
12502 }
12503
12504 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
12505         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
12506         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12507         return ret_conv;
12508 }
12509
12510 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
12511         if (!ptr_is_owned(_res)) return;
12512         void* _res_ptr = untag_ptr(_res);
12513         CHECK_ACCESS(_res_ptr);
12514         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12515         FREE(untag_ptr(_res));
12516         CResult_RouteDecodeErrorZ_free(_res_conv);
12517 }
12518
12519 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12520         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12521         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12522         return tag_ptr(ret_conv, true);
12523 }
12524 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
12525         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
12526         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12527         return ret_conv;
12528 }
12529
12530 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
12531         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
12532         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12533         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12534         return tag_ptr(ret_conv, true);
12535 }
12536
12537 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
12538         LDKRouteParameters o_conv;
12539         o_conv.inner = untag_ptr(o);
12540         o_conv.is_owned = ptr_is_owned(o);
12541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12542         o_conv = RouteParameters_clone(&o_conv);
12543         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12544         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12545         return tag_ptr(ret_conv, true);
12546 }
12547
12548 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
12549         void* e_ptr = untag_ptr(e);
12550         CHECK_ACCESS(e_ptr);
12551         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12552         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12553         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12554         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12555         return tag_ptr(ret_conv, true);
12556 }
12557
12558 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
12559         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
12560         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12561         return ret_conv;
12562 }
12563
12564 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
12565         if (!ptr_is_owned(_res)) return;
12566         void* _res_ptr = untag_ptr(_res);
12567         CHECK_ACCESS(_res_ptr);
12568         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12569         FREE(untag_ptr(_res));
12570         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12571 }
12572
12573 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12574         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12575         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12576         return tag_ptr(ret_conv, true);
12577 }
12578 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12579         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
12580         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12581         return ret_conv;
12582 }
12583
12584 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
12585         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
12586         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12587         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12588         return tag_ptr(ret_conv, true);
12589 }
12590
12591 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
12592         LDKCVec_RouteHintZ _res_constr;
12593         _res_constr.datalen = _res->arr_len;
12594         if (_res_constr.datalen > 0)
12595                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12596         else
12597                 _res_constr.data = NULL;
12598         uint64_t* _res_vals = _res->elems;
12599         for (size_t l = 0; l < _res_constr.datalen; l++) {
12600                 uint64_t _res_conv_11 = _res_vals[l];
12601                 LDKRouteHint _res_conv_11_conv;
12602                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
12603                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
12604                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12605                 _res_constr.data[l] = _res_conv_11_conv;
12606         }
12607         FREE(_res);
12608         CVec_RouteHintZ_free(_res_constr);
12609 }
12610
12611 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12612         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12613         *ret_copy = COption_u64Z_some(o);
12614         uint64_t ret_ref = tag_ptr(ret_copy, true);
12615         return ret_ref;
12616 }
12617
12618 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12619         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12620         *ret_copy = COption_u64Z_none();
12621         uint64_t ret_ref = tag_ptr(ret_copy, true);
12622         return ret_ref;
12623 }
12624
12625 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12626         if (!ptr_is_owned(_res)) return;
12627         void* _res_ptr = untag_ptr(_res);
12628         CHECK_ACCESS(_res_ptr);
12629         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12630         FREE(untag_ptr(_res));
12631         COption_u64Z_free(_res_conv);
12632 }
12633
12634 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12635         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12636         *ret_copy = COption_u64Z_clone(arg);
12637         uint64_t ret_ref = tag_ptr(ret_copy, true);
12638         return ret_ref;
12639 }
12640 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12641         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12642         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12643         return ret_conv;
12644 }
12645
12646 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12647         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12648         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12649         *ret_copy = COption_u64Z_clone(orig_conv);
12650         uint64_t ret_ref = tag_ptr(ret_copy, true);
12651         return ret_ref;
12652 }
12653
12654 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12655         LDKCVec_u64Z _res_constr;
12656         _res_constr.datalen = _res->arr_len;
12657         if (_res_constr.datalen > 0)
12658                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12659         else
12660                 _res_constr.data = NULL;
12661         int64_t* _res_vals = _res->elems;
12662         for (size_t i = 0; i < _res_constr.datalen; i++) {
12663                 int64_t _res_conv_8 = _res_vals[i];
12664                 _res_constr.data[i] = _res_conv_8;
12665         }
12666         FREE(_res);
12667         CVec_u64Z_free(_res_constr);
12668 }
12669
12670 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
12671         LDKPaymentParameters o_conv;
12672         o_conv.inner = untag_ptr(o);
12673         o_conv.is_owned = ptr_is_owned(o);
12674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12675         o_conv = PaymentParameters_clone(&o_conv);
12676         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12677         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12678         return tag_ptr(ret_conv, true);
12679 }
12680
12681 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
12682         void* e_ptr = untag_ptr(e);
12683         CHECK_ACCESS(e_ptr);
12684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12686         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12687         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12688         return tag_ptr(ret_conv, true);
12689 }
12690
12691 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
12692         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
12693         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12694         return ret_conv;
12695 }
12696
12697 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
12698         if (!ptr_is_owned(_res)) return;
12699         void* _res_ptr = untag_ptr(_res);
12700         CHECK_ACCESS(_res_ptr);
12701         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12702         FREE(untag_ptr(_res));
12703         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12704 }
12705
12706 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12707         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12708         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12709         return tag_ptr(ret_conv, true);
12710 }
12711 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12712         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
12713         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12714         return ret_conv;
12715 }
12716
12717 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
12718         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
12719         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12720         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12721         return tag_ptr(ret_conv, true);
12722 }
12723
12724 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
12725         LDKCVec_RouteHintHopZ _res_constr;
12726         _res_constr.datalen = _res->arr_len;
12727         if (_res_constr.datalen > 0)
12728                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12729         else
12730                 _res_constr.data = NULL;
12731         uint64_t* _res_vals = _res->elems;
12732         for (size_t o = 0; o < _res_constr.datalen; o++) {
12733                 uint64_t _res_conv_14 = _res_vals[o];
12734                 LDKRouteHintHop _res_conv_14_conv;
12735                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
12736                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
12737                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12738                 _res_constr.data[o] = _res_conv_14_conv;
12739         }
12740         FREE(_res);
12741         CVec_RouteHintHopZ_free(_res_constr);
12742 }
12743
12744 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
12745         LDKRouteHint o_conv;
12746         o_conv.inner = untag_ptr(o);
12747         o_conv.is_owned = ptr_is_owned(o);
12748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12749         o_conv = RouteHint_clone(&o_conv);
12750         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12751         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12752         return tag_ptr(ret_conv, true);
12753 }
12754
12755 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
12756         void* e_ptr = untag_ptr(e);
12757         CHECK_ACCESS(e_ptr);
12758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12760         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12761         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12762         return tag_ptr(ret_conv, true);
12763 }
12764
12765 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
12766         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
12767         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12768         return ret_conv;
12769 }
12770
12771 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
12772         if (!ptr_is_owned(_res)) return;
12773         void* _res_ptr = untag_ptr(_res);
12774         CHECK_ACCESS(_res_ptr);
12775         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12776         FREE(untag_ptr(_res));
12777         CResult_RouteHintDecodeErrorZ_free(_res_conv);
12778 }
12779
12780 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12781         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12782         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12783         return tag_ptr(ret_conv, true);
12784 }
12785 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
12786         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
12787         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12788         return ret_conv;
12789 }
12790
12791 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
12792         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
12793         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12794         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12795         return tag_ptr(ret_conv, true);
12796 }
12797
12798 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
12799         LDKRouteHintHop o_conv;
12800         o_conv.inner = untag_ptr(o);
12801         o_conv.is_owned = ptr_is_owned(o);
12802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12803         o_conv = RouteHintHop_clone(&o_conv);
12804         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12805         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12806         return tag_ptr(ret_conv, true);
12807 }
12808
12809 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
12810         void* e_ptr = untag_ptr(e);
12811         CHECK_ACCESS(e_ptr);
12812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12814         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12815         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12816         return tag_ptr(ret_conv, true);
12817 }
12818
12819 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
12820         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
12821         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12822         return ret_conv;
12823 }
12824
12825 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
12826         if (!ptr_is_owned(_res)) return;
12827         void* _res_ptr = untag_ptr(_res);
12828         CHECK_ACCESS(_res_ptr);
12829         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12830         FREE(untag_ptr(_res));
12831         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12832 }
12833
12834 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12835         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12836         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12837         return tag_ptr(ret_conv, true);
12838 }
12839 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12840         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
12841         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12842         return ret_conv;
12843 }
12844
12845 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
12846         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
12847         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12848         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12849         return tag_ptr(ret_conv, true);
12850 }
12851
12852 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12853         LDKCVec_ChannelDetailsZ _res_constr;
12854         _res_constr.datalen = _res->arr_len;
12855         if (_res_constr.datalen > 0)
12856                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12857         else
12858                 _res_constr.data = NULL;
12859         uint64_t* _res_vals = _res->elems;
12860         for (size_t q = 0; q < _res_constr.datalen; q++) {
12861                 uint64_t _res_conv_16 = _res_vals[q];
12862                 LDKChannelDetails _res_conv_16_conv;
12863                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12864                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12866                 _res_constr.data[q] = _res_conv_16_conv;
12867         }
12868         FREE(_res);
12869         CVec_ChannelDetailsZ_free(_res_constr);
12870 }
12871
12872 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12873         LDKRoute o_conv;
12874         o_conv.inner = untag_ptr(o);
12875         o_conv.is_owned = ptr_is_owned(o);
12876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12877         o_conv = Route_clone(&o_conv);
12878         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12879         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12880         return tag_ptr(ret_conv, true);
12881 }
12882
12883 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12884         LDKLightningError e_conv;
12885         e_conv.inner = untag_ptr(e);
12886         e_conv.is_owned = ptr_is_owned(e);
12887         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12888         e_conv = LightningError_clone(&e_conv);
12889         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12890         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12891         return tag_ptr(ret_conv, true);
12892 }
12893
12894 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12895         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12896         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12897         return ret_conv;
12898 }
12899
12900 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12901         if (!ptr_is_owned(_res)) return;
12902         void* _res_ptr = untag_ptr(_res);
12903         CHECK_ACCESS(_res_ptr);
12904         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12905         FREE(untag_ptr(_res));
12906         CResult_RouteLightningErrorZ_free(_res_conv);
12907 }
12908
12909 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12910         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12911         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12912         return tag_ptr(ret_conv, true);
12913 }
12914 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12915         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12916         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12917         return ret_conv;
12918 }
12919
12920 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12921         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12922         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12923         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12924         return tag_ptr(ret_conv, true);
12925 }
12926
12927 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
12928         void* o_ptr = untag_ptr(o);
12929         CHECK_ACCESS(o_ptr);
12930         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12931         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
12932         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12933         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12934         return tag_ptr(ret_conv, true);
12935 }
12936
12937 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
12938         void* e_ptr = untag_ptr(e);
12939         CHECK_ACCESS(e_ptr);
12940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12942         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12943         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12944         return tag_ptr(ret_conv, true);
12945 }
12946
12947 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
12948         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
12949         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12950         return ret_conv;
12951 }
12952
12953 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
12954         if (!ptr_is_owned(_res)) return;
12955         void* _res_ptr = untag_ptr(_res);
12956         CHECK_ACCESS(_res_ptr);
12957         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12958         FREE(untag_ptr(_res));
12959         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12960 }
12961
12962 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12963         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12964         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12965         return tag_ptr(ret_conv, true);
12966 }
12967 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
12968         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
12969         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12970         return ret_conv;
12971 }
12972
12973 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
12974         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
12975         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12976         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12977         return tag_ptr(ret_conv, true);
12978 }
12979
12980 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
12981         void* o_ptr = untag_ptr(o);
12982         CHECK_ACCESS(o_ptr);
12983         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12984         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
12985         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12986         *ret_copy = COption_ClosureReasonZ_some(o_conv);
12987         uint64_t ret_ref = tag_ptr(ret_copy, true);
12988         return ret_ref;
12989 }
12990
12991 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12992         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12993         *ret_copy = COption_ClosureReasonZ_none();
12994         uint64_t ret_ref = tag_ptr(ret_copy, true);
12995         return ret_ref;
12996 }
12997
12998 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
12999         if (!ptr_is_owned(_res)) return;
13000         void* _res_ptr = untag_ptr(_res);
13001         CHECK_ACCESS(_res_ptr);
13002         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13003         FREE(untag_ptr(_res));
13004         COption_ClosureReasonZ_free(_res_conv);
13005 }
13006
13007 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13008         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13009         *ret_copy = COption_ClosureReasonZ_clone(arg);
13010         uint64_t ret_ref = tag_ptr(ret_copy, true);
13011         return ret_ref;
13012 }
13013 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13014         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13015         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13016         return ret_conv;
13017 }
13018
13019 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13020         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13021         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13022         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13023         uint64_t ret_ref = tag_ptr(ret_copy, true);
13024         return ret_ref;
13025 }
13026
13027 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13028         void* o_ptr = untag_ptr(o);
13029         CHECK_ACCESS(o_ptr);
13030         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13031         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13032         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13033         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13034         return tag_ptr(ret_conv, true);
13035 }
13036
13037 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13038         void* e_ptr = untag_ptr(e);
13039         CHECK_ACCESS(e_ptr);
13040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13042         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13043         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13044         return tag_ptr(ret_conv, true);
13045 }
13046
13047 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13048         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13049         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13050         return ret_conv;
13051 }
13052
13053 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13054         if (!ptr_is_owned(_res)) return;
13055         void* _res_ptr = untag_ptr(_res);
13056         CHECK_ACCESS(_res_ptr);
13057         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13058         FREE(untag_ptr(_res));
13059         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13060 }
13061
13062 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13063         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13064         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13065         return tag_ptr(ret_conv, true);
13066 }
13067 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13068         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13069         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13070         return ret_conv;
13071 }
13072
13073 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13074         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13075         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13076         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13077         return tag_ptr(ret_conv, true);
13078 }
13079
13080 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13081         void* o_ptr = untag_ptr(o);
13082         CHECK_ACCESS(o_ptr);
13083         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13084         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13085         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13086         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13087         uint64_t ret_ref = tag_ptr(ret_copy, true);
13088         return ret_ref;
13089 }
13090
13091 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13092         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13093         *ret_copy = COption_HTLCDestinationZ_none();
13094         uint64_t ret_ref = tag_ptr(ret_copy, true);
13095         return ret_ref;
13096 }
13097
13098 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13099         if (!ptr_is_owned(_res)) return;
13100         void* _res_ptr = untag_ptr(_res);
13101         CHECK_ACCESS(_res_ptr);
13102         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13103         FREE(untag_ptr(_res));
13104         COption_HTLCDestinationZ_free(_res_conv);
13105 }
13106
13107 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13108         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13109         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13110         uint64_t ret_ref = tag_ptr(ret_copy, true);
13111         return ret_ref;
13112 }
13113 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13114         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13115         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13116         return ret_conv;
13117 }
13118
13119 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13120         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13121         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13122         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13123         uint64_t ret_ref = tag_ptr(ret_copy, true);
13124         return ret_ref;
13125 }
13126
13127 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13128         void* o_ptr = untag_ptr(o);
13129         CHECK_ACCESS(o_ptr);
13130         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13131         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13132         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13133         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13134         return tag_ptr(ret_conv, true);
13135 }
13136
13137 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13138         void* e_ptr = untag_ptr(e);
13139         CHECK_ACCESS(e_ptr);
13140         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13141         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13142         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13143         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13144         return tag_ptr(ret_conv, true);
13145 }
13146
13147 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13148         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13149         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13150         return ret_conv;
13151 }
13152
13153 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13154         if (!ptr_is_owned(_res)) return;
13155         void* _res_ptr = untag_ptr(_res);
13156         CHECK_ACCESS(_res_ptr);
13157         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13158         FREE(untag_ptr(_res));
13159         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13160 }
13161
13162 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13163         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13164         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13165         return tag_ptr(ret_conv, true);
13166 }
13167 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13168         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13169         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13170         return ret_conv;
13171 }
13172
13173 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13174         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13175         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13176         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13177         return tag_ptr(ret_conv, true);
13178 }
13179
13180 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13181         void* o_ptr = untag_ptr(o);
13182         CHECK_ACCESS(o_ptr);
13183         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13184         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13185         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13186         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13187         uint64_t ret_ref = tag_ptr(ret_copy, true);
13188         return ret_ref;
13189 }
13190
13191 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13192         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13193         *ret_copy = COption_NetworkUpdateZ_none();
13194         uint64_t ret_ref = tag_ptr(ret_copy, true);
13195         return ret_ref;
13196 }
13197
13198 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13199         if (!ptr_is_owned(_res)) return;
13200         void* _res_ptr = untag_ptr(_res);
13201         CHECK_ACCESS(_res_ptr);
13202         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13203         FREE(untag_ptr(_res));
13204         COption_NetworkUpdateZ_free(_res_conv);
13205 }
13206
13207 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13208         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13209         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13210         uint64_t ret_ref = tag_ptr(ret_copy, true);
13211         return ret_ref;
13212 }
13213 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13214         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13215         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13216         return ret_conv;
13217 }
13218
13219 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13220         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13221         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13222         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13223         uint64_t ret_ref = tag_ptr(ret_copy, true);
13224         return ret_ref;
13225 }
13226
13227 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13228         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13229         _res_constr.datalen = _res->arr_len;
13230         if (_res_constr.datalen > 0)
13231                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13232         else
13233                 _res_constr.data = NULL;
13234         uint64_t* _res_vals = _res->elems;
13235         for (size_t b = 0; b < _res_constr.datalen; b++) {
13236                 uint64_t _res_conv_27 = _res_vals[b];
13237                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13238                 CHECK_ACCESS(_res_conv_27_ptr);
13239                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13240                 FREE(untag_ptr(_res_conv_27));
13241                 _res_constr.data[b] = _res_conv_27_conv;
13242         }
13243         FREE(_res);
13244         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13245 }
13246
13247 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13248         void* o_ptr = untag_ptr(o);
13249         CHECK_ACCESS(o_ptr);
13250         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13251         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13252         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13253         *ret_copy = COption_EventZ_some(o_conv);
13254         uint64_t ret_ref = tag_ptr(ret_copy, true);
13255         return ret_ref;
13256 }
13257
13258 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13259         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13260         *ret_copy = COption_EventZ_none();
13261         uint64_t ret_ref = tag_ptr(ret_copy, true);
13262         return ret_ref;
13263 }
13264
13265 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13266         if (!ptr_is_owned(_res)) return;
13267         void* _res_ptr = untag_ptr(_res);
13268         CHECK_ACCESS(_res_ptr);
13269         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13270         FREE(untag_ptr(_res));
13271         COption_EventZ_free(_res_conv);
13272 }
13273
13274 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13275         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13276         *ret_copy = COption_EventZ_clone(arg);
13277         uint64_t ret_ref = tag_ptr(ret_copy, true);
13278         return ret_ref;
13279 }
13280 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13281         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13282         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13283         return ret_conv;
13284 }
13285
13286 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13287         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13288         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13289         *ret_copy = COption_EventZ_clone(orig_conv);
13290         uint64_t ret_ref = tag_ptr(ret_copy, true);
13291         return ret_ref;
13292 }
13293
13294 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13295         void* o_ptr = untag_ptr(o);
13296         CHECK_ACCESS(o_ptr);
13297         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13298         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13299         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13300         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13301         return tag_ptr(ret_conv, true);
13302 }
13303
13304 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13305         void* e_ptr = untag_ptr(e);
13306         CHECK_ACCESS(e_ptr);
13307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13309         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13310         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13311         return tag_ptr(ret_conv, true);
13312 }
13313
13314 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13315         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13316         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13317         return ret_conv;
13318 }
13319
13320 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13321         if (!ptr_is_owned(_res)) return;
13322         void* _res_ptr = untag_ptr(_res);
13323         CHECK_ACCESS(_res_ptr);
13324         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13325         FREE(untag_ptr(_res));
13326         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13327 }
13328
13329 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13330         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13331         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13332         return tag_ptr(ret_conv, true);
13333 }
13334 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13335         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13336         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13337         return ret_conv;
13338 }
13339
13340 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13341         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13342         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13343         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13344         return tag_ptr(ret_conv, true);
13345 }
13346
13347 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13348         LDKCVec_MessageSendEventZ _res_constr;
13349         _res_constr.datalen = _res->arr_len;
13350         if (_res_constr.datalen > 0)
13351                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13352         else
13353                 _res_constr.data = NULL;
13354         uint64_t* _res_vals = _res->elems;
13355         for (size_t s = 0; s < _res_constr.datalen; s++) {
13356                 uint64_t _res_conv_18 = _res_vals[s];
13357                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13358                 CHECK_ACCESS(_res_conv_18_ptr);
13359                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13360                 FREE(untag_ptr(_res_conv_18));
13361                 _res_constr.data[s] = _res_conv_18_conv;
13362         }
13363         FREE(_res);
13364         CVec_MessageSendEventZ_free(_res_constr);
13365 }
13366
13367 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13368         void* o_ptr = untag_ptr(o);
13369         CHECK_ACCESS(o_ptr);
13370         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13371         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13372         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13373         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13374         return tag_ptr(ret_conv, true);
13375 }
13376
13377 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13378         LDKAccessError e_conv = LDKAccessError_from_js(e);
13379         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13380         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13381         return tag_ptr(ret_conv, true);
13382 }
13383
13384 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13385         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13386         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13387         return ret_conv;
13388 }
13389
13390 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13391         if (!ptr_is_owned(_res)) return;
13392         void* _res_ptr = untag_ptr(_res);
13393         CHECK_ACCESS(_res_ptr);
13394         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13395         FREE(untag_ptr(_res));
13396         CResult_TxOutAccessErrorZ_free(_res_conv);
13397 }
13398
13399 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13400         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13401         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13402         return tag_ptr(ret_conv, true);
13403 }
13404 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13405         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13406         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13407         return ret_conv;
13408 }
13409
13410 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13411         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13412         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13413         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13414         return tag_ptr(ret_conv, true);
13415 }
13416
13417 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13418         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13419         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13420         return tag_ptr(ret_conv, true);
13421 }
13422 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13423         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13424         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13425         return ret_conv;
13426 }
13427
13428 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13429         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13430         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13431         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13432         return tag_ptr(ret_conv, true);
13433 }
13434
13435 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13436         LDKTransaction b_ref;
13437         b_ref.datalen = b->arr_len;
13438         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13439         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13440         b_ref.data_is_owned = true;
13441         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13442         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13443         return tag_ptr(ret_conv, true);
13444 }
13445
13446 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13447         if (!ptr_is_owned(_res)) return;
13448         void* _res_ptr = untag_ptr(_res);
13449         CHECK_ACCESS(_res_ptr);
13450         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13451         FREE(untag_ptr(_res));
13452         C2Tuple_usizeTransactionZ_free(_res_conv);
13453 }
13454
13455 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13456         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13457         _res_constr.datalen = _res->arr_len;
13458         if (_res_constr.datalen > 0)
13459                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13460         else
13461                 _res_constr.data = NULL;
13462         uint64_t* _res_vals = _res->elems;
13463         for (size_t c = 0; c < _res_constr.datalen; c++) {
13464                 uint64_t _res_conv_28 = _res_vals[c];
13465                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13466                 CHECK_ACCESS(_res_conv_28_ptr);
13467                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13468                 FREE(untag_ptr(_res_conv_28));
13469                 _res_constr.data[c] = _res_conv_28_conv;
13470         }
13471         FREE(_res);
13472         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13473 }
13474
13475 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13476         LDKCVec_TxidZ _res_constr;
13477         _res_constr.datalen = _res->arr_len;
13478         if (_res_constr.datalen > 0)
13479                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13480         else
13481                 _res_constr.data = NULL;
13482         int8_tArray* _res_vals = (void*) _res->elems;
13483         for (size_t m = 0; m < _res_constr.datalen; m++) {
13484                 int8_tArray _res_conv_12 = _res_vals[m];
13485                 LDKThirtyTwoBytes _res_conv_12_ref;
13486                 CHECK(_res_conv_12->arr_len == 32);
13487                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13488                 _res_constr.data[m] = _res_conv_12_ref;
13489         }
13490         FREE(_res);
13491         CVec_TxidZ_free(_res_constr);
13492 }
13493
13494 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13495         LDKCVec_MonitorEventZ _res_constr;
13496         _res_constr.datalen = _res->arr_len;
13497         if (_res_constr.datalen > 0)
13498                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13499         else
13500                 _res_constr.data = NULL;
13501         uint64_t* _res_vals = _res->elems;
13502         for (size_t o = 0; o < _res_constr.datalen; o++) {
13503                 uint64_t _res_conv_14 = _res_vals[o];
13504                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13505                 CHECK_ACCESS(_res_conv_14_ptr);
13506                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13507                 FREE(untag_ptr(_res_conv_14));
13508                 _res_constr.data[o] = _res_conv_14_conv;
13509         }
13510         FREE(_res);
13511         CVec_MonitorEventZ_free(_res_constr);
13512 }
13513
13514 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13515         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13516         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13517         return tag_ptr(ret_conv, true);
13518 }
13519 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13520         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13521         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13522         return ret_conv;
13523 }
13524
13525 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13526         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13527         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13528         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13529         return tag_ptr(ret_conv, true);
13530 }
13531
13532 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
13533         LDKOutPoint a_conv;
13534         a_conv.inner = untag_ptr(a);
13535         a_conv.is_owned = ptr_is_owned(a);
13536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13537         a_conv = OutPoint_clone(&a_conv);
13538         LDKCVec_MonitorEventZ b_constr;
13539         b_constr.datalen = b->arr_len;
13540         if (b_constr.datalen > 0)
13541                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13542         else
13543                 b_constr.data = NULL;
13544         uint64_t* b_vals = b->elems;
13545         for (size_t o = 0; o < b_constr.datalen; o++) {
13546                 uint64_t b_conv_14 = b_vals[o];
13547                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
13548                 CHECK_ACCESS(b_conv_14_ptr);
13549                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13550                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
13551                 b_constr.data[o] = b_conv_14_conv;
13552         }
13553         FREE(b);
13554         LDKPublicKey c_ref;
13555         CHECK(c->arr_len == 33);
13556         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
13557         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13558         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
13559         return tag_ptr(ret_conv, true);
13560 }
13561
13562 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
13563         if (!ptr_is_owned(_res)) return;
13564         void* _res_ptr = untag_ptr(_res);
13565         CHECK_ACCESS(_res_ptr);
13566         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
13567         FREE(untag_ptr(_res));
13568         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
13569 }
13570
13571 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
13572         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
13573         _res_constr.datalen = _res->arr_len;
13574         if (_res_constr.datalen > 0)
13575                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
13576         else
13577                 _res_constr.data = NULL;
13578         uint64_t* _res_vals = _res->elems;
13579         for (size_t x = 0; x < _res_constr.datalen; x++) {
13580                 uint64_t _res_conv_49 = _res_vals[x];
13581                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
13582                 CHECK_ACCESS(_res_conv_49_ptr);
13583                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
13584                 FREE(untag_ptr(_res_conv_49));
13585                 _res_constr.data[x] = _res_conv_49_conv;
13586         }
13587         FREE(_res);
13588         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
13589 }
13590
13591 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
13592         LDKFixedPenaltyScorer o_conv;
13593         o_conv.inner = untag_ptr(o);
13594         o_conv.is_owned = ptr_is_owned(o);
13595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13596         o_conv = FixedPenaltyScorer_clone(&o_conv);
13597         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13598         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13599         return tag_ptr(ret_conv, true);
13600 }
13601
13602 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
13603         void* e_ptr = untag_ptr(e);
13604         CHECK_ACCESS(e_ptr);
13605         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13606         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13607         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13608         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13609         return tag_ptr(ret_conv, true);
13610 }
13611
13612 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
13613         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
13614         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13615         return ret_conv;
13616 }
13617
13618 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
13619         if (!ptr_is_owned(_res)) return;
13620         void* _res_ptr = untag_ptr(_res);
13621         CHECK_ACCESS(_res_ptr);
13622         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13623         FREE(untag_ptr(_res));
13624         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13625 }
13626
13627 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13628         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13629         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13630         return tag_ptr(ret_conv, true);
13631 }
13632 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
13633         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
13634         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13635         return ret_conv;
13636 }
13637
13638 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
13639         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
13640         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13641         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13642         return tag_ptr(ret_conv, true);
13643 }
13644
13645 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
13646         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13647         *ret_conv = C2Tuple_u64u64Z_clone(arg);
13648         return tag_ptr(ret_conv, true);
13649 }
13650 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
13651         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
13652         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
13653         return ret_conv;
13654 }
13655
13656 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
13657         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
13658         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13659         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
13660         return tag_ptr(ret_conv, true);
13661 }
13662
13663 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
13664         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13665         *ret_conv = C2Tuple_u64u64Z_new(a, b);
13666         return tag_ptr(ret_conv, true);
13667 }
13668
13669 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
13670         if (!ptr_is_owned(_res)) return;
13671         void* _res_ptr = untag_ptr(_res);
13672         CHECK_ACCESS(_res_ptr);
13673         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
13674         FREE(untag_ptr(_res));
13675         C2Tuple_u64u64Z_free(_res_conv);
13676 }
13677
13678 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
13679         void* o_ptr = untag_ptr(o);
13680         CHECK_ACCESS(o_ptr);
13681         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
13682         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
13683         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13684         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
13685         uint64_t ret_ref = tag_ptr(ret_copy, true);
13686         return ret_ref;
13687 }
13688
13689 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
13690         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13691         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
13692         uint64_t ret_ref = tag_ptr(ret_copy, true);
13693         return ret_ref;
13694 }
13695
13696 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
13697         if (!ptr_is_owned(_res)) return;
13698         void* _res_ptr = untag_ptr(_res);
13699         CHECK_ACCESS(_res_ptr);
13700         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
13701         FREE(untag_ptr(_res));
13702         COption_C2Tuple_u64u64ZZ_free(_res_conv);
13703 }
13704
13705 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
13706         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13707         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
13708         uint64_t ret_ref = tag_ptr(ret_copy, true);
13709         return ret_ref;
13710 }
13711 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
13712         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
13713         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
13714         return ret_conv;
13715 }
13716
13717 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
13718         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
13719         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13720         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
13721         uint64_t ret_ref = tag_ptr(ret_copy, true);
13722         return ret_ref;
13723 }
13724
13725 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
13726         LDKCVec_NodeIdZ _res_constr;
13727         _res_constr.datalen = _res->arr_len;
13728         if (_res_constr.datalen > 0)
13729                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
13730         else
13731                 _res_constr.data = NULL;
13732         uint64_t* _res_vals = _res->elems;
13733         for (size_t i = 0; i < _res_constr.datalen; i++) {
13734                 uint64_t _res_conv_8 = _res_vals[i];
13735                 LDKNodeId _res_conv_8_conv;
13736                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
13737                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
13738                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
13739                 _res_constr.data[i] = _res_conv_8_conv;
13740         }
13741         FREE(_res);
13742         CVec_NodeIdZ_free(_res_constr);
13743 }
13744
13745 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
13746         LDKProbabilisticScorer o_conv;
13747         o_conv.inner = untag_ptr(o);
13748         o_conv.is_owned = ptr_is_owned(o);
13749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13750         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13751         
13752         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13753         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13754         return tag_ptr(ret_conv, true);
13755 }
13756
13757 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
13758         void* e_ptr = untag_ptr(e);
13759         CHECK_ACCESS(e_ptr);
13760         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13761         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13762         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13763         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13764         return tag_ptr(ret_conv, true);
13765 }
13766
13767 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
13768         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
13769         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13770         return ret_conv;
13771 }
13772
13773 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
13774         if (!ptr_is_owned(_res)) return;
13775         void* _res_ptr = untag_ptr(_res);
13776         CHECK_ACCESS(_res_ptr);
13777         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13778         FREE(untag_ptr(_res));
13779         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13780 }
13781
13782 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
13783         LDKInitFeatures o_conv;
13784         o_conv.inner = untag_ptr(o);
13785         o_conv.is_owned = ptr_is_owned(o);
13786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13787         o_conv = InitFeatures_clone(&o_conv);
13788         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13789         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13790         return tag_ptr(ret_conv, true);
13791 }
13792
13793 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
13794         void* e_ptr = untag_ptr(e);
13795         CHECK_ACCESS(e_ptr);
13796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13798         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13799         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13800         return tag_ptr(ret_conv, true);
13801 }
13802
13803 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13804         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
13805         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13806         return ret_conv;
13807 }
13808
13809 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
13810         if (!ptr_is_owned(_res)) return;
13811         void* _res_ptr = untag_ptr(_res);
13812         CHECK_ACCESS(_res_ptr);
13813         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13814         FREE(untag_ptr(_res));
13815         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13816 }
13817
13818 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13819         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13820         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13821         return tag_ptr(ret_conv, true);
13822 }
13823 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13824         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
13825         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13826         return ret_conv;
13827 }
13828
13829 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
13830         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
13831         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13832         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13833         return tag_ptr(ret_conv, true);
13834 }
13835
13836 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
13837         LDKChannelFeatures o_conv;
13838         o_conv.inner = untag_ptr(o);
13839         o_conv.is_owned = ptr_is_owned(o);
13840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13841         o_conv = ChannelFeatures_clone(&o_conv);
13842         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13843         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13844         return tag_ptr(ret_conv, true);
13845 }
13846
13847 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
13848         void* e_ptr = untag_ptr(e);
13849         CHECK_ACCESS(e_ptr);
13850         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13851         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13852         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13853         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13854         return tag_ptr(ret_conv, true);
13855 }
13856
13857 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13858         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
13859         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13860         return ret_conv;
13861 }
13862
13863 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
13864         if (!ptr_is_owned(_res)) return;
13865         void* _res_ptr = untag_ptr(_res);
13866         CHECK_ACCESS(_res_ptr);
13867         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13868         FREE(untag_ptr(_res));
13869         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13870 }
13871
13872 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13873         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13874         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13875         return tag_ptr(ret_conv, true);
13876 }
13877 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13878         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
13879         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13880         return ret_conv;
13881 }
13882
13883 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
13884         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
13885         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13886         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13887         return tag_ptr(ret_conv, true);
13888 }
13889
13890 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
13891         LDKNodeFeatures o_conv;
13892         o_conv.inner = untag_ptr(o);
13893         o_conv.is_owned = ptr_is_owned(o);
13894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13895         o_conv = NodeFeatures_clone(&o_conv);
13896         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13897         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13898         return tag_ptr(ret_conv, true);
13899 }
13900
13901 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
13902         void* e_ptr = untag_ptr(e);
13903         CHECK_ACCESS(e_ptr);
13904         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13905         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13906         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13907         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13908         return tag_ptr(ret_conv, true);
13909 }
13910
13911 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13912         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
13913         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13914         return ret_conv;
13915 }
13916
13917 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
13918         if (!ptr_is_owned(_res)) return;
13919         void* _res_ptr = untag_ptr(_res);
13920         CHECK_ACCESS(_res_ptr);
13921         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13922         FREE(untag_ptr(_res));
13923         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13924 }
13925
13926 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13927         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13928         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13929         return tag_ptr(ret_conv, true);
13930 }
13931 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13932         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
13933         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13934         return ret_conv;
13935 }
13936
13937 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
13938         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
13939         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13940         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13941         return tag_ptr(ret_conv, true);
13942 }
13943
13944 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
13945         LDKInvoiceFeatures o_conv;
13946         o_conv.inner = untag_ptr(o);
13947         o_conv.is_owned = ptr_is_owned(o);
13948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13949         o_conv = InvoiceFeatures_clone(&o_conv);
13950         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13951         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13952         return tag_ptr(ret_conv, true);
13953 }
13954
13955 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
13956         void* e_ptr = untag_ptr(e);
13957         CHECK_ACCESS(e_ptr);
13958         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13959         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13960         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13961         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13962         return tag_ptr(ret_conv, true);
13963 }
13964
13965 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13966         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
13967         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13968         return ret_conv;
13969 }
13970
13971 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
13972         if (!ptr_is_owned(_res)) return;
13973         void* _res_ptr = untag_ptr(_res);
13974         CHECK_ACCESS(_res_ptr);
13975         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13976         FREE(untag_ptr(_res));
13977         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13978 }
13979
13980 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13981         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13982         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13983         return tag_ptr(ret_conv, true);
13984 }
13985 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13986         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
13987         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13988         return ret_conv;
13989 }
13990
13991 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
13992         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
13993         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13994         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13995         return tag_ptr(ret_conv, true);
13996 }
13997
13998 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
13999         LDKChannelTypeFeatures o_conv;
14000         o_conv.inner = untag_ptr(o);
14001         o_conv.is_owned = ptr_is_owned(o);
14002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14003         o_conv = ChannelTypeFeatures_clone(&o_conv);
14004         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14005         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14006         return tag_ptr(ret_conv, true);
14007 }
14008
14009 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14010         void* e_ptr = untag_ptr(e);
14011         CHECK_ACCESS(e_ptr);
14012         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14013         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14014         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14015         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14016         return tag_ptr(ret_conv, true);
14017 }
14018
14019 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14020         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14021         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14022         return ret_conv;
14023 }
14024
14025 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14026         if (!ptr_is_owned(_res)) return;
14027         void* _res_ptr = untag_ptr(_res);
14028         CHECK_ACCESS(_res_ptr);
14029         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14030         FREE(untag_ptr(_res));
14031         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14032 }
14033
14034 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14035         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14036         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14037         return tag_ptr(ret_conv, true);
14038 }
14039 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14040         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14041         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14042         return ret_conv;
14043 }
14044
14045 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14046         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14047         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14048         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14049         return tag_ptr(ret_conv, true);
14050 }
14051
14052 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14053         LDKNodeId o_conv;
14054         o_conv.inner = untag_ptr(o);
14055         o_conv.is_owned = ptr_is_owned(o);
14056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14057         o_conv = NodeId_clone(&o_conv);
14058         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14059         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14060         return tag_ptr(ret_conv, true);
14061 }
14062
14063 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14064         void* e_ptr = untag_ptr(e);
14065         CHECK_ACCESS(e_ptr);
14066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14068         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14069         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14070         return tag_ptr(ret_conv, true);
14071 }
14072
14073 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14074         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14075         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14076         return ret_conv;
14077 }
14078
14079 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14080         if (!ptr_is_owned(_res)) return;
14081         void* _res_ptr = untag_ptr(_res);
14082         CHECK_ACCESS(_res_ptr);
14083         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14084         FREE(untag_ptr(_res));
14085         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14086 }
14087
14088 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14089         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14090         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14091         return tag_ptr(ret_conv, true);
14092 }
14093 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14094         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14095         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14096         return ret_conv;
14097 }
14098
14099 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14100         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14101         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14102         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14103         return tag_ptr(ret_conv, true);
14104 }
14105
14106 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14107         void* o_ptr = untag_ptr(o);
14108         CHECK_ACCESS(o_ptr);
14109         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14110         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14111         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14112         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14113         return tag_ptr(ret_conv, true);
14114 }
14115
14116 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14117         void* e_ptr = untag_ptr(e);
14118         CHECK_ACCESS(e_ptr);
14119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14121         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14122         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14123         return tag_ptr(ret_conv, true);
14124 }
14125
14126 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14127         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14128         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14129         return ret_conv;
14130 }
14131
14132 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14133         if (!ptr_is_owned(_res)) return;
14134         void* _res_ptr = untag_ptr(_res);
14135         CHECK_ACCESS(_res_ptr);
14136         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14137         FREE(untag_ptr(_res));
14138         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14139 }
14140
14141 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14142         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14143         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14144         return tag_ptr(ret_conv, true);
14145 }
14146 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14147         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14148         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14149         return ret_conv;
14150 }
14151
14152 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14153         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14154         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14155         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14156         return tag_ptr(ret_conv, true);
14157 }
14158
14159 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14160         void* o_ptr = untag_ptr(o);
14161         CHECK_ACCESS(o_ptr);
14162         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14163         if (o_conv.free == LDKAccess_JCalls_free) {
14164                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14165                 LDKAccess_JCalls_cloned(&o_conv);
14166         }
14167         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14168         *ret_copy = COption_AccessZ_some(o_conv);
14169         uint64_t ret_ref = tag_ptr(ret_copy, true);
14170         return ret_ref;
14171 }
14172
14173 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14174         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14175         *ret_copy = COption_AccessZ_none();
14176         uint64_t ret_ref = tag_ptr(ret_copy, true);
14177         return ret_ref;
14178 }
14179
14180 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14181         if (!ptr_is_owned(_res)) return;
14182         void* _res_ptr = untag_ptr(_res);
14183         CHECK_ACCESS(_res_ptr);
14184         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14185         FREE(untag_ptr(_res));
14186         COption_AccessZ_free(_res_conv);
14187 }
14188
14189 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14190         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14191         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14192         return tag_ptr(ret_conv, true);
14193 }
14194
14195 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14196         LDKLightningError e_conv;
14197         e_conv.inner = untag_ptr(e);
14198         e_conv.is_owned = ptr_is_owned(e);
14199         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14200         e_conv = LightningError_clone(&e_conv);
14201         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14202         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14203         return tag_ptr(ret_conv, true);
14204 }
14205
14206 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14207         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14208         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14209         return ret_conv;
14210 }
14211
14212 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14213         if (!ptr_is_owned(_res)) return;
14214         void* _res_ptr = untag_ptr(_res);
14215         CHECK_ACCESS(_res_ptr);
14216         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14217         FREE(untag_ptr(_res));
14218         CResult_boolLightningErrorZ_free(_res_conv);
14219 }
14220
14221 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14222         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14223         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14224         return tag_ptr(ret_conv, true);
14225 }
14226 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14227         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14228         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14229         return ret_conv;
14230 }
14231
14232 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14233         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14234         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14235         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14236         return tag_ptr(ret_conv, true);
14237 }
14238
14239 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14240         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14241         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14242         return tag_ptr(ret_conv, true);
14243 }
14244 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14245         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14246         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14247         return ret_conv;
14248 }
14249
14250 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14251         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14252         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14253         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14254         return tag_ptr(ret_conv, true);
14255 }
14256
14257 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14258         LDKChannelAnnouncement a_conv;
14259         a_conv.inner = untag_ptr(a);
14260         a_conv.is_owned = ptr_is_owned(a);
14261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14262         a_conv = ChannelAnnouncement_clone(&a_conv);
14263         LDKChannelUpdate b_conv;
14264         b_conv.inner = untag_ptr(b);
14265         b_conv.is_owned = ptr_is_owned(b);
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14267         b_conv = ChannelUpdate_clone(&b_conv);
14268         LDKChannelUpdate c_conv;
14269         c_conv.inner = untag_ptr(c);
14270         c_conv.is_owned = ptr_is_owned(c);
14271         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14272         c_conv = ChannelUpdate_clone(&c_conv);
14273         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14274         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14275         return tag_ptr(ret_conv, true);
14276 }
14277
14278 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14279         if (!ptr_is_owned(_res)) return;
14280         void* _res_ptr = untag_ptr(_res);
14281         CHECK_ACCESS(_res_ptr);
14282         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14283         FREE(untag_ptr(_res));
14284         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14285 }
14286
14287 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14288         void* o_ptr = untag_ptr(o);
14289         CHECK_ACCESS(o_ptr);
14290         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14291         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14292         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14293         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14294         uint64_t ret_ref = tag_ptr(ret_copy, true);
14295         return ret_ref;
14296 }
14297
14298 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14299         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14300         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14301         uint64_t ret_ref = tag_ptr(ret_copy, true);
14302         return ret_ref;
14303 }
14304
14305 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14306         if (!ptr_is_owned(_res)) return;
14307         void* _res_ptr = untag_ptr(_res);
14308         CHECK_ACCESS(_res_ptr);
14309         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14310         FREE(untag_ptr(_res));
14311         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14312 }
14313
14314 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14315         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14316         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14317         uint64_t ret_ref = tag_ptr(ret_copy, true);
14318         return ret_ref;
14319 }
14320 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14321         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14322         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14323         return ret_conv;
14324 }
14325
14326 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14327         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14328         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14329         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14330         uint64_t ret_ref = tag_ptr(ret_copy, true);
14331         return ret_ref;
14332 }
14333
14334 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14335         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14336         *ret_conv = CResult_NoneLightningErrorZ_ok();
14337         return tag_ptr(ret_conv, true);
14338 }
14339
14340 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14341         LDKLightningError e_conv;
14342         e_conv.inner = untag_ptr(e);
14343         e_conv.is_owned = ptr_is_owned(e);
14344         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14345         e_conv = LightningError_clone(&e_conv);
14346         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14347         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14348         return tag_ptr(ret_conv, true);
14349 }
14350
14351 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14352         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14353         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14354         return ret_conv;
14355 }
14356
14357 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14358         if (!ptr_is_owned(_res)) return;
14359         void* _res_ptr = untag_ptr(_res);
14360         CHECK_ACCESS(_res_ptr);
14361         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14362         FREE(untag_ptr(_res));
14363         CResult_NoneLightningErrorZ_free(_res_conv);
14364 }
14365
14366 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14367         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14368         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14369         return tag_ptr(ret_conv, true);
14370 }
14371 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14372         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14373         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14374         return ret_conv;
14375 }
14376
14377 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14378         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14379         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14380         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14381         return tag_ptr(ret_conv, true);
14382 }
14383
14384 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14385         LDKChannelUpdateInfo o_conv;
14386         o_conv.inner = untag_ptr(o);
14387         o_conv.is_owned = ptr_is_owned(o);
14388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14389         o_conv = ChannelUpdateInfo_clone(&o_conv);
14390         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14391         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
14392         return tag_ptr(ret_conv, true);
14393 }
14394
14395 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
14396         void* e_ptr = untag_ptr(e);
14397         CHECK_ACCESS(e_ptr);
14398         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14399         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14400         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14401         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
14402         return tag_ptr(ret_conv, true);
14403 }
14404
14405 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
14406         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
14407         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
14408         return ret_conv;
14409 }
14410
14411 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
14412         if (!ptr_is_owned(_res)) return;
14413         void* _res_ptr = untag_ptr(_res);
14414         CHECK_ACCESS(_res_ptr);
14415         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
14416         FREE(untag_ptr(_res));
14417         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
14418 }
14419
14420 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
14421         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14422         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
14423         return tag_ptr(ret_conv, true);
14424 }
14425 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14426         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
14427         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
14428         return ret_conv;
14429 }
14430
14431 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
14432         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
14433         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14434         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
14435         return tag_ptr(ret_conv, true);
14436 }
14437
14438 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
14439         LDKChannelInfo o_conv;
14440         o_conv.inner = untag_ptr(o);
14441         o_conv.is_owned = ptr_is_owned(o);
14442         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14443         o_conv = ChannelInfo_clone(&o_conv);
14444         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14445         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14446         return tag_ptr(ret_conv, true);
14447 }
14448
14449 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
14450         void* e_ptr = untag_ptr(e);
14451         CHECK_ACCESS(e_ptr);
14452         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14453         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14454         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14455         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14456         return tag_ptr(ret_conv, true);
14457 }
14458
14459 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
14460         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
14461         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14462         return ret_conv;
14463 }
14464
14465 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
14466         if (!ptr_is_owned(_res)) return;
14467         void* _res_ptr = untag_ptr(_res);
14468         CHECK_ACCESS(_res_ptr);
14469         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14470         FREE(untag_ptr(_res));
14471         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14472 }
14473
14474 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14475         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14476         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14477         return tag_ptr(ret_conv, true);
14478 }
14479 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14480         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
14481         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14482         return ret_conv;
14483 }
14484
14485 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
14486         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
14487         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14488         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14489         return tag_ptr(ret_conv, true);
14490 }
14491
14492 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
14493         LDKRoutingFees o_conv;
14494         o_conv.inner = untag_ptr(o);
14495         o_conv.is_owned = ptr_is_owned(o);
14496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14497         o_conv = RoutingFees_clone(&o_conv);
14498         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14499         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14500         return tag_ptr(ret_conv, true);
14501 }
14502
14503 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
14504         void* e_ptr = untag_ptr(e);
14505         CHECK_ACCESS(e_ptr);
14506         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14507         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14508         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14509         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14510         return tag_ptr(ret_conv, true);
14511 }
14512
14513 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
14514         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
14515         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14516         return ret_conv;
14517 }
14518
14519 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
14520         if (!ptr_is_owned(_res)) return;
14521         void* _res_ptr = untag_ptr(_res);
14522         CHECK_ACCESS(_res_ptr);
14523         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14524         FREE(untag_ptr(_res));
14525         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14526 }
14527
14528 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14529         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14530         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14531         return tag_ptr(ret_conv, true);
14532 }
14533 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
14534         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
14535         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14536         return ret_conv;
14537 }
14538
14539 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
14540         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
14541         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14542         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14543         return tag_ptr(ret_conv, true);
14544 }
14545
14546 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
14547         LDKCVec_NetAddressZ _res_constr;
14548         _res_constr.datalen = _res->arr_len;
14549         if (_res_constr.datalen > 0)
14550                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14551         else
14552                 _res_constr.data = NULL;
14553         uint64_t* _res_vals = _res->elems;
14554         for (size_t m = 0; m < _res_constr.datalen; m++) {
14555                 uint64_t _res_conv_12 = _res_vals[m];
14556                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
14557                 CHECK_ACCESS(_res_conv_12_ptr);
14558                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14559                 FREE(untag_ptr(_res_conv_12));
14560                 _res_constr.data[m] = _res_conv_12_conv;
14561         }
14562         FREE(_res);
14563         CVec_NetAddressZ_free(_res_constr);
14564 }
14565
14566 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
14567         LDKNodeAnnouncementInfo o_conv;
14568         o_conv.inner = untag_ptr(o);
14569         o_conv.is_owned = ptr_is_owned(o);
14570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14571         o_conv = NodeAnnouncementInfo_clone(&o_conv);
14572         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14573         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14574         return tag_ptr(ret_conv, true);
14575 }
14576
14577 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
14578         void* e_ptr = untag_ptr(e);
14579         CHECK_ACCESS(e_ptr);
14580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14582         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14583         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14584         return tag_ptr(ret_conv, true);
14585 }
14586
14587 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
14588         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
14589         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14590         return ret_conv;
14591 }
14592
14593 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
14594         if (!ptr_is_owned(_res)) return;
14595         void* _res_ptr = untag_ptr(_res);
14596         CHECK_ACCESS(_res_ptr);
14597         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14598         FREE(untag_ptr(_res));
14599         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14600 }
14601
14602 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14603         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14604         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14605         return tag_ptr(ret_conv, true);
14606 }
14607 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14608         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
14609         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14610         return ret_conv;
14611 }
14612
14613 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
14614         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
14615         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14616         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14617         return tag_ptr(ret_conv, true);
14618 }
14619
14620 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
14621         LDKNodeAlias o_conv;
14622         o_conv.inner = untag_ptr(o);
14623         o_conv.is_owned = ptr_is_owned(o);
14624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14625         o_conv = NodeAlias_clone(&o_conv);
14626         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14627         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
14628         return tag_ptr(ret_conv, true);
14629 }
14630
14631 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
14632         void* e_ptr = untag_ptr(e);
14633         CHECK_ACCESS(e_ptr);
14634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14636         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14637         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
14638         return tag_ptr(ret_conv, true);
14639 }
14640
14641 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
14642         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
14643         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
14644         return ret_conv;
14645 }
14646
14647 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
14648         if (!ptr_is_owned(_res)) return;
14649         void* _res_ptr = untag_ptr(_res);
14650         CHECK_ACCESS(_res_ptr);
14651         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
14652         FREE(untag_ptr(_res));
14653         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
14654 }
14655
14656 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
14657         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14658         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
14659         return tag_ptr(ret_conv, true);
14660 }
14661 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
14662         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
14663         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
14664         return ret_conv;
14665 }
14666
14667 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
14668         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
14669         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14670         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
14671         return tag_ptr(ret_conv, true);
14672 }
14673
14674 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
14675         LDKNodeInfo o_conv;
14676         o_conv.inner = untag_ptr(o);
14677         o_conv.is_owned = ptr_is_owned(o);
14678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14679         o_conv = NodeInfo_clone(&o_conv);
14680         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14681         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14682         return tag_ptr(ret_conv, true);
14683 }
14684
14685 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
14686         void* e_ptr = untag_ptr(e);
14687         CHECK_ACCESS(e_ptr);
14688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14690         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14691         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14692         return tag_ptr(ret_conv, true);
14693 }
14694
14695 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
14696         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
14697         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14698         return ret_conv;
14699 }
14700
14701 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
14702         if (!ptr_is_owned(_res)) return;
14703         void* _res_ptr = untag_ptr(_res);
14704         CHECK_ACCESS(_res_ptr);
14705         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14706         FREE(untag_ptr(_res));
14707         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14708 }
14709
14710 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14711         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14712         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14713         return tag_ptr(ret_conv, true);
14714 }
14715 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14716         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
14717         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14718         return ret_conv;
14719 }
14720
14721 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
14722         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
14723         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14724         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14725         return tag_ptr(ret_conv, true);
14726 }
14727
14728 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
14729         LDKNetworkGraph o_conv;
14730         o_conv.inner = untag_ptr(o);
14731         o_conv.is_owned = ptr_is_owned(o);
14732         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14733         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14734         
14735         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14736         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14737         return tag_ptr(ret_conv, true);
14738 }
14739
14740 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
14741         void* e_ptr = untag_ptr(e);
14742         CHECK_ACCESS(e_ptr);
14743         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14744         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14745         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14746         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14747         return tag_ptr(ret_conv, true);
14748 }
14749
14750 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
14751         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
14752         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14753         return ret_conv;
14754 }
14755
14756 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
14757         if (!ptr_is_owned(_res)) return;
14758         void* _res_ptr = untag_ptr(_res);
14759         CHECK_ACCESS(_res_ptr);
14760         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14761         FREE(untag_ptr(_res));
14762         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14763 }
14764
14765 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
14766         LDKCVec_NetAddressZ o_constr;
14767         o_constr.datalen = o->arr_len;
14768         if (o_constr.datalen > 0)
14769                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14770         else
14771                 o_constr.data = NULL;
14772         uint64_t* o_vals = o->elems;
14773         for (size_t m = 0; m < o_constr.datalen; m++) {
14774                 uint64_t o_conv_12 = o_vals[m];
14775                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
14776                 CHECK_ACCESS(o_conv_12_ptr);
14777                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14778                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
14779                 o_constr.data[m] = o_conv_12_conv;
14780         }
14781         FREE(o);
14782         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14783         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14784         uint64_t ret_ref = tag_ptr(ret_copy, true);
14785         return ret_ref;
14786 }
14787
14788 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14789         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14790         *ret_copy = COption_CVec_NetAddressZZ_none();
14791         uint64_t ret_ref = tag_ptr(ret_copy, true);
14792         return ret_ref;
14793 }
14794
14795 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
14796         if (!ptr_is_owned(_res)) return;
14797         void* _res_ptr = untag_ptr(_res);
14798         CHECK_ACCESS(_res_ptr);
14799         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14800         FREE(untag_ptr(_res));
14801         COption_CVec_NetAddressZZ_free(_res_conv);
14802 }
14803
14804 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14805         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14806         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14807         uint64_t ret_ref = tag_ptr(ret_copy, true);
14808         return ret_ref;
14809 }
14810 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
14811         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
14812         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14813         return ret_conv;
14814 }
14815
14816 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
14817         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
14818         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14819         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14820         uint64_t ret_ref = tag_ptr(ret_copy, true);
14821         return ret_ref;
14822 }
14823
14824 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14825         LDKDelayedPaymentOutputDescriptor o_conv;
14826         o_conv.inner = untag_ptr(o);
14827         o_conv.is_owned = ptr_is_owned(o);
14828         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14829         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14830         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14831         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14832         return tag_ptr(ret_conv, true);
14833 }
14834
14835 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14836         void* e_ptr = untag_ptr(e);
14837         CHECK_ACCESS(e_ptr);
14838         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14839         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14840         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14841         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14842         return tag_ptr(ret_conv, true);
14843 }
14844
14845 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14846         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14847         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14848         return ret_conv;
14849 }
14850
14851 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14852         if (!ptr_is_owned(_res)) return;
14853         void* _res_ptr = untag_ptr(_res);
14854         CHECK_ACCESS(_res_ptr);
14855         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14856         FREE(untag_ptr(_res));
14857         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14858 }
14859
14860 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14861         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14862         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14863         return tag_ptr(ret_conv, true);
14864 }
14865 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14866         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14867         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14868         return ret_conv;
14869 }
14870
14871 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14872         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14873         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14874         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14875         return tag_ptr(ret_conv, true);
14876 }
14877
14878 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14879         LDKStaticPaymentOutputDescriptor o_conv;
14880         o_conv.inner = untag_ptr(o);
14881         o_conv.is_owned = ptr_is_owned(o);
14882         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14883         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14884         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14885         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14886         return tag_ptr(ret_conv, true);
14887 }
14888
14889 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14890         void* e_ptr = untag_ptr(e);
14891         CHECK_ACCESS(e_ptr);
14892         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14893         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14894         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14895         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14896         return tag_ptr(ret_conv, true);
14897 }
14898
14899 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14900         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14901         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14902         return ret_conv;
14903 }
14904
14905 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14906         if (!ptr_is_owned(_res)) return;
14907         void* _res_ptr = untag_ptr(_res);
14908         CHECK_ACCESS(_res_ptr);
14909         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14910         FREE(untag_ptr(_res));
14911         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14912 }
14913
14914 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14915         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14916         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14917         return tag_ptr(ret_conv, true);
14918 }
14919 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14920         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14921         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14922         return ret_conv;
14923 }
14924
14925 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14926         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14927         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14928         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14929         return tag_ptr(ret_conv, true);
14930 }
14931
14932 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14933         void* o_ptr = untag_ptr(o);
14934         CHECK_ACCESS(o_ptr);
14935         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14936         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
14937         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14938         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14939         return tag_ptr(ret_conv, true);
14940 }
14941
14942 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14943         void* e_ptr = untag_ptr(e);
14944         CHECK_ACCESS(e_ptr);
14945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14947         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14948         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14949         return tag_ptr(ret_conv, true);
14950 }
14951
14952 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14953         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14954         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14955         return ret_conv;
14956 }
14957
14958 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14959         if (!ptr_is_owned(_res)) return;
14960         void* _res_ptr = untag_ptr(_res);
14961         CHECK_ACCESS(_res_ptr);
14962         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14963         FREE(untag_ptr(_res));
14964         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14965 }
14966
14967 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14968         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14969         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14970         return tag_ptr(ret_conv, true);
14971 }
14972 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14973         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14974         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14975         return ret_conv;
14976 }
14977
14978 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14979         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14980         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14981         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14982         return tag_ptr(ret_conv, true);
14983 }
14984
14985 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14986         LDKCVec_PaymentPreimageZ _res_constr;
14987         _res_constr.datalen = _res->arr_len;
14988         if (_res_constr.datalen > 0)
14989                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
14990         else
14991                 _res_constr.data = NULL;
14992         int8_tArray* _res_vals = (void*) _res->elems;
14993         for (size_t m = 0; m < _res_constr.datalen; m++) {
14994                 int8_tArray _res_conv_12 = _res_vals[m];
14995                 LDKThirtyTwoBytes _res_conv_12_ref;
14996                 CHECK(_res_conv_12->arr_len == 32);
14997                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
14998                 _res_constr.data[m] = _res_conv_12_ref;
14999         }
15000         FREE(_res);
15001         CVec_PaymentPreimageZ_free(_res_constr);
15002 }
15003
15004 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15005         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15006         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15007         return tag_ptr(ret_conv, true);
15008 }
15009 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15010         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15011         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15012         return ret_conv;
15013 }
15014
15015 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15016         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15017         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15018         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15019         return tag_ptr(ret_conv, true);
15020 }
15021
15022 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15023         LDKSignature a_ref;
15024         CHECK(a->arr_len == 64);
15025         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15026         LDKCVec_SignatureZ b_constr;
15027         b_constr.datalen = b->arr_len;
15028         if (b_constr.datalen > 0)
15029                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15030         else
15031                 b_constr.data = NULL;
15032         int8_tArray* b_vals = (void*) b->elems;
15033         for (size_t m = 0; m < b_constr.datalen; m++) {
15034                 int8_tArray b_conv_12 = b_vals[m];
15035                 LDKSignature b_conv_12_ref;
15036                 CHECK(b_conv_12->arr_len == 64);
15037                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15038                 b_constr.data[m] = b_conv_12_ref;
15039         }
15040         FREE(b);
15041         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15042         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15043         return tag_ptr(ret_conv, true);
15044 }
15045
15046 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15047         if (!ptr_is_owned(_res)) return;
15048         void* _res_ptr = untag_ptr(_res);
15049         CHECK_ACCESS(_res_ptr);
15050         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15051         FREE(untag_ptr(_res));
15052         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15053 }
15054
15055 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15056         void* o_ptr = untag_ptr(o);
15057         CHECK_ACCESS(o_ptr);
15058         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15059         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15060         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15061         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15062         return tag_ptr(ret_conv, true);
15063 }
15064
15065 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15066         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15067         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15068         return tag_ptr(ret_conv, true);
15069 }
15070
15071 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15072         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15073         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15074         return ret_conv;
15075 }
15076
15077 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15078         if (!ptr_is_owned(_res)) return;
15079         void* _res_ptr = untag_ptr(_res);
15080         CHECK_ACCESS(_res_ptr);
15081         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15082         FREE(untag_ptr(_res));
15083         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15084 }
15085
15086 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15087         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15088         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15089         return tag_ptr(ret_conv, true);
15090 }
15091 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15092         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15093         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15094         return ret_conv;
15095 }
15096
15097 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15098         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15099         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15100         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15101         return tag_ptr(ret_conv, true);
15102 }
15103
15104 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15105         LDKSignature o_ref;
15106         CHECK(o->arr_len == 64);
15107         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15108         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15109         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15110         return tag_ptr(ret_conv, true);
15111 }
15112
15113 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15114         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15115         *ret_conv = CResult_SignatureNoneZ_err();
15116         return tag_ptr(ret_conv, true);
15117 }
15118
15119 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15120         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15121         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15122         return ret_conv;
15123 }
15124
15125 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15126         if (!ptr_is_owned(_res)) return;
15127         void* _res_ptr = untag_ptr(_res);
15128         CHECK_ACCESS(_res_ptr);
15129         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15130         FREE(untag_ptr(_res));
15131         CResult_SignatureNoneZ_free(_res_conv);
15132 }
15133
15134 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15135         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15136         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15137         return tag_ptr(ret_conv, true);
15138 }
15139 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15140         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15141         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15142         return ret_conv;
15143 }
15144
15145 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15146         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15147         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15148         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15149         return tag_ptr(ret_conv, true);
15150 }
15151
15152 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15153         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15154         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15155         return tag_ptr(ret_conv, true);
15156 }
15157 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15158         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15159         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15160         return ret_conv;
15161 }
15162
15163 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15164         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15165         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15166         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15167         return tag_ptr(ret_conv, true);
15168 }
15169
15170 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15171         LDKSignature a_ref;
15172         CHECK(a->arr_len == 64);
15173         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15174         LDKSignature b_ref;
15175         CHECK(b->arr_len == 64);
15176         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15177         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15178         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15179         return tag_ptr(ret_conv, true);
15180 }
15181
15182 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15183         if (!ptr_is_owned(_res)) return;
15184         void* _res_ptr = untag_ptr(_res);
15185         CHECK_ACCESS(_res_ptr);
15186         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15187         FREE(untag_ptr(_res));
15188         C2Tuple_SignatureSignatureZ_free(_res_conv);
15189 }
15190
15191 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15192         void* o_ptr = untag_ptr(o);
15193         CHECK_ACCESS(o_ptr);
15194         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15195         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15196         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15197         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15198         return tag_ptr(ret_conv, true);
15199 }
15200
15201 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15202         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15203         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15204         return tag_ptr(ret_conv, true);
15205 }
15206
15207 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15208         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15209         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15210         return ret_conv;
15211 }
15212
15213 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15214         if (!ptr_is_owned(_res)) return;
15215         void* _res_ptr = untag_ptr(_res);
15216         CHECK_ACCESS(_res_ptr);
15217         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15218         FREE(untag_ptr(_res));
15219         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15220 }
15221
15222 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15223         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15224         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15225         return tag_ptr(ret_conv, true);
15226 }
15227 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15228         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15229         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15230         return ret_conv;
15231 }
15232
15233 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15234         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15235         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15236         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15237         return tag_ptr(ret_conv, true);
15238 }
15239
15240 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15241         LDKSecretKey o_ref;
15242         CHECK(o->arr_len == 32);
15243         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15244         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15245         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15246         return tag_ptr(ret_conv, true);
15247 }
15248
15249 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15250         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15251         *ret_conv = CResult_SecretKeyNoneZ_err();
15252         return tag_ptr(ret_conv, true);
15253 }
15254
15255 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15256         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15257         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15258         return ret_conv;
15259 }
15260
15261 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15262         if (!ptr_is_owned(_res)) return;
15263         void* _res_ptr = untag_ptr(_res);
15264         CHECK_ACCESS(_res_ptr);
15265         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15266         FREE(untag_ptr(_res));
15267         CResult_SecretKeyNoneZ_free(_res_conv);
15268 }
15269
15270 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15271         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15272         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15273         return tag_ptr(ret_conv, true);
15274 }
15275 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15276         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15277         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15278         return ret_conv;
15279 }
15280
15281 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15282         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15283         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15284         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15285         return tag_ptr(ret_conv, true);
15286 }
15287
15288 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15289         LDKPublicKey o_ref;
15290         CHECK(o->arr_len == 33);
15291         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15292         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15293         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15294         return tag_ptr(ret_conv, true);
15295 }
15296
15297 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15298         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15299         *ret_conv = CResult_PublicKeyNoneZ_err();
15300         return tag_ptr(ret_conv, true);
15301 }
15302
15303 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15304         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15305         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15306         return ret_conv;
15307 }
15308
15309 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15310         if (!ptr_is_owned(_res)) return;
15311         void* _res_ptr = untag_ptr(_res);
15312         CHECK_ACCESS(_res_ptr);
15313         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15314         FREE(untag_ptr(_res));
15315         CResult_PublicKeyNoneZ_free(_res_conv);
15316 }
15317
15318 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15319         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15320         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15321         return tag_ptr(ret_conv, true);
15322 }
15323 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15324         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15325         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15326         return ret_conv;
15327 }
15328
15329 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
15330         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
15331         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15332         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
15333         return tag_ptr(ret_conv, true);
15334 }
15335
15336 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15337         void* o_ptr = untag_ptr(o);
15338         CHECK_ACCESS(o_ptr);
15339         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15340         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15341         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15342         *ret_copy = COption_ScalarZ_some(o_conv);
15343         uint64_t ret_ref = tag_ptr(ret_copy, true);
15344         return ret_ref;
15345 }
15346
15347 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15348         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15349         *ret_copy = COption_ScalarZ_none();
15350         uint64_t ret_ref = tag_ptr(ret_copy, true);
15351         return ret_ref;
15352 }
15353
15354 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15355         if (!ptr_is_owned(_res)) return;
15356         void* _res_ptr = untag_ptr(_res);
15357         CHECK_ACCESS(_res_ptr);
15358         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15359         FREE(untag_ptr(_res));
15360         COption_ScalarZ_free(_res_conv);
15361 }
15362
15363 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15364         LDKThirtyTwoBytes o_ref;
15365         CHECK(o->arr_len == 32);
15366         memcpy(o_ref.data, o->elems, 32); FREE(o);
15367         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15368         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15369         return tag_ptr(ret_conv, true);
15370 }
15371
15372 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15373         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15374         *ret_conv = CResult_SharedSecretNoneZ_err();
15375         return tag_ptr(ret_conv, true);
15376 }
15377
15378 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15379         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15380         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15381         return ret_conv;
15382 }
15383
15384 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15385         if (!ptr_is_owned(_res)) return;
15386         void* _res_ptr = untag_ptr(_res);
15387         CHECK_ACCESS(_res_ptr);
15388         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
15389         FREE(untag_ptr(_res));
15390         CResult_SharedSecretNoneZ_free(_res_conv);
15391 }
15392
15393 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
15394         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15395         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
15396         return tag_ptr(ret_conv, true);
15397 }
15398 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
15399         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
15400         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
15401         return ret_conv;
15402 }
15403
15404 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
15405         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
15406         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15407         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
15408         return tag_ptr(ret_conv, true);
15409 }
15410
15411 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
15412         void* o_ptr = untag_ptr(o);
15413         CHECK_ACCESS(o_ptr);
15414         LDKSign o_conv = *(LDKSign*)(o_ptr);
15415         if (o_conv.free == LDKSign_JCalls_free) {
15416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15417                 LDKSign_JCalls_cloned(&o_conv);
15418         }
15419         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15420         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15421         return tag_ptr(ret_conv, true);
15422 }
15423
15424 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
15425         void* e_ptr = untag_ptr(e);
15426         CHECK_ACCESS(e_ptr);
15427         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15428         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15429         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15430         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15431         return tag_ptr(ret_conv, true);
15432 }
15433
15434 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
15435         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
15436         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
15437         return ret_conv;
15438 }
15439
15440 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
15441         if (!ptr_is_owned(_res)) return;
15442         void* _res_ptr = untag_ptr(_res);
15443         CHECK_ACCESS(_res_ptr);
15444         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15445         FREE(untag_ptr(_res));
15446         CResult_SignDecodeErrorZ_free(_res_conv);
15447 }
15448
15449 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15450         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15451         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15452         return tag_ptr(ret_conv, true);
15453 }
15454 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
15455         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
15456         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15457         return ret_conv;
15458 }
15459
15460 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
15461         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
15462         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15463         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15464         return tag_ptr(ret_conv, true);
15465 }
15466
15467 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
15468         LDKCVec_u5Z _res_constr;
15469         _res_constr.datalen = _res->arr_len;
15470         if (_res_constr.datalen > 0)
15471                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
15472         else
15473                 _res_constr.data = NULL;
15474         int8_t* _res_vals = (void*) _res->elems;
15475         for (size_t h = 0; h < _res_constr.datalen; h++) {
15476                 int8_t _res_conv_7 = _res_vals[h];
15477                 
15478                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
15479         }
15480         FREE(_res);
15481         CVec_u5Z_free(_res_constr);
15482 }
15483
15484 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15485         LDKRecoverableSignature o_ref;
15486         CHECK(o->arr_len == 68);
15487         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
15488         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15489         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15490         return tag_ptr(ret_conv, true);
15491 }
15492
15493 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15494         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15495         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15496         return tag_ptr(ret_conv, true);
15497 }
15498
15499 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
15500         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
15501         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15502         return ret_conv;
15503 }
15504
15505 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
15506         if (!ptr_is_owned(_res)) return;
15507         void* _res_ptr = untag_ptr(_res);
15508         CHECK_ACCESS(_res_ptr);
15509         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15510         FREE(untag_ptr(_res));
15511         CResult_RecoverableSignatureNoneZ_free(_res_conv);
15512 }
15513
15514 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15515         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15516         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15517         return tag_ptr(ret_conv, true);
15518 }
15519 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
15520         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
15521         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15522         return ret_conv;
15523 }
15524
15525 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
15526         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
15527         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15528         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15529         return tag_ptr(ret_conv, true);
15530 }
15531
15532 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15533         LDKCVec_u8Z _res_ref;
15534         _res_ref.datalen = _res->arr_len;
15535         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15536         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15537         CVec_u8Z_free(_res_ref);
15538 }
15539
15540 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15541         LDKCVec_CVec_u8ZZ _res_constr;
15542         _res_constr.datalen = _res->arr_len;
15543         if (_res_constr.datalen > 0)
15544                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15545         else
15546                 _res_constr.data = NULL;
15547         int8_tArray* _res_vals = (void*) _res->elems;
15548         for (size_t m = 0; m < _res_constr.datalen; m++) {
15549                 int8_tArray _res_conv_12 = _res_vals[m];
15550                 LDKCVec_u8Z _res_conv_12_ref;
15551                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15552                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15553                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15554                 _res_constr.data[m] = _res_conv_12_ref;
15555         }
15556         FREE(_res);
15557         CVec_CVec_u8ZZ_free(_res_constr);
15558 }
15559
15560 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15561         LDKCVec_CVec_u8ZZ o_constr;
15562         o_constr.datalen = o->arr_len;
15563         if (o_constr.datalen > 0)
15564                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15565         else
15566                 o_constr.data = NULL;
15567         int8_tArray* o_vals = (void*) o->elems;
15568         for (size_t m = 0; m < o_constr.datalen; m++) {
15569                 int8_tArray o_conv_12 = o_vals[m];
15570                 LDKCVec_u8Z o_conv_12_ref;
15571                 o_conv_12_ref.datalen = o_conv_12->arr_len;
15572                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15573                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
15574                 o_constr.data[m] = o_conv_12_ref;
15575         }
15576         FREE(o);
15577         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15578         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15579         return tag_ptr(ret_conv, true);
15580 }
15581
15582 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15583         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15584         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15585         return tag_ptr(ret_conv, true);
15586 }
15587
15588 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
15589         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
15590         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15591         return ret_conv;
15592 }
15593
15594 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
15595         if (!ptr_is_owned(_res)) return;
15596         void* _res_ptr = untag_ptr(_res);
15597         CHECK_ACCESS(_res_ptr);
15598         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15599         FREE(untag_ptr(_res));
15600         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15601 }
15602
15603 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15604         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15605         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15606         return tag_ptr(ret_conv, true);
15607 }
15608 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
15609         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
15610         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15611         return ret_conv;
15612 }
15613
15614 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
15615         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
15616         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15617         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15618         return tag_ptr(ret_conv, true);
15619 }
15620
15621 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
15622         LDKInMemorySigner o_conv;
15623         o_conv.inner = untag_ptr(o);
15624         o_conv.is_owned = ptr_is_owned(o);
15625         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15626         o_conv = InMemorySigner_clone(&o_conv);
15627         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15628         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15629         return tag_ptr(ret_conv, true);
15630 }
15631
15632 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
15633         void* e_ptr = untag_ptr(e);
15634         CHECK_ACCESS(e_ptr);
15635         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15636         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15637         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15638         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15639         return tag_ptr(ret_conv, true);
15640 }
15641
15642 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
15643         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
15644         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15645         return ret_conv;
15646 }
15647
15648 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
15649         if (!ptr_is_owned(_res)) return;
15650         void* _res_ptr = untag_ptr(_res);
15651         CHECK_ACCESS(_res_ptr);
15652         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15653         FREE(untag_ptr(_res));
15654         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15655 }
15656
15657 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15658         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15659         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15660         return tag_ptr(ret_conv, true);
15661 }
15662 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
15663         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
15664         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15665         return ret_conv;
15666 }
15667
15668 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
15669         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
15670         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15671         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15672         return tag_ptr(ret_conv, true);
15673 }
15674
15675 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15676         LDKCVec_TxOutZ _res_constr;
15677         _res_constr.datalen = _res->arr_len;
15678         if (_res_constr.datalen > 0)
15679                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15680         else
15681                 _res_constr.data = NULL;
15682         uint64_t* _res_vals = _res->elems;
15683         for (size_t h = 0; h < _res_constr.datalen; h++) {
15684                 uint64_t _res_conv_7 = _res_vals[h];
15685                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15686                 CHECK_ACCESS(_res_conv_7_ptr);
15687                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15688                 FREE(untag_ptr(_res_conv_7));
15689                 _res_constr.data[h] = _res_conv_7_conv;
15690         }
15691         FREE(_res);
15692         CVec_TxOutZ_free(_res_constr);
15693 }
15694
15695 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15696         LDKTransaction o_ref;
15697         o_ref.datalen = o->arr_len;
15698         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15699         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15700         o_ref.data_is_owned = true;
15701         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15702         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15703         return tag_ptr(ret_conv, true);
15704 }
15705
15706 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15707         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15708         *ret_conv = CResult_TransactionNoneZ_err();
15709         return tag_ptr(ret_conv, true);
15710 }
15711
15712 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
15713         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
15714         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15715         return ret_conv;
15716 }
15717
15718 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
15719         if (!ptr_is_owned(_res)) return;
15720         void* _res_ptr = untag_ptr(_res);
15721         CHECK_ACCESS(_res_ptr);
15722         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15723         FREE(untag_ptr(_res));
15724         CResult_TransactionNoneZ_free(_res_conv);
15725 }
15726
15727 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15728         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15729         *ret_conv = CResult_TransactionNoneZ_clone(arg);
15730         return tag_ptr(ret_conv, true);
15731 }
15732 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
15733         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
15734         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15735         return ret_conv;
15736 }
15737
15738 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
15739         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
15740         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15741         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15742         return tag_ptr(ret_conv, true);
15743 }
15744
15745 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15746         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15747         *ret_copy = COption_u16Z_some(o);
15748         uint64_t ret_ref = tag_ptr(ret_copy, true);
15749         return ret_ref;
15750 }
15751
15752 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15753         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15754         *ret_copy = COption_u16Z_none();
15755         uint64_t ret_ref = tag_ptr(ret_copy, true);
15756         return ret_ref;
15757 }
15758
15759 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
15760         if (!ptr_is_owned(_res)) return;
15761         void* _res_ptr = untag_ptr(_res);
15762         CHECK_ACCESS(_res_ptr);
15763         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15764         FREE(untag_ptr(_res));
15765         COption_u16Z_free(_res_conv);
15766 }
15767
15768 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15769         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15770         *ret_copy = COption_u16Z_clone(arg);
15771         uint64_t ret_ref = tag_ptr(ret_copy, true);
15772         return ret_ref;
15773 }
15774 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
15775         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
15776         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15777         return ret_conv;
15778 }
15779
15780 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
15781         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
15782         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15783         *ret_copy = COption_u16Z_clone(orig_conv);
15784         uint64_t ret_ref = tag_ptr(ret_copy, true);
15785         return ret_ref;
15786 }
15787
15788 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15789         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15790         *ret_conv = CResult_NoneAPIErrorZ_ok();
15791         return tag_ptr(ret_conv, true);
15792 }
15793
15794 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15795         void* e_ptr = untag_ptr(e);
15796         CHECK_ACCESS(e_ptr);
15797         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15798         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15799         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15800         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15801         return tag_ptr(ret_conv, true);
15802 }
15803
15804 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15805         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15806         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15807         return ret_conv;
15808 }
15809
15810 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15811         if (!ptr_is_owned(_res)) return;
15812         void* _res_ptr = untag_ptr(_res);
15813         CHECK_ACCESS(_res_ptr);
15814         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15815         FREE(untag_ptr(_res));
15816         CResult_NoneAPIErrorZ_free(_res_conv);
15817 }
15818
15819 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15820         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15821         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15822         return tag_ptr(ret_conv, true);
15823 }
15824 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15825         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15826         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15827         return ret_conv;
15828 }
15829
15830 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15831         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15832         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15833         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15834         return tag_ptr(ret_conv, true);
15835 }
15836
15837 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15838         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15839         _res_constr.datalen = _res->arr_len;
15840         if (_res_constr.datalen > 0)
15841                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15842         else
15843                 _res_constr.data = NULL;
15844         uint64_t* _res_vals = _res->elems;
15845         for (size_t w = 0; w < _res_constr.datalen; w++) {
15846                 uint64_t _res_conv_22 = _res_vals[w];
15847                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15848                 CHECK_ACCESS(_res_conv_22_ptr);
15849                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15850                 FREE(untag_ptr(_res_conv_22));
15851                 _res_constr.data[w] = _res_conv_22_conv;
15852         }
15853         FREE(_res);
15854         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15855 }
15856
15857 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15858         LDKCVec_APIErrorZ _res_constr;
15859         _res_constr.datalen = _res->arr_len;
15860         if (_res_constr.datalen > 0)
15861                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15862         else
15863                 _res_constr.data = NULL;
15864         uint64_t* _res_vals = _res->elems;
15865         for (size_t k = 0; k < _res_constr.datalen; k++) {
15866                 uint64_t _res_conv_10 = _res_vals[k];
15867                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15868                 CHECK_ACCESS(_res_conv_10_ptr);
15869                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15870                 FREE(untag_ptr(_res_conv_10));
15871                 _res_constr.data[k] = _res_conv_10_conv;
15872         }
15873         FREE(_res);
15874         CVec_APIErrorZ_free(_res_constr);
15875 }
15876
15877 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15878         LDKThirtyTwoBytes o_ref;
15879         CHECK(o->arr_len == 32);
15880         memcpy(o_ref.data, o->elems, 32); FREE(o);
15881         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15882         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15883         return tag_ptr(ret_conv, true);
15884 }
15885
15886 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
15887         void* e_ptr = untag_ptr(e);
15888         CHECK_ACCESS(e_ptr);
15889         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15890         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15891         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15892         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15893         return tag_ptr(ret_conv, true);
15894 }
15895
15896 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
15897         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
15898         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15899         return ret_conv;
15900 }
15901
15902 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
15903         if (!ptr_is_owned(_res)) return;
15904         void* _res_ptr = untag_ptr(_res);
15905         CHECK_ACCESS(_res_ptr);
15906         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15907         FREE(untag_ptr(_res));
15908         CResult__u832APIErrorZ_free(_res_conv);
15909 }
15910
15911 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15912         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15913         *ret_conv = CResult__u832APIErrorZ_clone(arg);
15914         return tag_ptr(ret_conv, true);
15915 }
15916 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
15917         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
15918         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15919         return ret_conv;
15920 }
15921
15922 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
15923         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
15924         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15925         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15926         return tag_ptr(ret_conv, true);
15927 }
15928
15929 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15930         LDKThirtyTwoBytes o_ref;
15931         CHECK(o->arr_len == 32);
15932         memcpy(o_ref.data, o->elems, 32); FREE(o);
15933         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15934         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15935         return tag_ptr(ret_conv, true);
15936 }
15937
15938 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
15939         void* e_ptr = untag_ptr(e);
15940         CHECK_ACCESS(e_ptr);
15941         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15942         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15943         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15944         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15945         return tag_ptr(ret_conv, true);
15946 }
15947
15948 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
15949         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
15950         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15951         return ret_conv;
15952 }
15953
15954 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) {
15955         if (!ptr_is_owned(_res)) return;
15956         void* _res_ptr = untag_ptr(_res);
15957         CHECK_ACCESS(_res_ptr);
15958         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15959         FREE(untag_ptr(_res));
15960         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15961 }
15962
15963 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15964         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15965         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15966         return tag_ptr(ret_conv, true);
15967 }
15968 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
15969         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
15970         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15971         return ret_conv;
15972 }
15973
15974 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
15975         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
15976         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15977         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15978         return tag_ptr(ret_conv, true);
15979 }
15980
15981 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15982         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15983         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15984         return tag_ptr(ret_conv, true);
15985 }
15986
15987 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
15988         void* e_ptr = untag_ptr(e);
15989         CHECK_ACCESS(e_ptr);
15990         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15991         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15992         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15993         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15994         return tag_ptr(ret_conv, true);
15995 }
15996
15997 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
15998         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
15999         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16000         return ret_conv;
16001 }
16002
16003 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16004         if (!ptr_is_owned(_res)) return;
16005         void* _res_ptr = untag_ptr(_res);
16006         CHECK_ACCESS(_res_ptr);
16007         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16008         FREE(untag_ptr(_res));
16009         CResult_NonePaymentSendFailureZ_free(_res_conv);
16010 }
16011
16012 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16013         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16014         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16015         return tag_ptr(ret_conv, true);
16016 }
16017 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16018         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16019         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16020         return ret_conv;
16021 }
16022
16023 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16024         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16025         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16026         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16027         return tag_ptr(ret_conv, true);
16028 }
16029
16030 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16031         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16032         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16033         return tag_ptr(ret_conv, true);
16034 }
16035 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16036         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16037         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16038         return ret_conv;
16039 }
16040
16041 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16042         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16043         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16044         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16045         return tag_ptr(ret_conv, true);
16046 }
16047
16048 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16049         LDKThirtyTwoBytes a_ref;
16050         CHECK(a->arr_len == 32);
16051         memcpy(a_ref.data, a->elems, 32); FREE(a);
16052         LDKThirtyTwoBytes b_ref;
16053         CHECK(b->arr_len == 32);
16054         memcpy(b_ref.data, b->elems, 32); FREE(b);
16055         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16056         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16057         return tag_ptr(ret_conv, true);
16058 }
16059
16060 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16061         if (!ptr_is_owned(_res)) return;
16062         void* _res_ptr = untag_ptr(_res);
16063         CHECK_ACCESS(_res_ptr);
16064         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16065         FREE(untag_ptr(_res));
16066         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16067 }
16068
16069 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16070         void* o_ptr = untag_ptr(o);
16071         CHECK_ACCESS(o_ptr);
16072         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16073         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16074         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16075         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16076         return tag_ptr(ret_conv, true);
16077 }
16078
16079 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16080         void* e_ptr = untag_ptr(e);
16081         CHECK_ACCESS(e_ptr);
16082         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16083         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16084         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16085         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16086         return tag_ptr(ret_conv, true);
16087 }
16088
16089 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16090         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16091         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16092         return ret_conv;
16093 }
16094
16095 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16096         if (!ptr_is_owned(_res)) return;
16097         void* _res_ptr = untag_ptr(_res);
16098         CHECK_ACCESS(_res_ptr);
16099         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16100         FREE(untag_ptr(_res));
16101         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16102 }
16103
16104 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16105         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16106         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16107         return tag_ptr(ret_conv, true);
16108 }
16109 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16110         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16111         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16112         return ret_conv;
16113 }
16114
16115 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16116         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16117         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16118         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16119         return tag_ptr(ret_conv, true);
16120 }
16121
16122 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16123         LDKCVec_ThirtyTwoBytesZ _res_constr;
16124         _res_constr.datalen = _res->arr_len;
16125         if (_res_constr.datalen > 0)
16126                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16127         else
16128                 _res_constr.data = NULL;
16129         int8_tArray* _res_vals = (void*) _res->elems;
16130         for (size_t m = 0; m < _res_constr.datalen; m++) {
16131                 int8_tArray _res_conv_12 = _res_vals[m];
16132                 LDKThirtyTwoBytes _res_conv_12_ref;
16133                 CHECK(_res_conv_12->arr_len == 32);
16134                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16135                 _res_constr.data[m] = _res_conv_12_ref;
16136         }
16137         FREE(_res);
16138         CVec_ThirtyTwoBytesZ_free(_res_constr);
16139 }
16140
16141 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16142         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16143         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16144         return tag_ptr(ret_conv, true);
16145 }
16146 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16147         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16148         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16149         return ret_conv;
16150 }
16151
16152 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16153         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16154         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16155         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16156         return tag_ptr(ret_conv, true);
16157 }
16158
16159 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16160         LDKThirtyTwoBytes a_ref;
16161         CHECK(a->arr_len == 32);
16162         memcpy(a_ref.data, a->elems, 32); FREE(a);
16163         LDKThirtyTwoBytes b_ref;
16164         CHECK(b->arr_len == 32);
16165         memcpy(b_ref.data, b->elems, 32); FREE(b);
16166         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16167         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16168         return tag_ptr(ret_conv, true);
16169 }
16170
16171 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16172         if (!ptr_is_owned(_res)) return;
16173         void* _res_ptr = untag_ptr(_res);
16174         CHECK_ACCESS(_res_ptr);
16175         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16176         FREE(untag_ptr(_res));
16177         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16178 }
16179
16180 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16181         void* o_ptr = untag_ptr(o);
16182         CHECK_ACCESS(o_ptr);
16183         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16184         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16185         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16186         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16187         return tag_ptr(ret_conv, true);
16188 }
16189
16190 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16191         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16192         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16193         return tag_ptr(ret_conv, true);
16194 }
16195
16196 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16197         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16198         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16199         return ret_conv;
16200 }
16201
16202 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16203         if (!ptr_is_owned(_res)) return;
16204         void* _res_ptr = untag_ptr(_res);
16205         CHECK_ACCESS(_res_ptr);
16206         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16207         FREE(untag_ptr(_res));
16208         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16209 }
16210
16211 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16212         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16213         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16214         return tag_ptr(ret_conv, true);
16215 }
16216 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16217         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16218         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16219         return ret_conv;
16220 }
16221
16222 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16223         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16224         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16225         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16226         return tag_ptr(ret_conv, true);
16227 }
16228
16229 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16230         void* o_ptr = untag_ptr(o);
16231         CHECK_ACCESS(o_ptr);
16232         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16233         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16234         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16235         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16236         return tag_ptr(ret_conv, true);
16237 }
16238
16239 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16240         void* e_ptr = untag_ptr(e);
16241         CHECK_ACCESS(e_ptr);
16242         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16243         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16244         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16245         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16246         return tag_ptr(ret_conv, true);
16247 }
16248
16249 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16250         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16251         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16252         return ret_conv;
16253 }
16254
16255 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16256         if (!ptr_is_owned(_res)) return;
16257         void* _res_ptr = untag_ptr(_res);
16258         CHECK_ACCESS(_res_ptr);
16259         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16260         FREE(untag_ptr(_res));
16261         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16262 }
16263
16264 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16265         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16266         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16267         return tag_ptr(ret_conv, true);
16268 }
16269 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16270         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16271         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16272         return ret_conv;
16273 }
16274
16275 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16276         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16277         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16278         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16279         return tag_ptr(ret_conv, true);
16280 }
16281
16282 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16283         LDKThirtyTwoBytes o_ref;
16284         CHECK(o->arr_len == 32);
16285         memcpy(o_ref.data, o->elems, 32); FREE(o);
16286         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16287         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16288         return tag_ptr(ret_conv, true);
16289 }
16290
16291 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16292         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16293         *ret_conv = CResult_PaymentSecretNoneZ_err();
16294         return tag_ptr(ret_conv, true);
16295 }
16296
16297 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16298         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16299         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16300         return ret_conv;
16301 }
16302
16303 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16304         if (!ptr_is_owned(_res)) return;
16305         void* _res_ptr = untag_ptr(_res);
16306         CHECK_ACCESS(_res_ptr);
16307         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16308         FREE(untag_ptr(_res));
16309         CResult_PaymentSecretNoneZ_free(_res_conv);
16310 }
16311
16312 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16313         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16314         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16315         return tag_ptr(ret_conv, true);
16316 }
16317 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16318         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16319         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16320         return ret_conv;
16321 }
16322
16323 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16324         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16325         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16326         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16327         return tag_ptr(ret_conv, true);
16328 }
16329
16330 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16331         LDKThirtyTwoBytes o_ref;
16332         CHECK(o->arr_len == 32);
16333         memcpy(o_ref.data, o->elems, 32); FREE(o);
16334         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16335         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16336         return tag_ptr(ret_conv, true);
16337 }
16338
16339 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16340         void* e_ptr = untag_ptr(e);
16341         CHECK_ACCESS(e_ptr);
16342         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16343         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16344         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16345         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16346         return tag_ptr(ret_conv, true);
16347 }
16348
16349 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16350         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16351         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16352         return ret_conv;
16353 }
16354
16355 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16356         if (!ptr_is_owned(_res)) return;
16357         void* _res_ptr = untag_ptr(_res);
16358         CHECK_ACCESS(_res_ptr);
16359         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16360         FREE(untag_ptr(_res));
16361         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16362 }
16363
16364 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16365         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16366         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16367         return tag_ptr(ret_conv, true);
16368 }
16369 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16370         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16371         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16372         return ret_conv;
16373 }
16374
16375 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16376         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16377         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16378         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16379         return tag_ptr(ret_conv, true);
16380 }
16381
16382 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16383         LDKThirtyTwoBytes o_ref;
16384         CHECK(o->arr_len == 32);
16385         memcpy(o_ref.data, o->elems, 32); FREE(o);
16386         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16387         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16388         return tag_ptr(ret_conv, true);
16389 }
16390
16391 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
16392         void* e_ptr = untag_ptr(e);
16393         CHECK_ACCESS(e_ptr);
16394         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16395         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16396         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16397         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16398         return tag_ptr(ret_conv, true);
16399 }
16400
16401 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
16402         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
16403         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16404         return ret_conv;
16405 }
16406
16407 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
16408         if (!ptr_is_owned(_res)) return;
16409         void* _res_ptr = untag_ptr(_res);
16410         CHECK_ACCESS(_res_ptr);
16411         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16412         FREE(untag_ptr(_res));
16413         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16414 }
16415
16416 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16417         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16418         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16419         return tag_ptr(ret_conv, true);
16420 }
16421 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
16422         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
16423         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16424         return ret_conv;
16425 }
16426
16427 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
16428         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
16429         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16430         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16431         return tag_ptr(ret_conv, true);
16432 }
16433
16434 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
16435         LDKCounterpartyForwardingInfo o_conv;
16436         o_conv.inner = untag_ptr(o);
16437         o_conv.is_owned = ptr_is_owned(o);
16438         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16439         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
16440         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16441         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
16442         return tag_ptr(ret_conv, true);
16443 }
16444
16445 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
16446         void* e_ptr = untag_ptr(e);
16447         CHECK_ACCESS(e_ptr);
16448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16450         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16451         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
16456         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
16457         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
16458         return ret_conv;
16459 }
16460
16461 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
16462         if (!ptr_is_owned(_res)) return;
16463         void* _res_ptr = untag_ptr(_res);
16464         CHECK_ACCESS(_res_ptr);
16465         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
16466         FREE(untag_ptr(_res));
16467         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
16468 }
16469
16470 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
16471         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16472         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
16473         return tag_ptr(ret_conv, true);
16474 }
16475 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16476         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
16477         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
16478         return ret_conv;
16479 }
16480
16481 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
16482         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
16483         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16484         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
16485         return tag_ptr(ret_conv, true);
16486 }
16487
16488 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
16489         LDKChannelCounterparty o_conv;
16490         o_conv.inner = untag_ptr(o);
16491         o_conv.is_owned = ptr_is_owned(o);
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16493         o_conv = ChannelCounterparty_clone(&o_conv);
16494         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16495         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
16496         return tag_ptr(ret_conv, true);
16497 }
16498
16499 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
16500         void* e_ptr = untag_ptr(e);
16501         CHECK_ACCESS(e_ptr);
16502         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16503         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16504         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16505         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
16506         return tag_ptr(ret_conv, true);
16507 }
16508
16509 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
16510         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
16511         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
16512         return ret_conv;
16513 }
16514
16515 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
16516         if (!ptr_is_owned(_res)) return;
16517         void* _res_ptr = untag_ptr(_res);
16518         CHECK_ACCESS(_res_ptr);
16519         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
16520         FREE(untag_ptr(_res));
16521         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
16522 }
16523
16524 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
16525         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16526         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
16527         return tag_ptr(ret_conv, true);
16528 }
16529 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
16530         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
16531         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
16532         return ret_conv;
16533 }
16534
16535 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
16536         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
16537         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16538         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
16539         return tag_ptr(ret_conv, true);
16540 }
16541
16542 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
16543         LDKChannelDetails o_conv;
16544         o_conv.inner = untag_ptr(o);
16545         o_conv.is_owned = ptr_is_owned(o);
16546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16547         o_conv = ChannelDetails_clone(&o_conv);
16548         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16549         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
16550         return tag_ptr(ret_conv, true);
16551 }
16552
16553 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
16554         void* e_ptr = untag_ptr(e);
16555         CHECK_ACCESS(e_ptr);
16556         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16557         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16558         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16559         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
16560         return tag_ptr(ret_conv, true);
16561 }
16562
16563 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
16564         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
16565         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
16566         return ret_conv;
16567 }
16568
16569 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
16570         if (!ptr_is_owned(_res)) return;
16571         void* _res_ptr = untag_ptr(_res);
16572         CHECK_ACCESS(_res_ptr);
16573         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
16574         FREE(untag_ptr(_res));
16575         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
16576 }
16577
16578 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
16579         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16580         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
16581         return tag_ptr(ret_conv, true);
16582 }
16583 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
16584         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
16585         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
16586         return ret_conv;
16587 }
16588
16589 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
16590         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
16591         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16592         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
16593         return tag_ptr(ret_conv, true);
16594 }
16595
16596 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
16597         LDKPhantomRouteHints o_conv;
16598         o_conv.inner = untag_ptr(o);
16599         o_conv.is_owned = ptr_is_owned(o);
16600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16601         o_conv = PhantomRouteHints_clone(&o_conv);
16602         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16603         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
16604         return tag_ptr(ret_conv, true);
16605 }
16606
16607 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
16608         void* e_ptr = untag_ptr(e);
16609         CHECK_ACCESS(e_ptr);
16610         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16611         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16612         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16613         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
16614         return tag_ptr(ret_conv, true);
16615 }
16616
16617 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
16618         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
16619         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
16620         return ret_conv;
16621 }
16622
16623 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
16624         if (!ptr_is_owned(_res)) return;
16625         void* _res_ptr = untag_ptr(_res);
16626         CHECK_ACCESS(_res_ptr);
16627         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
16628         FREE(untag_ptr(_res));
16629         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
16630 }
16631
16632 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
16633         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16634         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
16635         return tag_ptr(ret_conv, true);
16636 }
16637 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
16638         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
16639         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16640         return ret_conv;
16641 }
16642
16643 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
16644         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
16645         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16646         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16647         return tag_ptr(ret_conv, true);
16648 }
16649
16650 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
16651         LDKCVec_ChannelMonitorZ _res_constr;
16652         _res_constr.datalen = _res->arr_len;
16653         if (_res_constr.datalen > 0)
16654                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16655         else
16656                 _res_constr.data = NULL;
16657         uint64_t* _res_vals = _res->elems;
16658         for (size_t q = 0; q < _res_constr.datalen; q++) {
16659                 uint64_t _res_conv_16 = _res_vals[q];
16660                 LDKChannelMonitor _res_conv_16_conv;
16661                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16662                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16663                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16664                 _res_constr.data[q] = _res_conv_16_conv;
16665         }
16666         FREE(_res);
16667         CVec_ChannelMonitorZ_free(_res_constr);
16668 }
16669
16670 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
16671         LDKThirtyTwoBytes a_ref;
16672         CHECK(a->arr_len == 32);
16673         memcpy(a_ref.data, a->elems, 32); FREE(a);
16674         LDKChannelManager b_conv;
16675         b_conv.inner = untag_ptr(b);
16676         b_conv.is_owned = ptr_is_owned(b);
16677         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16678         // WARNING: we need a move here but no clone is available for LDKChannelManager
16679         
16680         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16681         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16682         return tag_ptr(ret_conv, true);
16683 }
16684
16685 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
16686         if (!ptr_is_owned(_res)) return;
16687         void* _res_ptr = untag_ptr(_res);
16688         CHECK_ACCESS(_res_ptr);
16689         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16690         FREE(untag_ptr(_res));
16691         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16692 }
16693
16694 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
16695         void* o_ptr = untag_ptr(o);
16696         CHECK_ACCESS(o_ptr);
16697         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16698         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16699         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16700         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16701         return tag_ptr(ret_conv, true);
16702 }
16703
16704 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
16705         void* e_ptr = untag_ptr(e);
16706         CHECK_ACCESS(e_ptr);
16707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16709         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16710         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16711         return tag_ptr(ret_conv, true);
16712 }
16713
16714 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
16715         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
16716         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16717         return ret_conv;
16718 }
16719
16720 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
16721         if (!ptr_is_owned(_res)) return;
16722         void* _res_ptr = untag_ptr(_res);
16723         CHECK_ACCESS(_res_ptr);
16724         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16725         FREE(untag_ptr(_res));
16726         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16727 }
16728
16729 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
16730         LDKChannelConfig o_conv;
16731         o_conv.inner = untag_ptr(o);
16732         o_conv.is_owned = ptr_is_owned(o);
16733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16734         o_conv = ChannelConfig_clone(&o_conv);
16735         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16736         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16737         return tag_ptr(ret_conv, true);
16738 }
16739
16740 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
16741         void* e_ptr = untag_ptr(e);
16742         CHECK_ACCESS(e_ptr);
16743         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16744         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16745         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16746         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16747         return tag_ptr(ret_conv, true);
16748 }
16749
16750 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
16751         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
16752         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16753         return ret_conv;
16754 }
16755
16756 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
16757         if (!ptr_is_owned(_res)) return;
16758         void* _res_ptr = untag_ptr(_res);
16759         CHECK_ACCESS(_res_ptr);
16760         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16761         FREE(untag_ptr(_res));
16762         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16763 }
16764
16765 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16766         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16767         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16768         return tag_ptr(ret_conv, true);
16769 }
16770 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
16771         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
16772         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16773         return ret_conv;
16774 }
16775
16776 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
16777         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
16778         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16779         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16780         return tag_ptr(ret_conv, true);
16781 }
16782
16783 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
16784         LDKOutPoint o_conv;
16785         o_conv.inner = untag_ptr(o);
16786         o_conv.is_owned = ptr_is_owned(o);
16787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16788         o_conv = OutPoint_clone(&o_conv);
16789         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16790         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16791         return tag_ptr(ret_conv, true);
16792 }
16793
16794 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
16795         void* e_ptr = untag_ptr(e);
16796         CHECK_ACCESS(e_ptr);
16797         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16798         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16799         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16800         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16801         return tag_ptr(ret_conv, true);
16802 }
16803
16804 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
16805         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
16806         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16807         return ret_conv;
16808 }
16809
16810 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
16811         if (!ptr_is_owned(_res)) return;
16812         void* _res_ptr = untag_ptr(_res);
16813         CHECK_ACCESS(_res_ptr);
16814         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16815         FREE(untag_ptr(_res));
16816         CResult_OutPointDecodeErrorZ_free(_res_conv);
16817 }
16818
16819 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16820         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16821         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16822         return tag_ptr(ret_conv, true);
16823 }
16824 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
16825         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
16826         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16827         return ret_conv;
16828 }
16829
16830 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
16831         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
16832         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16833         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16834         return tag_ptr(ret_conv, true);
16835 }
16836
16837 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
16838         void* o_ptr = untag_ptr(o);
16839         CHECK_ACCESS(o_ptr);
16840         LDKType o_conv = *(LDKType*)(o_ptr);
16841         if (o_conv.free == LDKType_JCalls_free) {
16842                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16843                 LDKType_JCalls_cloned(&o_conv);
16844         }
16845         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16846         *ret_copy = COption_TypeZ_some(o_conv);
16847         uint64_t ret_ref = tag_ptr(ret_copy, true);
16848         return ret_ref;
16849 }
16850
16851 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16852         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16853         *ret_copy = COption_TypeZ_none();
16854         uint64_t ret_ref = tag_ptr(ret_copy, true);
16855         return ret_ref;
16856 }
16857
16858 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
16859         if (!ptr_is_owned(_res)) return;
16860         void* _res_ptr = untag_ptr(_res);
16861         CHECK_ACCESS(_res_ptr);
16862         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16863         FREE(untag_ptr(_res));
16864         COption_TypeZ_free(_res_conv);
16865 }
16866
16867 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16868         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16869         *ret_copy = COption_TypeZ_clone(arg);
16870         uint64_t ret_ref = tag_ptr(ret_copy, true);
16871         return ret_ref;
16872 }
16873 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
16874         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
16875         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16876         return ret_conv;
16877 }
16878
16879 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
16880         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
16881         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16882         *ret_copy = COption_TypeZ_clone(orig_conv);
16883         uint64_t ret_ref = tag_ptr(ret_copy, true);
16884         return ret_ref;
16885 }
16886
16887 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
16888         void* o_ptr = untag_ptr(o);
16889         CHECK_ACCESS(o_ptr);
16890         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16891         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
16892         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16893         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16894         return tag_ptr(ret_conv, true);
16895 }
16896
16897 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
16898         void* e_ptr = untag_ptr(e);
16899         CHECK_ACCESS(e_ptr);
16900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16902         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16903         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16904         return tag_ptr(ret_conv, true);
16905 }
16906
16907 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
16908         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
16909         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16910         return ret_conv;
16911 }
16912
16913 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
16914         if (!ptr_is_owned(_res)) return;
16915         void* _res_ptr = untag_ptr(_res);
16916         CHECK_ACCESS(_res_ptr);
16917         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16918         FREE(untag_ptr(_res));
16919         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16920 }
16921
16922 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16923         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16924         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16925         return tag_ptr(ret_conv, true);
16926 }
16927 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
16928         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
16929         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16930         return ret_conv;
16931 }
16932
16933 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
16934         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
16935         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16936         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16937         return tag_ptr(ret_conv, true);
16938 }
16939
16940 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16941         LDKThirtyTwoBytes o_ref;
16942         CHECK(o->arr_len == 32);
16943         memcpy(o_ref.data, o->elems, 32); FREE(o);
16944         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16945         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16946         return tag_ptr(ret_conv, true);
16947 }
16948
16949 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
16950         void* e_ptr = untag_ptr(e);
16951         CHECK_ACCESS(e_ptr);
16952         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16953         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
16954         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16955         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16956         return tag_ptr(ret_conv, true);
16957 }
16958
16959 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
16960         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
16961         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16962         return ret_conv;
16963 }
16964
16965 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
16966         if (!ptr_is_owned(_res)) return;
16967         void* _res_ptr = untag_ptr(_res);
16968         CHECK_ACCESS(_res_ptr);
16969         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16970         FREE(untag_ptr(_res));
16971         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16972 }
16973
16974 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16975         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16976         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16977         return tag_ptr(ret_conv, true);
16978 }
16979 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
16980         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
16981         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16982         return ret_conv;
16983 }
16984
16985 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
16986         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
16987         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16988         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16989         return tag_ptr(ret_conv, true);
16990 }
16991
16992 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16993         LDKInFlightHtlcs o_conv;
16994         o_conv.inner = untag_ptr(o);
16995         o_conv.is_owned = ptr_is_owned(o);
16996         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16997         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
16998         
16999         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17000         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
17001         return tag_ptr(ret_conv, true);
17002 }
17003
17004 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
17005         void* e_ptr = untag_ptr(e);
17006         CHECK_ACCESS(e_ptr);
17007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17009         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
17010         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
17011         return tag_ptr(ret_conv, true);
17012 }
17013
17014 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
17015         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
17016         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
17017         return ret_conv;
17018 }
17019
17020 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
17021         if (!ptr_is_owned(_res)) return;
17022         void* _res_ptr = untag_ptr(_res);
17023         CHECK_ACCESS(_res_ptr);
17024         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17025         FREE(untag_ptr(_res));
17026         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17027 }
17028
17029 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
17030         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
17031         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17032         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
17033         return tag_ptr(ret_conv, true);
17034 }
17035
17036 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
17037         void* e_ptr = untag_ptr(e);
17038         CHECK_ACCESS(e_ptr);
17039         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17040         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17041         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17042         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
17043         return tag_ptr(ret_conv, true);
17044 }
17045
17046 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
17047         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
17048         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
17049         return ret_conv;
17050 }
17051
17052 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
17053         if (!ptr_is_owned(_res)) return;
17054         void* _res_ptr = untag_ptr(_res);
17055         CHECK_ACCESS(_res_ptr);
17056         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
17057         FREE(untag_ptr(_res));
17058         CResult_SiPrefixParseErrorZ_free(_res_conv);
17059 }
17060
17061 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
17062         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17063         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
17064         return tag_ptr(ret_conv, true);
17065 }
17066 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
17067         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
17068         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
17069         return ret_conv;
17070 }
17071
17072 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
17073         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
17074         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17075         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
17076         return tag_ptr(ret_conv, true);
17077 }
17078
17079 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
17080         LDKInvoice o_conv;
17081         o_conv.inner = untag_ptr(o);
17082         o_conv.is_owned = ptr_is_owned(o);
17083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17084         o_conv = Invoice_clone(&o_conv);
17085         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17086         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
17087         return tag_ptr(ret_conv, true);
17088 }
17089
17090 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
17091         void* e_ptr = untag_ptr(e);
17092         CHECK_ACCESS(e_ptr);
17093         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
17094         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
17095         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17096         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
17097         return tag_ptr(ret_conv, true);
17098 }
17099
17100 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
17101         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
17102         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
17103         return ret_conv;
17104 }
17105
17106 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
17107         if (!ptr_is_owned(_res)) return;
17108         void* _res_ptr = untag_ptr(_res);
17109         CHECK_ACCESS(_res_ptr);
17110         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
17111         FREE(untag_ptr(_res));
17112         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
17113 }
17114
17115 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
17116         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17117         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
17118         return tag_ptr(ret_conv, true);
17119 }
17120 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
17121         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
17122         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
17123         return ret_conv;
17124 }
17125
17126 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
17127         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
17128         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17129         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
17130         return tag_ptr(ret_conv, true);
17131 }
17132
17133 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
17134         LDKSignedRawInvoice o_conv;
17135         o_conv.inner = untag_ptr(o);
17136         o_conv.is_owned = ptr_is_owned(o);
17137         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17138         o_conv = SignedRawInvoice_clone(&o_conv);
17139         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17140         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
17141         return tag_ptr(ret_conv, true);
17142 }
17143
17144 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
17145         void* e_ptr = untag_ptr(e);
17146         CHECK_ACCESS(e_ptr);
17147         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17148         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17149         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17150         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
17151         return tag_ptr(ret_conv, true);
17152 }
17153
17154 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
17155         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
17156         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
17157         return ret_conv;
17158 }
17159
17160 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
17161         if (!ptr_is_owned(_res)) return;
17162         void* _res_ptr = untag_ptr(_res);
17163         CHECK_ACCESS(_res_ptr);
17164         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
17165         FREE(untag_ptr(_res));
17166         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
17167 }
17168
17169 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
17170         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17171         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
17172         return tag_ptr(ret_conv, true);
17173 }
17174 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
17175         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
17176         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
17177         return ret_conv;
17178 }
17179
17180 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
17181         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
17182         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17183         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
17184         return tag_ptr(ret_conv, true);
17185 }
17186
17187 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17188         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17189         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17190         return tag_ptr(ret_conv, true);
17191 }
17192 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
17193         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
17194         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17195         return ret_conv;
17196 }
17197
17198 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
17199         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
17200         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17201         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17202         return tag_ptr(ret_conv, true);
17203 }
17204
17205 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
17206         LDKRawInvoice a_conv;
17207         a_conv.inner = untag_ptr(a);
17208         a_conv.is_owned = ptr_is_owned(a);
17209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17210         a_conv = RawInvoice_clone(&a_conv);
17211         LDKThirtyTwoBytes b_ref;
17212         CHECK(b->arr_len == 32);
17213         memcpy(b_ref.data, b->elems, 32); FREE(b);
17214         LDKInvoiceSignature c_conv;
17215         c_conv.inner = untag_ptr(c);
17216         c_conv.is_owned = ptr_is_owned(c);
17217         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17218         c_conv = InvoiceSignature_clone(&c_conv);
17219         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17220         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17221         return tag_ptr(ret_conv, true);
17222 }
17223
17224 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
17225         if (!ptr_is_owned(_res)) return;
17226         void* _res_ptr = untag_ptr(_res);
17227         CHECK_ACCESS(_res_ptr);
17228         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17229         FREE(untag_ptr(_res));
17230         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17231 }
17232
17233 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
17234         LDKPayeePubKey o_conv;
17235         o_conv.inner = untag_ptr(o);
17236         o_conv.is_owned = ptr_is_owned(o);
17237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17238         o_conv = PayeePubKey_clone(&o_conv);
17239         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17240         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17241         return tag_ptr(ret_conv, true);
17242 }
17243
17244 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
17245         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17246         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17247         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17248         return tag_ptr(ret_conv, true);
17249 }
17250
17251 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
17252         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
17253         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17254         return ret_conv;
17255 }
17256
17257 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
17258         if (!ptr_is_owned(_res)) return;
17259         void* _res_ptr = untag_ptr(_res);
17260         CHECK_ACCESS(_res_ptr);
17261         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17262         FREE(untag_ptr(_res));
17263         CResult_PayeePubKeyErrorZ_free(_res_conv);
17264 }
17265
17266 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17267         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17268         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17269         return tag_ptr(ret_conv, true);
17270 }
17271 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
17272         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
17273         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17274         return ret_conv;
17275 }
17276
17277 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
17278         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
17279         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17280         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17281         return tag_ptr(ret_conv, true);
17282 }
17283
17284 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
17285         LDKCVec_PrivateRouteZ _res_constr;
17286         _res_constr.datalen = _res->arr_len;
17287         if (_res_constr.datalen > 0)
17288                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17289         else
17290                 _res_constr.data = NULL;
17291         uint64_t* _res_vals = _res->elems;
17292         for (size_t o = 0; o < _res_constr.datalen; o++) {
17293                 uint64_t _res_conv_14 = _res_vals[o];
17294                 LDKPrivateRoute _res_conv_14_conv;
17295                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17296                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17297                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17298                 _res_constr.data[o] = _res_conv_14_conv;
17299         }
17300         FREE(_res);
17301         CVec_PrivateRouteZ_free(_res_constr);
17302 }
17303
17304 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
17305         LDKPositiveTimestamp o_conv;
17306         o_conv.inner = untag_ptr(o);
17307         o_conv.is_owned = ptr_is_owned(o);
17308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17309         o_conv = PositiveTimestamp_clone(&o_conv);
17310         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17311         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17312         return tag_ptr(ret_conv, true);
17313 }
17314
17315 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
17316         LDKCreationError e_conv = LDKCreationError_from_js(e);
17317         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17318         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17319         return tag_ptr(ret_conv, true);
17320 }
17321
17322 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
17323         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
17324         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17325         return ret_conv;
17326 }
17327
17328 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
17329         if (!ptr_is_owned(_res)) return;
17330         void* _res_ptr = untag_ptr(_res);
17331         CHECK_ACCESS(_res_ptr);
17332         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17333         FREE(untag_ptr(_res));
17334         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17335 }
17336
17337 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17338         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17339         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17340         return tag_ptr(ret_conv, true);
17341 }
17342 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
17343         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
17344         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17345         return ret_conv;
17346 }
17347
17348 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
17349         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
17350         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17351         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17352         return tag_ptr(ret_conv, true);
17353 }
17354
17355 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
17356         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17357         *ret_conv = CResult_NoneSemanticErrorZ_ok();
17358         return tag_ptr(ret_conv, true);
17359 }
17360
17361 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
17362         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17363         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17364         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17365         return tag_ptr(ret_conv, true);
17366 }
17367
17368 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
17369         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
17370         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17371         return ret_conv;
17372 }
17373
17374 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
17375         if (!ptr_is_owned(_res)) return;
17376         void* _res_ptr = untag_ptr(_res);
17377         CHECK_ACCESS(_res_ptr);
17378         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17379         FREE(untag_ptr(_res));
17380         CResult_NoneSemanticErrorZ_free(_res_conv);
17381 }
17382
17383 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17384         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17385         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17386         return tag_ptr(ret_conv, true);
17387 }
17388 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
17389         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
17390         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17391         return ret_conv;
17392 }
17393
17394 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
17395         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
17396         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17397         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17398         return tag_ptr(ret_conv, true);
17399 }
17400
17401 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
17402         LDKInvoice o_conv;
17403         o_conv.inner = untag_ptr(o);
17404         o_conv.is_owned = ptr_is_owned(o);
17405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17406         o_conv = Invoice_clone(&o_conv);
17407         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17408         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17409         return tag_ptr(ret_conv, true);
17410 }
17411
17412 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
17413         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17414         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17415         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17416         return tag_ptr(ret_conv, true);
17417 }
17418
17419 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
17420         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
17421         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17422         return ret_conv;
17423 }
17424
17425 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
17426         if (!ptr_is_owned(_res)) return;
17427         void* _res_ptr = untag_ptr(_res);
17428         CHECK_ACCESS(_res_ptr);
17429         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17430         FREE(untag_ptr(_res));
17431         CResult_InvoiceSemanticErrorZ_free(_res_conv);
17432 }
17433
17434 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17435         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17436         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17437         return tag_ptr(ret_conv, true);
17438 }
17439 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
17440         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
17441         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17442         return ret_conv;
17443 }
17444
17445 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
17446         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
17447         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17448         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17449         return tag_ptr(ret_conv, true);
17450 }
17451
17452 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
17453         LDKDescription o_conv;
17454         o_conv.inner = untag_ptr(o);
17455         o_conv.is_owned = ptr_is_owned(o);
17456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17457         o_conv = Description_clone(&o_conv);
17458         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17459         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17460         return tag_ptr(ret_conv, true);
17461 }
17462
17463 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
17464         LDKCreationError e_conv = LDKCreationError_from_js(e);
17465         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17466         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17467         return tag_ptr(ret_conv, true);
17468 }
17469
17470 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
17471         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
17472         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17473         return ret_conv;
17474 }
17475
17476 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
17477         if (!ptr_is_owned(_res)) return;
17478         void* _res_ptr = untag_ptr(_res);
17479         CHECK_ACCESS(_res_ptr);
17480         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17481         FREE(untag_ptr(_res));
17482         CResult_DescriptionCreationErrorZ_free(_res_conv);
17483 }
17484
17485 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17486         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17487         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17488         return tag_ptr(ret_conv, true);
17489 }
17490 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
17491         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
17492         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17493         return ret_conv;
17494 }
17495
17496 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
17497         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
17498         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17499         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17500         return tag_ptr(ret_conv, true);
17501 }
17502
17503 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
17504         LDKPrivateRoute o_conv;
17505         o_conv.inner = untag_ptr(o);
17506         o_conv.is_owned = ptr_is_owned(o);
17507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17508         o_conv = PrivateRoute_clone(&o_conv);
17509         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17510         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17511         return tag_ptr(ret_conv, true);
17512 }
17513
17514 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
17515         LDKCreationError e_conv = LDKCreationError_from_js(e);
17516         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17517         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17518         return tag_ptr(ret_conv, true);
17519 }
17520
17521 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
17522         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
17523         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17524         return ret_conv;
17525 }
17526
17527 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
17528         if (!ptr_is_owned(_res)) return;
17529         void* _res_ptr = untag_ptr(_res);
17530         CHECK_ACCESS(_res_ptr);
17531         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17532         FREE(untag_ptr(_res));
17533         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17534 }
17535
17536 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17537         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17538         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17539         return tag_ptr(ret_conv, true);
17540 }
17541 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
17542         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
17543         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17544         return ret_conv;
17545 }
17546
17547 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
17548         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
17549         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17550         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17551         return tag_ptr(ret_conv, true);
17552 }
17553
17554 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17555         LDKStr o_conv = str_ref_to_owned_c(o);
17556         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17557         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17558         return tag_ptr(ret_conv, true);
17559 }
17560
17561 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17562         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17563         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17564         *ret_conv = CResult_StringErrorZ_err(e_conv);
17565         return tag_ptr(ret_conv, true);
17566 }
17567
17568 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17569         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17570         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17571         return ret_conv;
17572 }
17573
17574 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17575         if (!ptr_is_owned(_res)) return;
17576         void* _res_ptr = untag_ptr(_res);
17577         CHECK_ACCESS(_res_ptr);
17578         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17579         FREE(untag_ptr(_res));
17580         CResult_StringErrorZ_free(_res_conv);
17581 }
17582
17583 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17584         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17585         *ret_conv = CResult_StringErrorZ_clone(arg);
17586         return tag_ptr(ret_conv, true);
17587 }
17588 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17589         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17590         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17591         return ret_conv;
17592 }
17593
17594 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17595         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17596         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17597         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17598         return tag_ptr(ret_conv, true);
17599 }
17600
17601 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17602         LDKChannelMonitorUpdate o_conv;
17603         o_conv.inner = untag_ptr(o);
17604         o_conv.is_owned = ptr_is_owned(o);
17605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17606         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17607         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17608         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17609         return tag_ptr(ret_conv, true);
17610 }
17611
17612 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17613         void* e_ptr = untag_ptr(e);
17614         CHECK_ACCESS(e_ptr);
17615         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17616         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17617         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17618         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17619         return tag_ptr(ret_conv, true);
17620 }
17621
17622 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17623         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17624         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17625         return ret_conv;
17626 }
17627
17628 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17629         if (!ptr_is_owned(_res)) return;
17630         void* _res_ptr = untag_ptr(_res);
17631         CHECK_ACCESS(_res_ptr);
17632         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17633         FREE(untag_ptr(_res));
17634         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17635 }
17636
17637 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17638         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17639         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17640         return tag_ptr(ret_conv, true);
17641 }
17642 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17643         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17644         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17645         return ret_conv;
17646 }
17647
17648 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17649         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17650         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17651         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17652         return tag_ptr(ret_conv, true);
17653 }
17654
17655 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17656         void* o_ptr = untag_ptr(o);
17657         CHECK_ACCESS(o_ptr);
17658         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17659         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17660         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17661         *ret_copy = COption_MonitorEventZ_some(o_conv);
17662         uint64_t ret_ref = tag_ptr(ret_copy, true);
17663         return ret_ref;
17664 }
17665
17666 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17667         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17668         *ret_copy = COption_MonitorEventZ_none();
17669         uint64_t ret_ref = tag_ptr(ret_copy, true);
17670         return ret_ref;
17671 }
17672
17673 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17674         if (!ptr_is_owned(_res)) return;
17675         void* _res_ptr = untag_ptr(_res);
17676         CHECK_ACCESS(_res_ptr);
17677         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17678         FREE(untag_ptr(_res));
17679         COption_MonitorEventZ_free(_res_conv);
17680 }
17681
17682 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17683         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17684         *ret_copy = COption_MonitorEventZ_clone(arg);
17685         uint64_t ret_ref = tag_ptr(ret_copy, true);
17686         return ret_ref;
17687 }
17688 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17689         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17690         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17691         return ret_conv;
17692 }
17693
17694 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17695         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17696         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17697         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17698         uint64_t ret_ref = tag_ptr(ret_copy, true);
17699         return ret_ref;
17700 }
17701
17702 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17703         void* o_ptr = untag_ptr(o);
17704         CHECK_ACCESS(o_ptr);
17705         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17706         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17707         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17708         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17709         return tag_ptr(ret_conv, true);
17710 }
17711
17712 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17713         void* e_ptr = untag_ptr(e);
17714         CHECK_ACCESS(e_ptr);
17715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17717         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17718         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17719         return tag_ptr(ret_conv, true);
17720 }
17721
17722 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17723         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17724         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17725         return ret_conv;
17726 }
17727
17728 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17729         if (!ptr_is_owned(_res)) return;
17730         void* _res_ptr = untag_ptr(_res);
17731         CHECK_ACCESS(_res_ptr);
17732         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17733         FREE(untag_ptr(_res));
17734         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17735 }
17736
17737 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17738         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17739         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17740         return tag_ptr(ret_conv, true);
17741 }
17742 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17743         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17744         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17745         return ret_conv;
17746 }
17747
17748 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17749         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17750         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17751         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17752         return tag_ptr(ret_conv, true);
17753 }
17754
17755 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17756         LDKHTLCUpdate o_conv;
17757         o_conv.inner = untag_ptr(o);
17758         o_conv.is_owned = ptr_is_owned(o);
17759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17760         o_conv = HTLCUpdate_clone(&o_conv);
17761         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17762         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17763         return tag_ptr(ret_conv, true);
17764 }
17765
17766 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17767         void* e_ptr = untag_ptr(e);
17768         CHECK_ACCESS(e_ptr);
17769         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17770         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17771         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17772         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17773         return tag_ptr(ret_conv, true);
17774 }
17775
17776 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17777         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17778         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17779         return ret_conv;
17780 }
17781
17782 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17783         if (!ptr_is_owned(_res)) return;
17784         void* _res_ptr = untag_ptr(_res);
17785         CHECK_ACCESS(_res_ptr);
17786         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17787         FREE(untag_ptr(_res));
17788         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17789 }
17790
17791 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17792         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17793         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17794         return tag_ptr(ret_conv, true);
17795 }
17796 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17797         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17798         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17799         return ret_conv;
17800 }
17801
17802 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17803         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17804         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17805         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17806         return tag_ptr(ret_conv, true);
17807 }
17808
17809 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17810         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17811         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17812         return tag_ptr(ret_conv, true);
17813 }
17814 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17815         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17816         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17817         return ret_conv;
17818 }
17819
17820 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17821         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17822         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17823         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17824         return tag_ptr(ret_conv, true);
17825 }
17826
17827 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17828         LDKOutPoint a_conv;
17829         a_conv.inner = untag_ptr(a);
17830         a_conv.is_owned = ptr_is_owned(a);
17831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17832         a_conv = OutPoint_clone(&a_conv);
17833         LDKCVec_u8Z b_ref;
17834         b_ref.datalen = b->arr_len;
17835         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17836         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17837         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17838         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17839         return tag_ptr(ret_conv, true);
17840 }
17841
17842 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17843         if (!ptr_is_owned(_res)) return;
17844         void* _res_ptr = untag_ptr(_res);
17845         CHECK_ACCESS(_res_ptr);
17846         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17847         FREE(untag_ptr(_res));
17848         C2Tuple_OutPointScriptZ_free(_res_conv);
17849 }
17850
17851 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17852         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17853         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17854         return tag_ptr(ret_conv, true);
17855 }
17856 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
17857         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
17858         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17859         return ret_conv;
17860 }
17861
17862 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
17863         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
17864         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17865         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17866         return tag_ptr(ret_conv, true);
17867 }
17868
17869 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17870         LDKCVec_u8Z b_ref;
17871         b_ref.datalen = b->arr_len;
17872         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17873         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17874         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17875         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17876         return tag_ptr(ret_conv, true);
17877 }
17878
17879 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
17880         if (!ptr_is_owned(_res)) return;
17881         void* _res_ptr = untag_ptr(_res);
17882         CHECK_ACCESS(_res_ptr);
17883         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17884         FREE(untag_ptr(_res));
17885         C2Tuple_u32ScriptZ_free(_res_conv);
17886 }
17887
17888 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
17889         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17890         _res_constr.datalen = _res->arr_len;
17891         if (_res_constr.datalen > 0)
17892                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17893         else
17894                 _res_constr.data = NULL;
17895         uint64_t* _res_vals = _res->elems;
17896         for (size_t v = 0; v < _res_constr.datalen; v++) {
17897                 uint64_t _res_conv_21 = _res_vals[v];
17898                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
17899                 CHECK_ACCESS(_res_conv_21_ptr);
17900                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17901                 FREE(untag_ptr(_res_conv_21));
17902                 _res_constr.data[v] = _res_conv_21_conv;
17903         }
17904         FREE(_res);
17905         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17906 }
17907
17908 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17909         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17910         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17911         return tag_ptr(ret_conv, true);
17912 }
17913 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
17914         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
17915         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17916         return ret_conv;
17917 }
17918
17919 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
17920         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
17921         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17922         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17923         return tag_ptr(ret_conv, true);
17924 }
17925
17926 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
17927         LDKThirtyTwoBytes a_ref;
17928         CHECK(a->arr_len == 32);
17929         memcpy(a_ref.data, a->elems, 32); FREE(a);
17930         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17931         b_constr.datalen = b->arr_len;
17932         if (b_constr.datalen > 0)
17933                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17934         else
17935                 b_constr.data = NULL;
17936         uint64_t* b_vals = b->elems;
17937         for (size_t v = 0; v < b_constr.datalen; v++) {
17938                 uint64_t b_conv_21 = b_vals[v];
17939                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
17940                 CHECK_ACCESS(b_conv_21_ptr);
17941                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17942                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
17943                 b_constr.data[v] = b_conv_21_conv;
17944         }
17945         FREE(b);
17946         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17947         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17948         return tag_ptr(ret_conv, true);
17949 }
17950
17951 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
17952         if (!ptr_is_owned(_res)) return;
17953         void* _res_ptr = untag_ptr(_res);
17954         CHECK_ACCESS(_res_ptr);
17955         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17956         FREE(untag_ptr(_res));
17957         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17958 }
17959
17960 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
17961         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17962         _res_constr.datalen = _res->arr_len;
17963         if (_res_constr.datalen > 0)
17964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17965         else
17966                 _res_constr.data = NULL;
17967         uint64_t* _res_vals = _res->elems;
17968         for (size_t o = 0; o < _res_constr.datalen; o++) {
17969                 uint64_t _res_conv_40 = _res_vals[o];
17970                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
17971                 CHECK_ACCESS(_res_conv_40_ptr);
17972                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17973                 FREE(untag_ptr(_res_conv_40));
17974                 _res_constr.data[o] = _res_conv_40_conv;
17975         }
17976         FREE(_res);
17977         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17978 }
17979
17980 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
17981         LDKCVec_EventZ _res_constr;
17982         _res_constr.datalen = _res->arr_len;
17983         if (_res_constr.datalen > 0)
17984                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17985         else
17986                 _res_constr.data = NULL;
17987         uint64_t* _res_vals = _res->elems;
17988         for (size_t h = 0; h < _res_constr.datalen; h++) {
17989                 uint64_t _res_conv_7 = _res_vals[h];
17990                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17991                 CHECK_ACCESS(_res_conv_7_ptr);
17992                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17993                 FREE(untag_ptr(_res_conv_7));
17994                 _res_constr.data[h] = _res_conv_7_conv;
17995         }
17996         FREE(_res);
17997         CVec_EventZ_free(_res_constr);
17998 }
17999
18000 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18001         LDKCVec_TransactionZ _res_constr;
18002         _res_constr.datalen = _res->arr_len;
18003         if (_res_constr.datalen > 0)
18004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18005         else
18006                 _res_constr.data = NULL;
18007         int8_tArray* _res_vals = (void*) _res->elems;
18008         for (size_t m = 0; m < _res_constr.datalen; m++) {
18009                 int8_tArray _res_conv_12 = _res_vals[m];
18010                 LDKTransaction _res_conv_12_ref;
18011                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18012                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18013                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18014                 _res_conv_12_ref.data_is_owned = true;
18015                 _res_constr.data[m] = _res_conv_12_ref;
18016         }
18017         FREE(_res);
18018         CVec_TransactionZ_free(_res_constr);
18019 }
18020
18021 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18022         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18023         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18024         return tag_ptr(ret_conv, true);
18025 }
18026 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18027         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18028         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18029         return ret_conv;
18030 }
18031
18032 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18033         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18034         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18035         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18036         return tag_ptr(ret_conv, true);
18037 }
18038
18039 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18040         void* b_ptr = untag_ptr(b);
18041         CHECK_ACCESS(b_ptr);
18042         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18043         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18044         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18045         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18046         return tag_ptr(ret_conv, true);
18047 }
18048
18049 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18050         if (!ptr_is_owned(_res)) return;
18051         void* _res_ptr = untag_ptr(_res);
18052         CHECK_ACCESS(_res_ptr);
18053         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18054         FREE(untag_ptr(_res));
18055         C2Tuple_u32TxOutZ_free(_res_conv);
18056 }
18057
18058 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18059         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18060         _res_constr.datalen = _res->arr_len;
18061         if (_res_constr.datalen > 0)
18062                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18063         else
18064                 _res_constr.data = NULL;
18065         uint64_t* _res_vals = _res->elems;
18066         for (size_t u = 0; u < _res_constr.datalen; u++) {
18067                 uint64_t _res_conv_20 = _res_vals[u];
18068                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18069                 CHECK_ACCESS(_res_conv_20_ptr);
18070                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18071                 FREE(untag_ptr(_res_conv_20));
18072                 _res_constr.data[u] = _res_conv_20_conv;
18073         }
18074         FREE(_res);
18075         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18076 }
18077
18078 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18079         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18080         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18081         return tag_ptr(ret_conv, true);
18082 }
18083 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18084         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18085         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18086         return ret_conv;
18087 }
18088
18089 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18090         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18091         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18092         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18093         return tag_ptr(ret_conv, true);
18094 }
18095
18096 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18097         LDKThirtyTwoBytes a_ref;
18098         CHECK(a->arr_len == 32);
18099         memcpy(a_ref.data, a->elems, 32); FREE(a);
18100         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18101         b_constr.datalen = b->arr_len;
18102         if (b_constr.datalen > 0)
18103                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18104         else
18105                 b_constr.data = NULL;
18106         uint64_t* b_vals = b->elems;
18107         for (size_t u = 0; u < b_constr.datalen; u++) {
18108                 uint64_t b_conv_20 = b_vals[u];
18109                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18110                 CHECK_ACCESS(b_conv_20_ptr);
18111                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18112                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18113                 b_constr.data[u] = b_conv_20_conv;
18114         }
18115         FREE(b);
18116         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18117         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18118         return tag_ptr(ret_conv, true);
18119 }
18120
18121 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18122         if (!ptr_is_owned(_res)) return;
18123         void* _res_ptr = untag_ptr(_res);
18124         CHECK_ACCESS(_res_ptr);
18125         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18126         FREE(untag_ptr(_res));
18127         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18128 }
18129
18130 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18131         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18132         _res_constr.datalen = _res->arr_len;
18133         if (_res_constr.datalen > 0)
18134                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18135         else
18136                 _res_constr.data = NULL;
18137         uint64_t* _res_vals = _res->elems;
18138         for (size_t n = 0; n < _res_constr.datalen; n++) {
18139                 uint64_t _res_conv_39 = _res_vals[n];
18140                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18141                 CHECK_ACCESS(_res_conv_39_ptr);
18142                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18143                 FREE(untag_ptr(_res_conv_39));
18144                 _res_constr.data[n] = _res_conv_39_conv;
18145         }
18146         FREE(_res);
18147         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18148 }
18149
18150 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18151         LDKCVec_BalanceZ _res_constr;
18152         _res_constr.datalen = _res->arr_len;
18153         if (_res_constr.datalen > 0)
18154                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18155         else
18156                 _res_constr.data = NULL;
18157         uint64_t* _res_vals = _res->elems;
18158         for (size_t j = 0; j < _res_constr.datalen; j++) {
18159                 uint64_t _res_conv_9 = _res_vals[j];
18160                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18161                 CHECK_ACCESS(_res_conv_9_ptr);
18162                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18163                 FREE(untag_ptr(_res_conv_9));
18164                 _res_constr.data[j] = _res_conv_9_conv;
18165         }
18166         FREE(_res);
18167         CVec_BalanceZ_free(_res_constr);
18168 }
18169
18170 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18171         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18172         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18173         return tag_ptr(ret_conv, true);
18174 }
18175 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18176         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18177         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18178         return ret_conv;
18179 }
18180
18181 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18182         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18183         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18184         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18185         return tag_ptr(ret_conv, true);
18186 }
18187
18188 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18189         LDKThirtyTwoBytes a_ref;
18190         CHECK(a->arr_len == 32);
18191         memcpy(a_ref.data, a->elems, 32); FREE(a);
18192         LDKChannelMonitor b_conv;
18193         b_conv.inner = untag_ptr(b);
18194         b_conv.is_owned = ptr_is_owned(b);
18195         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18196         b_conv = ChannelMonitor_clone(&b_conv);
18197         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18198         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18199         return tag_ptr(ret_conv, true);
18200 }
18201
18202 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18203         if (!ptr_is_owned(_res)) return;
18204         void* _res_ptr = untag_ptr(_res);
18205         CHECK_ACCESS(_res_ptr);
18206         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18207         FREE(untag_ptr(_res));
18208         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18209 }
18210
18211 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18212         void* o_ptr = untag_ptr(o);
18213         CHECK_ACCESS(o_ptr);
18214         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18215         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18216         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18217         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18218         return tag_ptr(ret_conv, true);
18219 }
18220
18221 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18222         void* e_ptr = untag_ptr(e);
18223         CHECK_ACCESS(e_ptr);
18224         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18225         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18226         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18227         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18228         return tag_ptr(ret_conv, true);
18229 }
18230
18231 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18232         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18233         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18234         return ret_conv;
18235 }
18236
18237 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18238         if (!ptr_is_owned(_res)) return;
18239         void* _res_ptr = untag_ptr(_res);
18240         CHECK_ACCESS(_res_ptr);
18241         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18242         FREE(untag_ptr(_res));
18243         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18244 }
18245
18246 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18247         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18248         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18249         return tag_ptr(ret_conv, true);
18250 }
18251 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18252         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18253         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18254         return ret_conv;
18255 }
18256
18257 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18258         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18259         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18260         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18261         return tag_ptr(ret_conv, true);
18262 }
18263
18264 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18265         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18266         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18267         return tag_ptr(ret_conv, true);
18268 }
18269 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18270         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18271         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18272         return ret_conv;
18273 }
18274
18275 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18276         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18277         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18278         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18279         return tag_ptr(ret_conv, true);
18280 }
18281
18282 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18283         LDKPublicKey a_ref;
18284         CHECK(a->arr_len == 33);
18285         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18286         void* b_ptr = untag_ptr(b);
18287         CHECK_ACCESS(b_ptr);
18288         LDKType b_conv = *(LDKType*)(b_ptr);
18289         if (b_conv.free == LDKType_JCalls_free) {
18290                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18291                 LDKType_JCalls_cloned(&b_conv);
18292         }
18293         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18294         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18295         return tag_ptr(ret_conv, true);
18296 }
18297
18298 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18299         if (!ptr_is_owned(_res)) return;
18300         void* _res_ptr = untag_ptr(_res);
18301         CHECK_ACCESS(_res_ptr);
18302         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18303         FREE(untag_ptr(_res));
18304         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18305 }
18306
18307 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18308         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18309         _res_constr.datalen = _res->arr_len;
18310         if (_res_constr.datalen > 0)
18311                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18312         else
18313                 _res_constr.data = NULL;
18314         uint64_t* _res_vals = _res->elems;
18315         for (size_t z = 0; z < _res_constr.datalen; z++) {
18316                 uint64_t _res_conv_25 = _res_vals[z];
18317                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18318                 CHECK_ACCESS(_res_conv_25_ptr);
18319                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18320                 FREE(untag_ptr(_res_conv_25));
18321                 _res_constr.data[z] = _res_conv_25_conv;
18322         }
18323         FREE(_res);
18324         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18325 }
18326
18327 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18328         void* o_ptr = untag_ptr(o);
18329         CHECK_ACCESS(o_ptr);
18330         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18331         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18332                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18333                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18334         }
18335         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18336         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18337         uint64_t ret_ref = tag_ptr(ret_copy, true);
18338         return ret_ref;
18339 }
18340
18341 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18342         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18343         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18344         uint64_t ret_ref = tag_ptr(ret_copy, true);
18345         return ret_ref;
18346 }
18347
18348 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18349         if (!ptr_is_owned(_res)) return;
18350         void* _res_ptr = untag_ptr(_res);
18351         CHECK_ACCESS(_res_ptr);
18352         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18353         FREE(untag_ptr(_res));
18354         COption_CustomOnionMessageContentsZ_free(_res_conv);
18355 }
18356
18357 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18358         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18359         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18360         uint64_t ret_ref = tag_ptr(ret_copy, true);
18361         return ret_ref;
18362 }
18363 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18364         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18365         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18366         return ret_conv;
18367 }
18368
18369 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18370         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18371         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18372         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18373         uint64_t ret_ref = tag_ptr(ret_copy, true);
18374         return ret_ref;
18375 }
18376
18377 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18378         void* o_ptr = untag_ptr(o);
18379         CHECK_ACCESS(o_ptr);
18380         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18381         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18382         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18383         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18384         return tag_ptr(ret_conv, true);
18385 }
18386
18387 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18388         void* e_ptr = untag_ptr(e);
18389         CHECK_ACCESS(e_ptr);
18390         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18391         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18392         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18393         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18394         return tag_ptr(ret_conv, true);
18395 }
18396
18397 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18398         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18399         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18400         return ret_conv;
18401 }
18402
18403 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18404         if (!ptr_is_owned(_res)) return;
18405         void* _res_ptr = untag_ptr(_res);
18406         CHECK_ACCESS(_res_ptr);
18407         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18408         FREE(untag_ptr(_res));
18409         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18410 }
18411
18412 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18413         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18414         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18415         return tag_ptr(ret_conv, true);
18416 }
18417 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18418         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18419         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18420         return ret_conv;
18421 }
18422
18423 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18424         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18425         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18426         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18427         return tag_ptr(ret_conv, true);
18428 }
18429
18430 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18431         void* o_ptr = untag_ptr(o);
18432         CHECK_ACCESS(o_ptr);
18433         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18434         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18435         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18436         *ret_copy = COption_NetAddressZ_some(o_conv);
18437         uint64_t ret_ref = tag_ptr(ret_copy, true);
18438         return ret_ref;
18439 }
18440
18441 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18442         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18443         *ret_copy = COption_NetAddressZ_none();
18444         uint64_t ret_ref = tag_ptr(ret_copy, true);
18445         return ret_ref;
18446 }
18447
18448 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18449         if (!ptr_is_owned(_res)) return;
18450         void* _res_ptr = untag_ptr(_res);
18451         CHECK_ACCESS(_res_ptr);
18452         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18453         FREE(untag_ptr(_res));
18454         COption_NetAddressZ_free(_res_conv);
18455 }
18456
18457 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18458         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18459         *ret_copy = COption_NetAddressZ_clone(arg);
18460         uint64_t ret_ref = tag_ptr(ret_copy, true);
18461         return ret_ref;
18462 }
18463 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18464         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18465         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18466         return ret_conv;
18467 }
18468
18469 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18470         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18471         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18472         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18473         uint64_t ret_ref = tag_ptr(ret_copy, true);
18474         return ret_ref;
18475 }
18476
18477 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18478         LDKCVec_u8Z o_ref;
18479         o_ref.datalen = o->arr_len;
18480         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18481         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18482         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18483         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18484         return tag_ptr(ret_conv, true);
18485 }
18486
18487 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18488         LDKPeerHandleError e_conv;
18489         e_conv.inner = untag_ptr(e);
18490         e_conv.is_owned = ptr_is_owned(e);
18491         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18492         e_conv = PeerHandleError_clone(&e_conv);
18493         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18494         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18495         return tag_ptr(ret_conv, true);
18496 }
18497
18498 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18499         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18500         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18501         return ret_conv;
18502 }
18503
18504 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18505         if (!ptr_is_owned(_res)) return;
18506         void* _res_ptr = untag_ptr(_res);
18507         CHECK_ACCESS(_res_ptr);
18508         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18509         FREE(untag_ptr(_res));
18510         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18511 }
18512
18513 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18514         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18515         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18516         return tag_ptr(ret_conv, true);
18517 }
18518 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18519         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18520         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18521         return ret_conv;
18522 }
18523
18524 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18525         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18526         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18527         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18528         return tag_ptr(ret_conv, true);
18529 }
18530
18531 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18532         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18533         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18534         return tag_ptr(ret_conv, true);
18535 }
18536
18537 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18538         LDKPeerHandleError e_conv;
18539         e_conv.inner = untag_ptr(e);
18540         e_conv.is_owned = ptr_is_owned(e);
18541         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18542         e_conv = PeerHandleError_clone(&e_conv);
18543         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18544         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18545         return tag_ptr(ret_conv, true);
18546 }
18547
18548 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18549         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18550         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18551         return ret_conv;
18552 }
18553
18554 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18555         if (!ptr_is_owned(_res)) return;
18556         void* _res_ptr = untag_ptr(_res);
18557         CHECK_ACCESS(_res_ptr);
18558         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18559         FREE(untag_ptr(_res));
18560         CResult_NonePeerHandleErrorZ_free(_res_conv);
18561 }
18562
18563 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18564         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18565         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18566         return tag_ptr(ret_conv, true);
18567 }
18568 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18569         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18570         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18571         return ret_conv;
18572 }
18573
18574 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18575         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18576         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18577         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18578         return tag_ptr(ret_conv, true);
18579 }
18580
18581 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18582         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18583         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18584         return tag_ptr(ret_conv, true);
18585 }
18586
18587 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18588         LDKPeerHandleError e_conv;
18589         e_conv.inner = untag_ptr(e);
18590         e_conv.is_owned = ptr_is_owned(e);
18591         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18592         e_conv = PeerHandleError_clone(&e_conv);
18593         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18594         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18595         return tag_ptr(ret_conv, true);
18596 }
18597
18598 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18599         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18600         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18601         return ret_conv;
18602 }
18603
18604 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18605         if (!ptr_is_owned(_res)) return;
18606         void* _res_ptr = untag_ptr(_res);
18607         CHECK_ACCESS(_res_ptr);
18608         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18609         FREE(untag_ptr(_res));
18610         CResult_boolPeerHandleErrorZ_free(_res_conv);
18611 }
18612
18613 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18614         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18615         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18616         return tag_ptr(ret_conv, true);
18617 }
18618 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18619         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18620         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18621         return ret_conv;
18622 }
18623
18624 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18625         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18626         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18627         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18628         return tag_ptr(ret_conv, true);
18629 }
18630
18631 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18632         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18633         *ret_conv = CResult_NoneSendErrorZ_ok();
18634         return tag_ptr(ret_conv, true);
18635 }
18636
18637 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18638         void* e_ptr = untag_ptr(e);
18639         CHECK_ACCESS(e_ptr);
18640         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18641         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18642         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18643         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18644         return tag_ptr(ret_conv, true);
18645 }
18646
18647 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18648         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18649         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18650         return ret_conv;
18651 }
18652
18653 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18654         if (!ptr_is_owned(_res)) return;
18655         void* _res_ptr = untag_ptr(_res);
18656         CHECK_ACCESS(_res_ptr);
18657         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18658         FREE(untag_ptr(_res));
18659         CResult_NoneSendErrorZ_free(_res_conv);
18660 }
18661
18662 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18663         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18664         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18665         return tag_ptr(ret_conv, true);
18666 }
18667
18668 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18669         void* e_ptr = untag_ptr(e);
18670         CHECK_ACCESS(e_ptr);
18671         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18672         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18673         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18674         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18675         return tag_ptr(ret_conv, true);
18676 }
18677
18678 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18679         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18680         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18681         return ret_conv;
18682 }
18683
18684 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18685         if (!ptr_is_owned(_res)) return;
18686         void* _res_ptr = untag_ptr(_res);
18687         CHECK_ACCESS(_res_ptr);
18688         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18689         FREE(untag_ptr(_res));
18690         CResult_u32GraphSyncErrorZ_free(_res_conv);
18691 }
18692
18693 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
18694         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18695         *ret_conv = CResult_NoneErrorZ_ok();
18696         return tag_ptr(ret_conv, true);
18697 }
18698
18699 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
18700         LDKIOError e_conv = LDKIOError_from_js(e);
18701         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18702         *ret_conv = CResult_NoneErrorZ_err(e_conv);
18703         return tag_ptr(ret_conv, true);
18704 }
18705
18706 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
18707         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
18708         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
18709         return ret_conv;
18710 }
18711
18712 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
18713         if (!ptr_is_owned(_res)) return;
18714         void* _res_ptr = untag_ptr(_res);
18715         CHECK_ACCESS(_res_ptr);
18716         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
18717         FREE(untag_ptr(_res));
18718         CResult_NoneErrorZ_free(_res_conv);
18719 }
18720
18721 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
18722         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18723         *ret_conv = CResult_NoneErrorZ_clone(arg);
18724         return tag_ptr(ret_conv, true);
18725 }
18726 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
18727         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
18728         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
18729         return ret_conv;
18730 }
18731
18732 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
18733         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
18734         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18735         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
18736         return tag_ptr(ret_conv, true);
18737 }
18738
18739 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
18740         void* o_ptr = untag_ptr(o);
18741         CHECK_ACCESS(o_ptr);
18742         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18743         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18744         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18745         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
18746         return tag_ptr(ret_conv, true);
18747 }
18748
18749 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
18750         void* e_ptr = untag_ptr(e);
18751         CHECK_ACCESS(e_ptr);
18752         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18753         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18754         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18755         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
18756         return tag_ptr(ret_conv, true);
18757 }
18758
18759 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
18760         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
18761         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
18762         return ret_conv;
18763 }
18764
18765 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
18766         if (!ptr_is_owned(_res)) return;
18767         void* _res_ptr = untag_ptr(_res);
18768         CHECK_ACCESS(_res_ptr);
18769         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
18770         FREE(untag_ptr(_res));
18771         CResult_NetAddressDecodeErrorZ_free(_res_conv);
18772 }
18773
18774 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
18775         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18776         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
18777         return tag_ptr(ret_conv, true);
18778 }
18779 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
18780         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
18781         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
18782         return ret_conv;
18783 }
18784
18785 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
18786         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
18787         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18788         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
18789         return tag_ptr(ret_conv, true);
18790 }
18791
18792 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
18793         LDKCVec_UpdateAddHTLCZ _res_constr;
18794         _res_constr.datalen = _res->arr_len;
18795         if (_res_constr.datalen > 0)
18796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18797         else
18798                 _res_constr.data = NULL;
18799         uint64_t* _res_vals = _res->elems;
18800         for (size_t p = 0; p < _res_constr.datalen; p++) {
18801                 uint64_t _res_conv_15 = _res_vals[p];
18802                 LDKUpdateAddHTLC _res_conv_15_conv;
18803                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
18804                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
18805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
18806                 _res_constr.data[p] = _res_conv_15_conv;
18807         }
18808         FREE(_res);
18809         CVec_UpdateAddHTLCZ_free(_res_constr);
18810 }
18811
18812 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
18813         LDKCVec_UpdateFulfillHTLCZ _res_constr;
18814         _res_constr.datalen = _res->arr_len;
18815         if (_res_constr.datalen > 0)
18816                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18817         else
18818                 _res_constr.data = NULL;
18819         uint64_t* _res_vals = _res->elems;
18820         for (size_t t = 0; t < _res_constr.datalen; t++) {
18821                 uint64_t _res_conv_19 = _res_vals[t];
18822                 LDKUpdateFulfillHTLC _res_conv_19_conv;
18823                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
18824                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
18825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
18826                 _res_constr.data[t] = _res_conv_19_conv;
18827         }
18828         FREE(_res);
18829         CVec_UpdateFulfillHTLCZ_free(_res_constr);
18830 }
18831
18832 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
18833         LDKCVec_UpdateFailHTLCZ _res_constr;
18834         _res_constr.datalen = _res->arr_len;
18835         if (_res_constr.datalen > 0)
18836                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18837         else
18838                 _res_constr.data = NULL;
18839         uint64_t* _res_vals = _res->elems;
18840         for (size_t q = 0; q < _res_constr.datalen; q++) {
18841                 uint64_t _res_conv_16 = _res_vals[q];
18842                 LDKUpdateFailHTLC _res_conv_16_conv;
18843                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18844                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18845                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18846                 _res_constr.data[q] = _res_conv_16_conv;
18847         }
18848         FREE(_res);
18849         CVec_UpdateFailHTLCZ_free(_res_constr);
18850 }
18851
18852 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
18853         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18854         _res_constr.datalen = _res->arr_len;
18855         if (_res_constr.datalen > 0)
18856                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18857         else
18858                 _res_constr.data = NULL;
18859         uint64_t* _res_vals = _res->elems;
18860         for (size_t z = 0; z < _res_constr.datalen; z++) {
18861                 uint64_t _res_conv_25 = _res_vals[z];
18862                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18863                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
18864                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
18865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18866                 _res_constr.data[z] = _res_conv_25_conv;
18867         }
18868         FREE(_res);
18869         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18870 }
18871
18872 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
18873         LDKAcceptChannel o_conv;
18874         o_conv.inner = untag_ptr(o);
18875         o_conv.is_owned = ptr_is_owned(o);
18876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18877         o_conv = AcceptChannel_clone(&o_conv);
18878         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18879         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18880         return tag_ptr(ret_conv, true);
18881 }
18882
18883 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
18884         void* e_ptr = untag_ptr(e);
18885         CHECK_ACCESS(e_ptr);
18886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18888         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18889         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18890         return tag_ptr(ret_conv, true);
18891 }
18892
18893 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
18894         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
18895         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18896         return ret_conv;
18897 }
18898
18899 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
18900         if (!ptr_is_owned(_res)) return;
18901         void* _res_ptr = untag_ptr(_res);
18902         CHECK_ACCESS(_res_ptr);
18903         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18904         FREE(untag_ptr(_res));
18905         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18906 }
18907
18908 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18909         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18910         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18911         return tag_ptr(ret_conv, true);
18912 }
18913 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18914         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
18915         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18916         return ret_conv;
18917 }
18918
18919 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
18920         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
18921         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18922         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18923         return tag_ptr(ret_conv, true);
18924 }
18925
18926 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
18927         LDKAnnouncementSignatures o_conv;
18928         o_conv.inner = untag_ptr(o);
18929         o_conv.is_owned = ptr_is_owned(o);
18930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18931         o_conv = AnnouncementSignatures_clone(&o_conv);
18932         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18933         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18934         return tag_ptr(ret_conv, true);
18935 }
18936
18937 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
18938         void* e_ptr = untag_ptr(e);
18939         CHECK_ACCESS(e_ptr);
18940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18942         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18943         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18944         return tag_ptr(ret_conv, true);
18945 }
18946
18947 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
18948         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
18949         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18950         return ret_conv;
18951 }
18952
18953 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
18954         if (!ptr_is_owned(_res)) return;
18955         void* _res_ptr = untag_ptr(_res);
18956         CHECK_ACCESS(_res_ptr);
18957         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18958         FREE(untag_ptr(_res));
18959         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18960 }
18961
18962 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18963         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18964         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18965         return tag_ptr(ret_conv, true);
18966 }
18967 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18968         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
18969         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18970         return ret_conv;
18971 }
18972
18973 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
18974         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
18975         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18976         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18977         return tag_ptr(ret_conv, true);
18978 }
18979
18980 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
18981         LDKChannelReestablish o_conv;
18982         o_conv.inner = untag_ptr(o);
18983         o_conv.is_owned = ptr_is_owned(o);
18984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18985         o_conv = ChannelReestablish_clone(&o_conv);
18986         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18987         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18988         return tag_ptr(ret_conv, true);
18989 }
18990
18991 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
18992         void* e_ptr = untag_ptr(e);
18993         CHECK_ACCESS(e_ptr);
18994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18996         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18997         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18998         return tag_ptr(ret_conv, true);
18999 }
19000
19001 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19002         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19003         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19004         return ret_conv;
19005 }
19006
19007 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19008         if (!ptr_is_owned(_res)) return;
19009         void* _res_ptr = untag_ptr(_res);
19010         CHECK_ACCESS(_res_ptr);
19011         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19012         FREE(untag_ptr(_res));
19013         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19014 }
19015
19016 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19017         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19018         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19019         return tag_ptr(ret_conv, true);
19020 }
19021 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19022         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19023         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19024         return ret_conv;
19025 }
19026
19027 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19028         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19029         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19030         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19031         return tag_ptr(ret_conv, true);
19032 }
19033
19034 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
19035         LDKClosingSigned o_conv;
19036         o_conv.inner = untag_ptr(o);
19037         o_conv.is_owned = ptr_is_owned(o);
19038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19039         o_conv = ClosingSigned_clone(&o_conv);
19040         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19041         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
19042         return tag_ptr(ret_conv, true);
19043 }
19044
19045 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
19046         void* e_ptr = untag_ptr(e);
19047         CHECK_ACCESS(e_ptr);
19048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19050         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19051         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
19052         return tag_ptr(ret_conv, true);
19053 }
19054
19055 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
19056         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
19057         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
19058         return ret_conv;
19059 }
19060
19061 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
19062         if (!ptr_is_owned(_res)) return;
19063         void* _res_ptr = untag_ptr(_res);
19064         CHECK_ACCESS(_res_ptr);
19065         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
19066         FREE(untag_ptr(_res));
19067         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
19068 }
19069
19070 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
19071         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19072         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
19073         return tag_ptr(ret_conv, true);
19074 }
19075 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19076         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
19077         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
19078         return ret_conv;
19079 }
19080
19081 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
19082         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
19083         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19084         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
19089         LDKClosingSignedFeeRange o_conv;
19090         o_conv.inner = untag_ptr(o);
19091         o_conv.is_owned = ptr_is_owned(o);
19092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19093         o_conv = ClosingSignedFeeRange_clone(&o_conv);
19094         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19095         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
19096         return tag_ptr(ret_conv, true);
19097 }
19098
19099 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
19100         void* e_ptr = untag_ptr(e);
19101         CHECK_ACCESS(e_ptr);
19102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19104         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19105         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
19106         return tag_ptr(ret_conv, true);
19107 }
19108
19109 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
19110         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
19111         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
19112         return ret_conv;
19113 }
19114
19115 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
19116         if (!ptr_is_owned(_res)) return;
19117         void* _res_ptr = untag_ptr(_res);
19118         CHECK_ACCESS(_res_ptr);
19119         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19120         FREE(untag_ptr(_res));
19121         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19122 }
19123
19124 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19125         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19126         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19127         return tag_ptr(ret_conv, true);
19128 }
19129 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19130         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19131         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19132         return ret_conv;
19133 }
19134
19135 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19136         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19137         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19138         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19139         return tag_ptr(ret_conv, true);
19140 }
19141
19142 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19143         LDKCommitmentSigned o_conv;
19144         o_conv.inner = untag_ptr(o);
19145         o_conv.is_owned = ptr_is_owned(o);
19146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19147         o_conv = CommitmentSigned_clone(&o_conv);
19148         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19149         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19150         return tag_ptr(ret_conv, true);
19151 }
19152
19153 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19154         void* e_ptr = untag_ptr(e);
19155         CHECK_ACCESS(e_ptr);
19156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19158         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19159         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19160         return tag_ptr(ret_conv, true);
19161 }
19162
19163 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19164         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19165         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19166         return ret_conv;
19167 }
19168
19169 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19170         if (!ptr_is_owned(_res)) return;
19171         void* _res_ptr = untag_ptr(_res);
19172         CHECK_ACCESS(_res_ptr);
19173         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19174         FREE(untag_ptr(_res));
19175         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19176 }
19177
19178 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19179         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19180         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19181         return tag_ptr(ret_conv, true);
19182 }
19183 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19184         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19185         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19186         return ret_conv;
19187 }
19188
19189 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19190         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19191         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19192         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19193         return tag_ptr(ret_conv, true);
19194 }
19195
19196 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19197         LDKFundingCreated o_conv;
19198         o_conv.inner = untag_ptr(o);
19199         o_conv.is_owned = ptr_is_owned(o);
19200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19201         o_conv = FundingCreated_clone(&o_conv);
19202         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19203         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19204         return tag_ptr(ret_conv, true);
19205 }
19206
19207 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19208         void* e_ptr = untag_ptr(e);
19209         CHECK_ACCESS(e_ptr);
19210         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19211         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19212         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19213         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19214         return tag_ptr(ret_conv, true);
19215 }
19216
19217 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19218         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19219         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19220         return ret_conv;
19221 }
19222
19223 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19224         if (!ptr_is_owned(_res)) return;
19225         void* _res_ptr = untag_ptr(_res);
19226         CHECK_ACCESS(_res_ptr);
19227         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19228         FREE(untag_ptr(_res));
19229         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19230 }
19231
19232 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19233         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19234         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19235         return tag_ptr(ret_conv, true);
19236 }
19237 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19238         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19239         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19240         return ret_conv;
19241 }
19242
19243 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19244         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19245         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19246         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19247         return tag_ptr(ret_conv, true);
19248 }
19249
19250 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19251         LDKFundingSigned o_conv;
19252         o_conv.inner = untag_ptr(o);
19253         o_conv.is_owned = ptr_is_owned(o);
19254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19255         o_conv = FundingSigned_clone(&o_conv);
19256         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19257         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19258         return tag_ptr(ret_conv, true);
19259 }
19260
19261 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19262         void* e_ptr = untag_ptr(e);
19263         CHECK_ACCESS(e_ptr);
19264         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19265         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19266         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19267         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19268         return tag_ptr(ret_conv, true);
19269 }
19270
19271 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19272         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19273         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19274         return ret_conv;
19275 }
19276
19277 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19278         if (!ptr_is_owned(_res)) return;
19279         void* _res_ptr = untag_ptr(_res);
19280         CHECK_ACCESS(_res_ptr);
19281         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19282         FREE(untag_ptr(_res));
19283         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19284 }
19285
19286 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19287         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19288         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19289         return tag_ptr(ret_conv, true);
19290 }
19291 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19292         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19293         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19294         return ret_conv;
19295 }
19296
19297 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19298         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19299         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19300         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19301         return tag_ptr(ret_conv, true);
19302 }
19303
19304 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19305         LDKChannelReady o_conv;
19306         o_conv.inner = untag_ptr(o);
19307         o_conv.is_owned = ptr_is_owned(o);
19308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19309         o_conv = ChannelReady_clone(&o_conv);
19310         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19311         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19312         return tag_ptr(ret_conv, true);
19313 }
19314
19315 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19316         void* e_ptr = untag_ptr(e);
19317         CHECK_ACCESS(e_ptr);
19318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19320         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19321         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19322         return tag_ptr(ret_conv, true);
19323 }
19324
19325 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19326         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19327         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19328         return ret_conv;
19329 }
19330
19331 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
19332         if (!ptr_is_owned(_res)) return;
19333         void* _res_ptr = untag_ptr(_res);
19334         CHECK_ACCESS(_res_ptr);
19335         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
19336         FREE(untag_ptr(_res));
19337         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
19338 }
19339
19340 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
19341         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19342         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
19343         return tag_ptr(ret_conv, true);
19344 }
19345 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
19346         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
19347         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
19348         return ret_conv;
19349 }
19350
19351 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
19352         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
19353         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19354         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
19355         return tag_ptr(ret_conv, true);
19356 }
19357
19358 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
19359         LDKInit o_conv;
19360         o_conv.inner = untag_ptr(o);
19361         o_conv.is_owned = ptr_is_owned(o);
19362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19363         o_conv = Init_clone(&o_conv);
19364         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19365         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
19366         return tag_ptr(ret_conv, true);
19367 }
19368
19369 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
19370         void* e_ptr = untag_ptr(e);
19371         CHECK_ACCESS(e_ptr);
19372         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19373         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19374         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19375         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
19376         return tag_ptr(ret_conv, true);
19377 }
19378
19379 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
19380         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
19381         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
19382         return ret_conv;
19383 }
19384
19385 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
19386         if (!ptr_is_owned(_res)) return;
19387         void* _res_ptr = untag_ptr(_res);
19388         CHECK_ACCESS(_res_ptr);
19389         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
19390         FREE(untag_ptr(_res));
19391         CResult_InitDecodeErrorZ_free(_res_conv);
19392 }
19393
19394 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
19395         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19396         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
19397         return tag_ptr(ret_conv, true);
19398 }
19399 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
19400         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
19401         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
19402         return ret_conv;
19403 }
19404
19405 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
19406         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
19407         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19408         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
19409         return tag_ptr(ret_conv, true);
19410 }
19411
19412 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
19413         LDKOpenChannel o_conv;
19414         o_conv.inner = untag_ptr(o);
19415         o_conv.is_owned = ptr_is_owned(o);
19416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19417         o_conv = OpenChannel_clone(&o_conv);
19418         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19419         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
19420         return tag_ptr(ret_conv, true);
19421 }
19422
19423 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
19424         void* e_ptr = untag_ptr(e);
19425         CHECK_ACCESS(e_ptr);
19426         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19427         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19428         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19429         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
19430         return tag_ptr(ret_conv, true);
19431 }
19432
19433 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
19434         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
19435         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
19436         return ret_conv;
19437 }
19438
19439 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
19440         if (!ptr_is_owned(_res)) return;
19441         void* _res_ptr = untag_ptr(_res);
19442         CHECK_ACCESS(_res_ptr);
19443         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
19444         FREE(untag_ptr(_res));
19445         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
19446 }
19447
19448 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
19449         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19450         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
19451         return tag_ptr(ret_conv, true);
19452 }
19453 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19454         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
19455         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
19456         return ret_conv;
19457 }
19458
19459 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
19460         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
19461         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19462         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
19463         return tag_ptr(ret_conv, true);
19464 }
19465
19466 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
19467         LDKRevokeAndACK o_conv;
19468         o_conv.inner = untag_ptr(o);
19469         o_conv.is_owned = ptr_is_owned(o);
19470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19471         o_conv = RevokeAndACK_clone(&o_conv);
19472         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19473         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
19474         return tag_ptr(ret_conv, true);
19475 }
19476
19477 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
19478         void* e_ptr = untag_ptr(e);
19479         CHECK_ACCESS(e_ptr);
19480         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19481         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19482         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19483         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
19484         return tag_ptr(ret_conv, true);
19485 }
19486
19487 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
19488         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
19489         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
19490         return ret_conv;
19491 }
19492
19493 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
19494         if (!ptr_is_owned(_res)) return;
19495         void* _res_ptr = untag_ptr(_res);
19496         CHECK_ACCESS(_res_ptr);
19497         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
19498         FREE(untag_ptr(_res));
19499         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
19500 }
19501
19502 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
19503         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19504         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
19505         return tag_ptr(ret_conv, true);
19506 }
19507 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
19508         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
19509         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
19510         return ret_conv;
19511 }
19512
19513 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
19514         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
19515         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19516         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
19517         return tag_ptr(ret_conv, true);
19518 }
19519
19520 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
19521         LDKShutdown o_conv;
19522         o_conv.inner = untag_ptr(o);
19523         o_conv.is_owned = ptr_is_owned(o);
19524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19525         o_conv = Shutdown_clone(&o_conv);
19526         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19527         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
19528         return tag_ptr(ret_conv, true);
19529 }
19530
19531 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
19532         void* e_ptr = untag_ptr(e);
19533         CHECK_ACCESS(e_ptr);
19534         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19535         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19536         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19537         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
19538         return tag_ptr(ret_conv, true);
19539 }
19540
19541 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
19542         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
19543         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
19544         return ret_conv;
19545 }
19546
19547 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
19548         if (!ptr_is_owned(_res)) return;
19549         void* _res_ptr = untag_ptr(_res);
19550         CHECK_ACCESS(_res_ptr);
19551         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
19552         FREE(untag_ptr(_res));
19553         CResult_ShutdownDecodeErrorZ_free(_res_conv);
19554 }
19555
19556 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
19557         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19558         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
19559         return tag_ptr(ret_conv, true);
19560 }
19561 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
19562         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
19563         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
19564         return ret_conv;
19565 }
19566
19567 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
19568         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
19569         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19570         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
19571         return tag_ptr(ret_conv, true);
19572 }
19573
19574 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
19575         LDKUpdateFailHTLC o_conv;
19576         o_conv.inner = untag_ptr(o);
19577         o_conv.is_owned = ptr_is_owned(o);
19578         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19579         o_conv = UpdateFailHTLC_clone(&o_conv);
19580         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19581         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
19582         return tag_ptr(ret_conv, true);
19583 }
19584
19585 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
19586         void* e_ptr = untag_ptr(e);
19587         CHECK_ACCESS(e_ptr);
19588         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19589         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19590         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19591         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
19592         return tag_ptr(ret_conv, true);
19593 }
19594
19595 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
19596         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
19597         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
19598         return ret_conv;
19599 }
19600
19601 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
19602         if (!ptr_is_owned(_res)) return;
19603         void* _res_ptr = untag_ptr(_res);
19604         CHECK_ACCESS(_res_ptr);
19605         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
19606         FREE(untag_ptr(_res));
19607         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
19608 }
19609
19610 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
19611         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19612         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
19613         return tag_ptr(ret_conv, true);
19614 }
19615 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19616         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
19617         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
19618         return ret_conv;
19619 }
19620
19621 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
19622         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
19623         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19624         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
19625         return tag_ptr(ret_conv, true);
19626 }
19627
19628 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
19629         LDKUpdateFailMalformedHTLC o_conv;
19630         o_conv.inner = untag_ptr(o);
19631         o_conv.is_owned = ptr_is_owned(o);
19632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19633         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
19634         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19635         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
19636         return tag_ptr(ret_conv, true);
19637 }
19638
19639 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
19640         void* e_ptr = untag_ptr(e);
19641         CHECK_ACCESS(e_ptr);
19642         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19643         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19644         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19645         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
19646         return tag_ptr(ret_conv, true);
19647 }
19648
19649 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
19650         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
19651         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
19652         return ret_conv;
19653 }
19654
19655 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
19656         if (!ptr_is_owned(_res)) return;
19657         void* _res_ptr = untag_ptr(_res);
19658         CHECK_ACCESS(_res_ptr);
19659         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
19660         FREE(untag_ptr(_res));
19661         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
19662 }
19663
19664 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
19665         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19666         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
19667         return tag_ptr(ret_conv, true);
19668 }
19669 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19670         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
19671         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
19672         return ret_conv;
19673 }
19674
19675 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
19676         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
19677         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19678         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
19679         return tag_ptr(ret_conv, true);
19680 }
19681
19682 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
19683         LDKUpdateFee o_conv;
19684         o_conv.inner = untag_ptr(o);
19685         o_conv.is_owned = ptr_is_owned(o);
19686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19687         o_conv = UpdateFee_clone(&o_conv);
19688         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19689         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
19690         return tag_ptr(ret_conv, true);
19691 }
19692
19693 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
19694         void* e_ptr = untag_ptr(e);
19695         CHECK_ACCESS(e_ptr);
19696         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19697         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19698         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19699         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
19700         return tag_ptr(ret_conv, true);
19701 }
19702
19703 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
19704         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
19705         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
19706         return ret_conv;
19707 }
19708
19709 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
19710         if (!ptr_is_owned(_res)) return;
19711         void* _res_ptr = untag_ptr(_res);
19712         CHECK_ACCESS(_res_ptr);
19713         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
19714         FREE(untag_ptr(_res));
19715         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
19716 }
19717
19718 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
19719         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19720         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
19721         return tag_ptr(ret_conv, true);
19722 }
19723 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
19724         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
19725         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
19726         return ret_conv;
19727 }
19728
19729 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
19730         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
19731         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19732         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
19733         return tag_ptr(ret_conv, true);
19734 }
19735
19736 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
19737         LDKUpdateFulfillHTLC o_conv;
19738         o_conv.inner = untag_ptr(o);
19739         o_conv.is_owned = ptr_is_owned(o);
19740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19741         o_conv = UpdateFulfillHTLC_clone(&o_conv);
19742         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19743         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
19744         return tag_ptr(ret_conv, true);
19745 }
19746
19747 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
19748         void* e_ptr = untag_ptr(e);
19749         CHECK_ACCESS(e_ptr);
19750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19752         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19753         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
19754         return tag_ptr(ret_conv, true);
19755 }
19756
19757 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
19758         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
19759         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
19760         return ret_conv;
19761 }
19762
19763 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
19764         if (!ptr_is_owned(_res)) return;
19765         void* _res_ptr = untag_ptr(_res);
19766         CHECK_ACCESS(_res_ptr);
19767         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
19768         FREE(untag_ptr(_res));
19769         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
19770 }
19771
19772 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
19773         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19774         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
19775         return tag_ptr(ret_conv, true);
19776 }
19777 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19778         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
19779         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
19780         return ret_conv;
19781 }
19782
19783 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
19784         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
19785         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19786         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
19787         return tag_ptr(ret_conv, true);
19788 }
19789
19790 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
19791         LDKUpdateAddHTLC o_conv;
19792         o_conv.inner = untag_ptr(o);
19793         o_conv.is_owned = ptr_is_owned(o);
19794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19795         o_conv = UpdateAddHTLC_clone(&o_conv);
19796         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19797         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
19798         return tag_ptr(ret_conv, true);
19799 }
19800
19801 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
19802         void* e_ptr = untag_ptr(e);
19803         CHECK_ACCESS(e_ptr);
19804         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19805         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19806         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19807         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
19808         return tag_ptr(ret_conv, true);
19809 }
19810
19811 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
19812         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
19813         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
19814         return ret_conv;
19815 }
19816
19817 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
19818         if (!ptr_is_owned(_res)) return;
19819         void* _res_ptr = untag_ptr(_res);
19820         CHECK_ACCESS(_res_ptr);
19821         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19822         FREE(untag_ptr(_res));
19823         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19824 }
19825
19826 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19827         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19828         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19829         return tag_ptr(ret_conv, true);
19830 }
19831 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19832         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
19833         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19834         return ret_conv;
19835 }
19836
19837 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
19838         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
19839         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19840         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19841         return tag_ptr(ret_conv, true);
19842 }
19843
19844 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
19845         LDKOnionMessage o_conv;
19846         o_conv.inner = untag_ptr(o);
19847         o_conv.is_owned = ptr_is_owned(o);
19848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19849         o_conv = OnionMessage_clone(&o_conv);
19850         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19851         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
19852         return tag_ptr(ret_conv, true);
19853 }
19854
19855 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
19856         void* e_ptr = untag_ptr(e);
19857         CHECK_ACCESS(e_ptr);
19858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19860         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19861         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
19862         return tag_ptr(ret_conv, true);
19863 }
19864
19865 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
19866         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
19867         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
19868         return ret_conv;
19869 }
19870
19871 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
19872         if (!ptr_is_owned(_res)) return;
19873         void* _res_ptr = untag_ptr(_res);
19874         CHECK_ACCESS(_res_ptr);
19875         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
19876         FREE(untag_ptr(_res));
19877         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
19878 }
19879
19880 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
19881         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19882         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
19883         return tag_ptr(ret_conv, true);
19884 }
19885 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
19886         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
19887         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
19888         return ret_conv;
19889 }
19890
19891 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
19892         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
19893         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19894         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
19895         return tag_ptr(ret_conv, true);
19896 }
19897
19898 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
19899         LDKPing o_conv;
19900         o_conv.inner = untag_ptr(o);
19901         o_conv.is_owned = ptr_is_owned(o);
19902         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19903         o_conv = Ping_clone(&o_conv);
19904         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19905         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19906         return tag_ptr(ret_conv, true);
19907 }
19908
19909 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
19910         void* e_ptr = untag_ptr(e);
19911         CHECK_ACCESS(e_ptr);
19912         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19913         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19914         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19915         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19916         return tag_ptr(ret_conv, true);
19917 }
19918
19919 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
19920         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
19921         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19922         return ret_conv;
19923 }
19924
19925 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
19926         if (!ptr_is_owned(_res)) return;
19927         void* _res_ptr = untag_ptr(_res);
19928         CHECK_ACCESS(_res_ptr);
19929         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19930         FREE(untag_ptr(_res));
19931         CResult_PingDecodeErrorZ_free(_res_conv);
19932 }
19933
19934 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19935         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19936         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19937         return tag_ptr(ret_conv, true);
19938 }
19939 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
19940         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
19941         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19942         return ret_conv;
19943 }
19944
19945 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
19946         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
19947         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19948         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19949         return tag_ptr(ret_conv, true);
19950 }
19951
19952 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
19953         LDKPong o_conv;
19954         o_conv.inner = untag_ptr(o);
19955         o_conv.is_owned = ptr_is_owned(o);
19956         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19957         o_conv = Pong_clone(&o_conv);
19958         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19959         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19960         return tag_ptr(ret_conv, true);
19961 }
19962
19963 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
19964         void* e_ptr = untag_ptr(e);
19965         CHECK_ACCESS(e_ptr);
19966         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19967         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19968         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19969         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19970         return tag_ptr(ret_conv, true);
19971 }
19972
19973 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
19974         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
19975         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19976         return ret_conv;
19977 }
19978
19979 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
19980         if (!ptr_is_owned(_res)) return;
19981         void* _res_ptr = untag_ptr(_res);
19982         CHECK_ACCESS(_res_ptr);
19983         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19984         FREE(untag_ptr(_res));
19985         CResult_PongDecodeErrorZ_free(_res_conv);
19986 }
19987
19988 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19989         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19990         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19991         return tag_ptr(ret_conv, true);
19992 }
19993 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
19994         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
19995         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19996         return ret_conv;
19997 }
19998
19999 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
20000         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
20001         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20002         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20003         return tag_ptr(ret_conv, true);
20004 }
20005
20006 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20007         LDKUnsignedChannelAnnouncement o_conv;
20008         o_conv.inner = untag_ptr(o);
20009         o_conv.is_owned = ptr_is_owned(o);
20010         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20011         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20012         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20013         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20014         return tag_ptr(ret_conv, true);
20015 }
20016
20017 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20018         void* e_ptr = untag_ptr(e);
20019         CHECK_ACCESS(e_ptr);
20020         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20021         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20022         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20023         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20024         return tag_ptr(ret_conv, true);
20025 }
20026
20027 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20028         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20029         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20030         return ret_conv;
20031 }
20032
20033 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20034         if (!ptr_is_owned(_res)) return;
20035         void* _res_ptr = untag_ptr(_res);
20036         CHECK_ACCESS(_res_ptr);
20037         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20038         FREE(untag_ptr(_res));
20039         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
20040 }
20041
20042 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20043         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20044         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
20045         return tag_ptr(ret_conv, true);
20046 }
20047 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20048         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20049         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20050         return ret_conv;
20051 }
20052
20053 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20054         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20055         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20056         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20057         return tag_ptr(ret_conv, true);
20058 }
20059
20060 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20061         LDKChannelAnnouncement o_conv;
20062         o_conv.inner = untag_ptr(o);
20063         o_conv.is_owned = ptr_is_owned(o);
20064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20065         o_conv = ChannelAnnouncement_clone(&o_conv);
20066         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20067         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
20068         return tag_ptr(ret_conv, true);
20069 }
20070
20071 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20072         void* e_ptr = untag_ptr(e);
20073         CHECK_ACCESS(e_ptr);
20074         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20075         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20076         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20077         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
20078         return tag_ptr(ret_conv, true);
20079 }
20080
20081 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20082         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20083         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20084         return ret_conv;
20085 }
20086
20087 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20088         if (!ptr_is_owned(_res)) return;
20089         void* _res_ptr = untag_ptr(_res);
20090         CHECK_ACCESS(_res_ptr);
20091         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20092         FREE(untag_ptr(_res));
20093         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
20094 }
20095
20096 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20097         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20098         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
20099         return tag_ptr(ret_conv, true);
20100 }
20101 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20102         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20103         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20104         return ret_conv;
20105 }
20106
20107 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20108         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20109         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20110         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20111         return tag_ptr(ret_conv, true);
20112 }
20113
20114 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20115         LDKUnsignedChannelUpdate o_conv;
20116         o_conv.inner = untag_ptr(o);
20117         o_conv.is_owned = ptr_is_owned(o);
20118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20119         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20120         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20121         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20122         return tag_ptr(ret_conv, true);
20123 }
20124
20125 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20126         void* e_ptr = untag_ptr(e);
20127         CHECK_ACCESS(e_ptr);
20128         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20129         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20130         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20131         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20132         return tag_ptr(ret_conv, true);
20133 }
20134
20135 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20136         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20137         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20138         return ret_conv;
20139 }
20140
20141 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20142         if (!ptr_is_owned(_res)) return;
20143         void* _res_ptr = untag_ptr(_res);
20144         CHECK_ACCESS(_res_ptr);
20145         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20146         FREE(untag_ptr(_res));
20147         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20148 }
20149
20150 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20151         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20152         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20153         return tag_ptr(ret_conv, true);
20154 }
20155 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20156         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20157         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20158         return ret_conv;
20159 }
20160
20161 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20162         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20163         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20164         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20165         return tag_ptr(ret_conv, true);
20166 }
20167
20168 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20169         LDKChannelUpdate o_conv;
20170         o_conv.inner = untag_ptr(o);
20171         o_conv.is_owned = ptr_is_owned(o);
20172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20173         o_conv = ChannelUpdate_clone(&o_conv);
20174         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20175         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20176         return tag_ptr(ret_conv, true);
20177 }
20178
20179 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20180         void* e_ptr = untag_ptr(e);
20181         CHECK_ACCESS(e_ptr);
20182         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20183         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20184         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20185         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20186         return tag_ptr(ret_conv, true);
20187 }
20188
20189 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20190         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20191         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20192         return ret_conv;
20193 }
20194
20195 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20196         if (!ptr_is_owned(_res)) return;
20197         void* _res_ptr = untag_ptr(_res);
20198         CHECK_ACCESS(_res_ptr);
20199         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20200         FREE(untag_ptr(_res));
20201         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20202 }
20203
20204 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20205         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20206         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20207         return tag_ptr(ret_conv, true);
20208 }
20209 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20210         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20211         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20212         return ret_conv;
20213 }
20214
20215 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20216         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20217         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20218         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20219         return tag_ptr(ret_conv, true);
20220 }
20221
20222 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20223         LDKErrorMessage o_conv;
20224         o_conv.inner = untag_ptr(o);
20225         o_conv.is_owned = ptr_is_owned(o);
20226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20227         o_conv = ErrorMessage_clone(&o_conv);
20228         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20229         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20230         return tag_ptr(ret_conv, true);
20231 }
20232
20233 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20234         void* e_ptr = untag_ptr(e);
20235         CHECK_ACCESS(e_ptr);
20236         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20237         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20238         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20239         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20240         return tag_ptr(ret_conv, true);
20241 }
20242
20243 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20244         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20245         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20246         return ret_conv;
20247 }
20248
20249 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20250         if (!ptr_is_owned(_res)) return;
20251         void* _res_ptr = untag_ptr(_res);
20252         CHECK_ACCESS(_res_ptr);
20253         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20254         FREE(untag_ptr(_res));
20255         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20256 }
20257
20258 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20259         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20260         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20261         return tag_ptr(ret_conv, true);
20262 }
20263 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20264         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20265         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20266         return ret_conv;
20267 }
20268
20269 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20270         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20271         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20272         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20273         return tag_ptr(ret_conv, true);
20274 }
20275
20276 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20277         LDKWarningMessage o_conv;
20278         o_conv.inner = untag_ptr(o);
20279         o_conv.is_owned = ptr_is_owned(o);
20280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20281         o_conv = WarningMessage_clone(&o_conv);
20282         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20283         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20284         return tag_ptr(ret_conv, true);
20285 }
20286
20287 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20288         void* e_ptr = untag_ptr(e);
20289         CHECK_ACCESS(e_ptr);
20290         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20291         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20292         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20293         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20294         return tag_ptr(ret_conv, true);
20295 }
20296
20297 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20298         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20299         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20300         return ret_conv;
20301 }
20302
20303 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20304         if (!ptr_is_owned(_res)) return;
20305         void* _res_ptr = untag_ptr(_res);
20306         CHECK_ACCESS(_res_ptr);
20307         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20308         FREE(untag_ptr(_res));
20309         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20310 }
20311
20312 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20313         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20314         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20315         return tag_ptr(ret_conv, true);
20316 }
20317 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20318         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20319         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20320         return ret_conv;
20321 }
20322
20323 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20324         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20325         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20326         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20327         return tag_ptr(ret_conv, true);
20328 }
20329
20330 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20331         LDKUnsignedNodeAnnouncement o_conv;
20332         o_conv.inner = untag_ptr(o);
20333         o_conv.is_owned = ptr_is_owned(o);
20334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20335         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20336         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20337         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20338         return tag_ptr(ret_conv, true);
20339 }
20340
20341 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20342         void* e_ptr = untag_ptr(e);
20343         CHECK_ACCESS(e_ptr);
20344         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20345         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20346         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20347         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20348         return tag_ptr(ret_conv, true);
20349 }
20350
20351 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20352         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20353         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20354         return ret_conv;
20355 }
20356
20357 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20358         if (!ptr_is_owned(_res)) return;
20359         void* _res_ptr = untag_ptr(_res);
20360         CHECK_ACCESS(_res_ptr);
20361         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20362         FREE(untag_ptr(_res));
20363         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20364 }
20365
20366 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20367         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20368         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20369         return tag_ptr(ret_conv, true);
20370 }
20371 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20372         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20373         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20374         return ret_conv;
20375 }
20376
20377 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20378         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20379         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20380         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20381         return tag_ptr(ret_conv, true);
20382 }
20383
20384 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20385         LDKNodeAnnouncement o_conv;
20386         o_conv.inner = untag_ptr(o);
20387         o_conv.is_owned = ptr_is_owned(o);
20388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20389         o_conv = NodeAnnouncement_clone(&o_conv);
20390         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20391         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20392         return tag_ptr(ret_conv, true);
20393 }
20394
20395 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20396         void* e_ptr = untag_ptr(e);
20397         CHECK_ACCESS(e_ptr);
20398         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20399         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20400         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20401         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20402         return tag_ptr(ret_conv, true);
20403 }
20404
20405 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20406         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20407         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20408         return ret_conv;
20409 }
20410
20411 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20412         if (!ptr_is_owned(_res)) return;
20413         void* _res_ptr = untag_ptr(_res);
20414         CHECK_ACCESS(_res_ptr);
20415         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20416         FREE(untag_ptr(_res));
20417         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20418 }
20419
20420 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20421         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20422         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
20423         return tag_ptr(ret_conv, true);
20424 }
20425 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20426         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20427         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20428         return ret_conv;
20429 }
20430
20431 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20432         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20433         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20434         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
20435         return tag_ptr(ret_conv, true);
20436 }
20437
20438 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
20439         LDKQueryShortChannelIds o_conv;
20440         o_conv.inner = untag_ptr(o);
20441         o_conv.is_owned = ptr_is_owned(o);
20442         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20443         o_conv = QueryShortChannelIds_clone(&o_conv);
20444         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20445         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
20446         return tag_ptr(ret_conv, true);
20447 }
20448
20449 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
20450         void* e_ptr = untag_ptr(e);
20451         CHECK_ACCESS(e_ptr);
20452         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20453         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20454         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20455         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
20456         return tag_ptr(ret_conv, true);
20457 }
20458
20459 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
20460         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
20461         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
20462         return ret_conv;
20463 }
20464
20465 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
20466         if (!ptr_is_owned(_res)) return;
20467         void* _res_ptr = untag_ptr(_res);
20468         CHECK_ACCESS(_res_ptr);
20469         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
20470         FREE(untag_ptr(_res));
20471         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
20472 }
20473
20474 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
20475         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20476         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
20477         return tag_ptr(ret_conv, true);
20478 }
20479 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
20480         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
20481         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
20482         return ret_conv;
20483 }
20484
20485 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
20486         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
20487         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20488         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
20489         return tag_ptr(ret_conv, true);
20490 }
20491
20492 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
20493         LDKReplyShortChannelIdsEnd o_conv;
20494         o_conv.inner = untag_ptr(o);
20495         o_conv.is_owned = ptr_is_owned(o);
20496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20497         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
20498         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20499         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
20500         return tag_ptr(ret_conv, true);
20501 }
20502
20503 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
20504         void* e_ptr = untag_ptr(e);
20505         CHECK_ACCESS(e_ptr);
20506         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20507         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20508         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20509         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
20510         return tag_ptr(ret_conv, true);
20511 }
20512
20513 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
20514         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
20515         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
20516         return ret_conv;
20517 }
20518
20519 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
20520         if (!ptr_is_owned(_res)) return;
20521         void* _res_ptr = untag_ptr(_res);
20522         CHECK_ACCESS(_res_ptr);
20523         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
20524         FREE(untag_ptr(_res));
20525         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
20526 }
20527
20528 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
20529         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20530         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
20531         return tag_ptr(ret_conv, true);
20532 }
20533 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
20534         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
20535         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
20536         return ret_conv;
20537 }
20538
20539 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
20540         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
20541         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20542         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
20543         return tag_ptr(ret_conv, true);
20544 }
20545
20546 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
20547         LDKQueryChannelRange o_conv;
20548         o_conv.inner = untag_ptr(o);
20549         o_conv.is_owned = ptr_is_owned(o);
20550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20551         o_conv = QueryChannelRange_clone(&o_conv);
20552         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20553         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
20554         return tag_ptr(ret_conv, true);
20555 }
20556
20557 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
20558         void* e_ptr = untag_ptr(e);
20559         CHECK_ACCESS(e_ptr);
20560         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20561         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20562         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20563         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
20564         return tag_ptr(ret_conv, true);
20565 }
20566
20567 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20568         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
20569         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
20570         return ret_conv;
20571 }
20572
20573 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
20574         if (!ptr_is_owned(_res)) return;
20575         void* _res_ptr = untag_ptr(_res);
20576         CHECK_ACCESS(_res_ptr);
20577         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
20578         FREE(untag_ptr(_res));
20579         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
20580 }
20581
20582 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20583         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20584         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
20585         return tag_ptr(ret_conv, true);
20586 }
20587 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20588         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
20589         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20590         return ret_conv;
20591 }
20592
20593 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20594         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
20595         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20596         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
20597         return tag_ptr(ret_conv, true);
20598 }
20599
20600 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
20601         LDKReplyChannelRange o_conv;
20602         o_conv.inner = untag_ptr(o);
20603         o_conv.is_owned = ptr_is_owned(o);
20604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20605         o_conv = ReplyChannelRange_clone(&o_conv);
20606         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20607         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
20608         return tag_ptr(ret_conv, true);
20609 }
20610
20611 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
20612         void* e_ptr = untag_ptr(e);
20613         CHECK_ACCESS(e_ptr);
20614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20616         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20617         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
20618         return tag_ptr(ret_conv, true);
20619 }
20620
20621 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20622         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
20623         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
20624         return ret_conv;
20625 }
20626
20627 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
20628         if (!ptr_is_owned(_res)) return;
20629         void* _res_ptr = untag_ptr(_res);
20630         CHECK_ACCESS(_res_ptr);
20631         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
20632         FREE(untag_ptr(_res));
20633         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
20634 }
20635
20636 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20637         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20638         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
20639         return tag_ptr(ret_conv, true);
20640 }
20641 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20642         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
20643         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20644         return ret_conv;
20645 }
20646
20647 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20648         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
20649         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20650         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
20651         return tag_ptr(ret_conv, true);
20652 }
20653
20654 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
20655         LDKGossipTimestampFilter o_conv;
20656         o_conv.inner = untag_ptr(o);
20657         o_conv.is_owned = ptr_is_owned(o);
20658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20659         o_conv = GossipTimestampFilter_clone(&o_conv);
20660         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20661         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
20662         return tag_ptr(ret_conv, true);
20663 }
20664
20665 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
20666         void* e_ptr = untag_ptr(e);
20667         CHECK_ACCESS(e_ptr);
20668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20670         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20671         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
20672         return tag_ptr(ret_conv, true);
20673 }
20674
20675 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
20676         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
20677         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
20678         return ret_conv;
20679 }
20680
20681 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
20682         if (!ptr_is_owned(_res)) return;
20683         void* _res_ptr = untag_ptr(_res);
20684         CHECK_ACCESS(_res_ptr);
20685         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
20686         FREE(untag_ptr(_res));
20687         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
20688 }
20689
20690 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
20691         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20692         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
20693         return tag_ptr(ret_conv, true);
20694 }
20695 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
20696         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
20697         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
20698         return ret_conv;
20699 }
20700
20701 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
20702         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
20703         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20704         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
20705         return tag_ptr(ret_conv, true);
20706 }
20707
20708 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
20709         LDKInvoice o_conv;
20710         o_conv.inner = untag_ptr(o);
20711         o_conv.is_owned = ptr_is_owned(o);
20712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20713         o_conv = Invoice_clone(&o_conv);
20714         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20715         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
20716         return tag_ptr(ret_conv, true);
20717 }
20718
20719 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
20720         void* e_ptr = untag_ptr(e);
20721         CHECK_ACCESS(e_ptr);
20722         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
20723         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
20724         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20725         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
20726         return tag_ptr(ret_conv, true);
20727 }
20728
20729 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
20730         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
20731         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
20732         return ret_conv;
20733 }
20734
20735 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
20736         if (!ptr_is_owned(_res)) return;
20737         void* _res_ptr = untag_ptr(_res);
20738         CHECK_ACCESS(_res_ptr);
20739         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
20740         FREE(untag_ptr(_res));
20741         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
20742 }
20743
20744 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
20745         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20746         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
20747         return tag_ptr(ret_conv, true);
20748 }
20749 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
20750         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
20751         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
20752         return ret_conv;
20753 }
20754
20755 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
20756         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
20757         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20758         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
20759         return tag_ptr(ret_conv, true);
20760 }
20761
20762 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
20763         void* o_ptr = untag_ptr(o);
20764         CHECK_ACCESS(o_ptr);
20765         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
20766         if (o_conv.free == LDKFilter_JCalls_free) {
20767                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20768                 LDKFilter_JCalls_cloned(&o_conv);
20769         }
20770         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20771         *ret_copy = COption_FilterZ_some(o_conv);
20772         uint64_t ret_ref = tag_ptr(ret_copy, true);
20773         return ret_ref;
20774 }
20775
20776 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
20777         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20778         *ret_copy = COption_FilterZ_none();
20779         uint64_t ret_ref = tag_ptr(ret_copy, true);
20780         return ret_ref;
20781 }
20782
20783 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
20784         if (!ptr_is_owned(_res)) return;
20785         void* _res_ptr = untag_ptr(_res);
20786         CHECK_ACCESS(_res_ptr);
20787         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
20788         FREE(untag_ptr(_res));
20789         COption_FilterZ_free(_res_conv);
20790 }
20791
20792 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
20793         LDKLockedChannelMonitor o_conv;
20794         o_conv.inner = untag_ptr(o);
20795         o_conv.is_owned = ptr_is_owned(o);
20796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20797         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
20798         
20799         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20800         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
20801         return tag_ptr(ret_conv, true);
20802 }
20803
20804 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
20805         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20806         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
20807         return tag_ptr(ret_conv, true);
20808 }
20809
20810 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
20811         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
20812         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
20813         return ret_conv;
20814 }
20815
20816 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
20817         if (!ptr_is_owned(_res)) return;
20818         void* _res_ptr = untag_ptr(_res);
20819         CHECK_ACCESS(_res_ptr);
20820         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
20821         FREE(untag_ptr(_res));
20822         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
20823 }
20824
20825 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
20826         LDKCVec_OutPointZ _res_constr;
20827         _res_constr.datalen = _res->arr_len;
20828         if (_res_constr.datalen > 0)
20829                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
20830         else
20831                 _res_constr.data = NULL;
20832         uint64_t* _res_vals = _res->elems;
20833         for (size_t k = 0; k < _res_constr.datalen; k++) {
20834                 uint64_t _res_conv_10 = _res_vals[k];
20835                 LDKOutPoint _res_conv_10_conv;
20836                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20837                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20838                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20839                 _res_constr.data[k] = _res_conv_10_conv;
20840         }
20841         FREE(_res);
20842         CVec_OutPointZ_free(_res_constr);
20843 }
20844
20845 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
20846         if (!ptr_is_owned(this_ptr)) return;
20847         void* this_ptr_ptr = untag_ptr(this_ptr);
20848         CHECK_ACCESS(this_ptr_ptr);
20849         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
20850         FREE(untag_ptr(this_ptr));
20851         PaymentPurpose_free(this_ptr_conv);
20852 }
20853
20854 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
20855         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20856         *ret_copy = PaymentPurpose_clone(arg);
20857         uint64_t ret_ref = tag_ptr(ret_copy, true);
20858         return ret_ref;
20859 }
20860 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
20861         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
20862         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20863         return ret_conv;
20864 }
20865
20866 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
20867         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
20868         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20869         *ret_copy = PaymentPurpose_clone(orig_conv);
20870         uint64_t ret_ref = tag_ptr(ret_copy, true);
20871         return ret_ref;
20872 }
20873
20874 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20875         LDKThirtyTwoBytes payment_preimage_ref;
20876         CHECK(payment_preimage->arr_len == 32);
20877         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20878         LDKThirtyTwoBytes payment_secret_ref;
20879         CHECK(payment_secret->arr_len == 32);
20880         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20881         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20882         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20883         uint64_t ret_ref = tag_ptr(ret_copy, true);
20884         return ret_ref;
20885 }
20886
20887 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20888         LDKThirtyTwoBytes a_ref;
20889         CHECK(a->arr_len == 32);
20890         memcpy(a_ref.data, a->elems, 32); FREE(a);
20891         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20892         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20893         uint64_t ret_ref = tag_ptr(ret_copy, true);
20894         return ret_ref;
20895 }
20896
20897 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
20898         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
20899         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20900         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20901         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20902         CVec_u8Z_free(ret_var);
20903         return ret_arr;
20904 }
20905
20906 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20907         LDKu8slice ser_ref;
20908         ser_ref.datalen = ser->arr_len;
20909         ser_ref.data = ser->elems;
20910         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20911         *ret_conv = PaymentPurpose_read(ser_ref);
20912         FREE(ser);
20913         return tag_ptr(ret_conv, true);
20914 }
20915
20916 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
20917         if (!ptr_is_owned(this_ptr)) return;
20918         void* this_ptr_ptr = untag_ptr(this_ptr);
20919         CHECK_ACCESS(this_ptr_ptr);
20920         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20921         FREE(untag_ptr(this_ptr));
20922         ClosureReason_free(this_ptr_conv);
20923 }
20924
20925 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20926         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20927         *ret_copy = ClosureReason_clone(arg);
20928         uint64_t ret_ref = tag_ptr(ret_copy, true);
20929         return ret_ref;
20930 }
20931 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
20932         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
20933         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20934         return ret_conv;
20935 }
20936
20937 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
20938         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
20939         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20940         *ret_copy = ClosureReason_clone(orig_conv);
20941         uint64_t ret_ref = tag_ptr(ret_copy, true);
20942         return ret_ref;
20943 }
20944
20945 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20946         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20947         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20948         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20949         uint64_t ret_ref = tag_ptr(ret_copy, true);
20950         return ret_ref;
20951 }
20952
20953 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20954         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20955         *ret_copy = ClosureReason_holder_force_closed();
20956         uint64_t ret_ref = tag_ptr(ret_copy, true);
20957         return ret_ref;
20958 }
20959
20960 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20961         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20962         *ret_copy = ClosureReason_cooperative_closure();
20963         uint64_t ret_ref = tag_ptr(ret_copy, true);
20964         return ret_ref;
20965 }
20966
20967 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20968         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20969         *ret_copy = ClosureReason_commitment_tx_confirmed();
20970         uint64_t ret_ref = tag_ptr(ret_copy, true);
20971         return ret_ref;
20972 }
20973
20974 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20975         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20976         *ret_copy = ClosureReason_funding_timed_out();
20977         uint64_t ret_ref = tag_ptr(ret_copy, true);
20978         return ret_ref;
20979 }
20980
20981 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20982         LDKStr err_conv = str_ref_to_owned_c(err);
20983         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20984         *ret_copy = ClosureReason_processing_error(err_conv);
20985         uint64_t ret_ref = tag_ptr(ret_copy, true);
20986         return ret_ref;
20987 }
20988
20989 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20990         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20991         *ret_copy = ClosureReason_disconnected_peer();
20992         uint64_t ret_ref = tag_ptr(ret_copy, true);
20993         return ret_ref;
20994 }
20995
20996 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20997         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20998         *ret_copy = ClosureReason_outdated_channel_manager();
20999         uint64_t ret_ref = tag_ptr(ret_copy, true);
21000         return ret_ref;
21001 }
21002
21003 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
21004         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
21005         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
21006         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
21007         return ret_conv;
21008 }
21009
21010 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
21011         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
21012         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
21013         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21014         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21015         CVec_u8Z_free(ret_var);
21016         return ret_arr;
21017 }
21018
21019 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
21020         LDKu8slice ser_ref;
21021         ser_ref.datalen = ser->arr_len;
21022         ser_ref.data = ser->elems;
21023         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
21024         *ret_conv = ClosureReason_read(ser_ref);
21025         FREE(ser);
21026         return tag_ptr(ret_conv, true);
21027 }
21028
21029 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
21030         if (!ptr_is_owned(this_ptr)) return;
21031         void* this_ptr_ptr = untag_ptr(this_ptr);
21032         CHECK_ACCESS(this_ptr_ptr);
21033         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
21034         FREE(untag_ptr(this_ptr));
21035         HTLCDestination_free(this_ptr_conv);
21036 }
21037
21038 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
21039         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21040         *ret_copy = HTLCDestination_clone(arg);
21041         uint64_t ret_ref = tag_ptr(ret_copy, true);
21042         return ret_ref;
21043 }
21044 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
21045         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
21046         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
21047         return ret_conv;
21048 }
21049
21050 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
21051         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
21052         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21053         *ret_copy = HTLCDestination_clone(orig_conv);
21054         uint64_t ret_ref = tag_ptr(ret_copy, true);
21055         return ret_ref;
21056 }
21057
21058 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
21059         LDKPublicKey node_id_ref;
21060         CHECK(node_id->arr_len == 33);
21061         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21062         LDKThirtyTwoBytes channel_id_ref;
21063         CHECK(channel_id->arr_len == 32);
21064         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21065         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21066         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
21067         uint64_t ret_ref = tag_ptr(ret_copy, true);
21068         return ret_ref;
21069 }
21070
21071 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
21072         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21073         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
21074         uint64_t ret_ref = tag_ptr(ret_copy, true);
21075         return ret_ref;
21076 }
21077
21078 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
21079         LDKThirtyTwoBytes payment_hash_ref;
21080         CHECK(payment_hash->arr_len == 32);
21081         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21082         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21083         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
21084         uint64_t ret_ref = tag_ptr(ret_copy, true);
21085         return ret_ref;
21086 }
21087
21088 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
21089         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
21090         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
21091         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
21092         return ret_conv;
21093 }
21094
21095 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
21096         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
21097         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
21098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21100         CVec_u8Z_free(ret_var);
21101         return ret_arr;
21102 }
21103
21104 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21105         LDKu8slice ser_ref;
21106         ser_ref.datalen = ser->arr_len;
21107         ser_ref.data = ser->elems;
21108         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21109         *ret_conv = HTLCDestination_read(ser_ref);
21110         FREE(ser);
21111         return tag_ptr(ret_conv, true);
21112 }
21113
21114 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21115         if (!ptr_is_owned(this_ptr)) return;
21116         void* this_ptr_ptr = untag_ptr(this_ptr);
21117         CHECK_ACCESS(this_ptr_ptr);
21118         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21119         FREE(untag_ptr(this_ptr));
21120         Event_free(this_ptr_conv);
21121 }
21122
21123 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21124         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21125         *ret_copy = Event_clone(arg);
21126         uint64_t ret_ref = tag_ptr(ret_copy, true);
21127         return ret_ref;
21128 }
21129 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21130         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21131         int64_t ret_conv = Event_clone_ptr(arg_conv);
21132         return ret_conv;
21133 }
21134
21135 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21136         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21137         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21138         *ret_copy = Event_clone(orig_conv);
21139         uint64_t ret_ref = tag_ptr(ret_copy, true);
21140         return ret_ref;
21141 }
21142
21143 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) {
21144         LDKThirtyTwoBytes temporary_channel_id_ref;
21145         CHECK(temporary_channel_id->arr_len == 32);
21146         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21147         LDKPublicKey counterparty_node_id_ref;
21148         CHECK(counterparty_node_id->arr_len == 33);
21149         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21150         LDKCVec_u8Z output_script_ref;
21151         output_script_ref.datalen = output_script->arr_len;
21152         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21153         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21154         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21155         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
21156         uint64_t ret_ref = tag_ptr(ret_copy, true);
21157         return ret_ref;
21158 }
21159
21160 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21161         LDKThirtyTwoBytes payment_hash_ref;
21162         CHECK(payment_hash->arr_len == 32);
21163         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21164         void* purpose_ptr = untag_ptr(purpose);
21165         CHECK_ACCESS(purpose_ptr);
21166         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21167         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21168         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21169         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
21170         uint64_t ret_ref = tag_ptr(ret_copy, true);
21171         return ret_ref;
21172 }
21173
21174 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21175         LDKThirtyTwoBytes payment_hash_ref;
21176         CHECK(payment_hash->arr_len == 32);
21177         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21178         void* purpose_ptr = untag_ptr(purpose);
21179         CHECK_ACCESS(purpose_ptr);
21180         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21181         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21182         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21183         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
21184         uint64_t ret_ref = tag_ptr(ret_copy, true);
21185         return ret_ref;
21186 }
21187
21188 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) {
21189         LDKThirtyTwoBytes payment_id_ref;
21190         CHECK(payment_id->arr_len == 32);
21191         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21192         LDKThirtyTwoBytes payment_preimage_ref;
21193         CHECK(payment_preimage->arr_len == 32);
21194         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21195         LDKThirtyTwoBytes payment_hash_ref;
21196         CHECK(payment_hash->arr_len == 32);
21197         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21198         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21199         CHECK_ACCESS(fee_paid_msat_ptr);
21200         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21201         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21202         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21203         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21204         uint64_t ret_ref = tag_ptr(ret_copy, true);
21205         return ret_ref;
21206 }
21207
21208 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21209         LDKThirtyTwoBytes payment_id_ref;
21210         CHECK(payment_id->arr_len == 32);
21211         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21212         LDKThirtyTwoBytes payment_hash_ref;
21213         CHECK(payment_hash->arr_len == 32);
21214         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21215         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21216         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21217         uint64_t ret_ref = tag_ptr(ret_copy, true);
21218         return ret_ref;
21219 }
21220
21221 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) {
21222         LDKThirtyTwoBytes payment_id_ref;
21223         CHECK(payment_id->arr_len == 32);
21224         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21225         LDKThirtyTwoBytes payment_hash_ref;
21226         CHECK(payment_hash->arr_len == 32);
21227         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21228         LDKCVec_RouteHopZ path_constr;
21229         path_constr.datalen = path->arr_len;
21230         if (path_constr.datalen > 0)
21231                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21232         else
21233                 path_constr.data = NULL;
21234         uint64_t* path_vals = path->elems;
21235         for (size_t k = 0; k < path_constr.datalen; k++) {
21236                 uint64_t path_conv_10 = path_vals[k];
21237                 LDKRouteHop path_conv_10_conv;
21238                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21239                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21240                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21241                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21242                 path_constr.data[k] = path_conv_10_conv;
21243         }
21244         FREE(path);
21245         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21246         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21247         uint64_t ret_ref = tag_ptr(ret_copy, true);
21248         return ret_ref;
21249 }
21250
21251 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) {
21252         LDKThirtyTwoBytes payment_id_ref;
21253         CHECK(payment_id->arr_len == 32);
21254         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21255         LDKThirtyTwoBytes payment_hash_ref;
21256         CHECK(payment_hash->arr_len == 32);
21257         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21258         void* network_update_ptr = untag_ptr(network_update);
21259         CHECK_ACCESS(network_update_ptr);
21260         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21261         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
21262         LDKCVec_RouteHopZ path_constr;
21263         path_constr.datalen = path->arr_len;
21264         if (path_constr.datalen > 0)
21265                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21266         else
21267                 path_constr.data = NULL;
21268         uint64_t* path_vals = path->elems;
21269         for (size_t k = 0; k < path_constr.datalen; k++) {
21270                 uint64_t path_conv_10 = path_vals[k];
21271                 LDKRouteHop path_conv_10_conv;
21272                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21273                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21275                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21276                 path_constr.data[k] = path_conv_10_conv;
21277         }
21278         FREE(path);
21279         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21280         CHECK_ACCESS(short_channel_id_ptr);
21281         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21282         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21283         LDKRouteParameters retry_conv;
21284         retry_conv.inner = untag_ptr(retry);
21285         retry_conv.is_owned = ptr_is_owned(retry);
21286         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21287         retry_conv = RouteParameters_clone(&retry_conv);
21288         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21289         *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);
21290         uint64_t ret_ref = tag_ptr(ret_copy, true);
21291         return ret_ref;
21292 }
21293
21294 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
21295         LDKThirtyTwoBytes payment_id_ref;
21296         CHECK(payment_id->arr_len == 32);
21297         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21298         LDKThirtyTwoBytes payment_hash_ref;
21299         CHECK(payment_hash->arr_len == 32);
21300         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21301         LDKCVec_RouteHopZ path_constr;
21302         path_constr.datalen = path->arr_len;
21303         if (path_constr.datalen > 0)
21304                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21305         else
21306                 path_constr.data = NULL;
21307         uint64_t* path_vals = path->elems;
21308         for (size_t k = 0; k < path_constr.datalen; k++) {
21309                 uint64_t path_conv_10 = path_vals[k];
21310                 LDKRouteHop path_conv_10_conv;
21311                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21312                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21313                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21314                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21315                 path_constr.data[k] = path_conv_10_conv;
21316         }
21317         FREE(path);
21318         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21319         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
21320         uint64_t ret_ref = tag_ptr(ret_copy, true);
21321         return ret_ref;
21322 }
21323
21324 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) {
21325         LDKThirtyTwoBytes payment_id_ref;
21326         CHECK(payment_id->arr_len == 32);
21327         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21328         LDKThirtyTwoBytes payment_hash_ref;
21329         CHECK(payment_hash->arr_len == 32);
21330         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21331         LDKCVec_RouteHopZ path_constr;
21332         path_constr.datalen = path->arr_len;
21333         if (path_constr.datalen > 0)
21334                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21335         else
21336                 path_constr.data = NULL;
21337         uint64_t* path_vals = path->elems;
21338         for (size_t k = 0; k < path_constr.datalen; k++) {
21339                 uint64_t path_conv_10 = path_vals[k];
21340                 LDKRouteHop path_conv_10_conv;
21341                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21342                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21343                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21344                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21345                 path_constr.data[k] = path_conv_10_conv;
21346         }
21347         FREE(path);
21348         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21349         CHECK_ACCESS(short_channel_id_ptr);
21350         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21351         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21352         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21353         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
21354         uint64_t ret_ref = tag_ptr(ret_copy, true);
21355         return ret_ref;
21356 }
21357
21358 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
21359         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21360         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21361         uint64_t ret_ref = tag_ptr(ret_copy, true);
21362         return ret_ref;
21363 }
21364
21365 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
21366         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21367         outputs_constr.datalen = outputs->arr_len;
21368         if (outputs_constr.datalen > 0)
21369                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21370         else
21371                 outputs_constr.data = NULL;
21372         uint64_t* outputs_vals = outputs->elems;
21373         for (size_t b = 0; b < outputs_constr.datalen; b++) {
21374                 uint64_t outputs_conv_27 = outputs_vals[b];
21375                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
21376                 CHECK_ACCESS(outputs_conv_27_ptr);
21377                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21378                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
21379                 outputs_constr.data[b] = outputs_conv_27_conv;
21380         }
21381         FREE(outputs);
21382         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21383         *ret_copy = Event_spendable_outputs(outputs_constr);
21384         uint64_t ret_ref = tag_ptr(ret_copy, true);
21385         return ret_ref;
21386 }
21387
21388 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) {
21389         LDKThirtyTwoBytes prev_channel_id_ref;
21390         CHECK(prev_channel_id->arr_len == 32);
21391         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21392         LDKThirtyTwoBytes next_channel_id_ref;
21393         CHECK(next_channel_id->arr_len == 32);
21394         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
21395         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
21396         CHECK_ACCESS(fee_earned_msat_ptr);
21397         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21398         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
21399         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21400         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
21401         uint64_t ret_ref = tag_ptr(ret_copy, true);
21402         return ret_ref;
21403 }
21404
21405 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) {
21406         LDKThirtyTwoBytes channel_id_ref;
21407         CHECK(channel_id->arr_len == 32);
21408         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21409         void* reason_ptr = untag_ptr(reason);
21410         CHECK_ACCESS(reason_ptr);
21411         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21412         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
21413         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21414         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21415         uint64_t ret_ref = tag_ptr(ret_copy, true);
21416         return ret_ref;
21417 }
21418
21419 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
21420         LDKThirtyTwoBytes channel_id_ref;
21421         CHECK(channel_id->arr_len == 32);
21422         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21423         LDKTransaction transaction_ref;
21424         transaction_ref.datalen = transaction->arr_len;
21425         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21426         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
21427         transaction_ref.data_is_owned = true;
21428         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21429         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21430         uint64_t ret_ref = tag_ptr(ret_copy, true);
21431         return ret_ref;
21432 }
21433
21434 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) {
21435         LDKThirtyTwoBytes temporary_channel_id_ref;
21436         CHECK(temporary_channel_id->arr_len == 32);
21437         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21438         LDKPublicKey counterparty_node_id_ref;
21439         CHECK(counterparty_node_id->arr_len == 33);
21440         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21441         LDKChannelTypeFeatures channel_type_conv;
21442         channel_type_conv.inner = untag_ptr(channel_type);
21443         channel_type_conv.is_owned = ptr_is_owned(channel_type);
21444         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
21445         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
21446         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21447         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
21448         uint64_t ret_ref = tag_ptr(ret_copy, true);
21449         return ret_ref;
21450 }
21451
21452 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
21453         LDKThirtyTwoBytes prev_channel_id_ref;
21454         CHECK(prev_channel_id->arr_len == 32);
21455         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21456         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
21457         CHECK_ACCESS(failed_next_destination_ptr);
21458         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
21459         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
21460         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21461         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
21462         uint64_t ret_ref = tag_ptr(ret_copy, true);
21463         return ret_ref;
21464 }
21465
21466 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
21467         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
21468         LDKCVec_u8Z ret_var = Event_write(obj_conv);
21469         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21470         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21471         CVec_u8Z_free(ret_var);
21472         return ret_arr;
21473 }
21474
21475 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
21476         LDKu8slice ser_ref;
21477         ser_ref.datalen = ser->arr_len;
21478         ser_ref.data = ser->elems;
21479         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21480         *ret_conv = Event_read(ser_ref);
21481         FREE(ser);
21482         return tag_ptr(ret_conv, true);
21483 }
21484
21485 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
21486         if (!ptr_is_owned(this_ptr)) return;
21487         void* this_ptr_ptr = untag_ptr(this_ptr);
21488         CHECK_ACCESS(this_ptr_ptr);
21489         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21490         FREE(untag_ptr(this_ptr));
21491         MessageSendEvent_free(this_ptr_conv);
21492 }
21493
21494 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21495         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21496         *ret_copy = MessageSendEvent_clone(arg);
21497         uint64_t ret_ref = tag_ptr(ret_copy, true);
21498         return ret_ref;
21499 }
21500 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
21501         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
21502         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
21503         return ret_conv;
21504 }
21505
21506 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
21507         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
21508         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21509         *ret_copy = MessageSendEvent_clone(orig_conv);
21510         uint64_t ret_ref = tag_ptr(ret_copy, true);
21511         return ret_ref;
21512 }
21513
21514 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
21515         LDKPublicKey node_id_ref;
21516         CHECK(node_id->arr_len == 33);
21517         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21518         LDKAcceptChannel msg_conv;
21519         msg_conv.inner = untag_ptr(msg);
21520         msg_conv.is_owned = ptr_is_owned(msg);
21521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21522         msg_conv = AcceptChannel_clone(&msg_conv);
21523         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21524         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21525         uint64_t ret_ref = tag_ptr(ret_copy, true);
21526         return ret_ref;
21527 }
21528
21529 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
21530         LDKPublicKey node_id_ref;
21531         CHECK(node_id->arr_len == 33);
21532         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21533         LDKOpenChannel msg_conv;
21534         msg_conv.inner = untag_ptr(msg);
21535         msg_conv.is_owned = ptr_is_owned(msg);
21536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21537         msg_conv = OpenChannel_clone(&msg_conv);
21538         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21539         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21540         uint64_t ret_ref = tag_ptr(ret_copy, true);
21541         return ret_ref;
21542 }
21543
21544 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
21545         LDKPublicKey node_id_ref;
21546         CHECK(node_id->arr_len == 33);
21547         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21548         LDKFundingCreated msg_conv;
21549         msg_conv.inner = untag_ptr(msg);
21550         msg_conv.is_owned = ptr_is_owned(msg);
21551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21552         msg_conv = FundingCreated_clone(&msg_conv);
21553         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21554         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21555         uint64_t ret_ref = tag_ptr(ret_copy, true);
21556         return ret_ref;
21557 }
21558
21559 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
21560         LDKPublicKey node_id_ref;
21561         CHECK(node_id->arr_len == 33);
21562         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21563         LDKFundingSigned msg_conv;
21564         msg_conv.inner = untag_ptr(msg);
21565         msg_conv.is_owned = ptr_is_owned(msg);
21566         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21567         msg_conv = FundingSigned_clone(&msg_conv);
21568         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21569         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21570         uint64_t ret_ref = tag_ptr(ret_copy, true);
21571         return ret_ref;
21572 }
21573
21574 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
21575         LDKPublicKey node_id_ref;
21576         CHECK(node_id->arr_len == 33);
21577         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21578         LDKChannelReady msg_conv;
21579         msg_conv.inner = untag_ptr(msg);
21580         msg_conv.is_owned = ptr_is_owned(msg);
21581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21582         msg_conv = ChannelReady_clone(&msg_conv);
21583         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21584         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
21585         uint64_t ret_ref = tag_ptr(ret_copy, true);
21586         return ret_ref;
21587 }
21588
21589 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
21590         LDKPublicKey node_id_ref;
21591         CHECK(node_id->arr_len == 33);
21592         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21593         LDKAnnouncementSignatures msg_conv;
21594         msg_conv.inner = untag_ptr(msg);
21595         msg_conv.is_owned = ptr_is_owned(msg);
21596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21597         msg_conv = AnnouncementSignatures_clone(&msg_conv);
21598         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21599         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21600         uint64_t ret_ref = tag_ptr(ret_copy, true);
21601         return ret_ref;
21602 }
21603
21604 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
21605         LDKPublicKey node_id_ref;
21606         CHECK(node_id->arr_len == 33);
21607         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21608         LDKCommitmentUpdate updates_conv;
21609         updates_conv.inner = untag_ptr(updates);
21610         updates_conv.is_owned = ptr_is_owned(updates);
21611         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21612         updates_conv = CommitmentUpdate_clone(&updates_conv);
21613         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21614         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21615         uint64_t ret_ref = tag_ptr(ret_copy, true);
21616         return ret_ref;
21617 }
21618
21619 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
21620         LDKPublicKey node_id_ref;
21621         CHECK(node_id->arr_len == 33);
21622         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21623         LDKRevokeAndACK msg_conv;
21624         msg_conv.inner = untag_ptr(msg);
21625         msg_conv.is_owned = ptr_is_owned(msg);
21626         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21627         msg_conv = RevokeAndACK_clone(&msg_conv);
21628         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21629         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21630         uint64_t ret_ref = tag_ptr(ret_copy, true);
21631         return ret_ref;
21632 }
21633
21634 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
21635         LDKPublicKey node_id_ref;
21636         CHECK(node_id->arr_len == 33);
21637         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21638         LDKClosingSigned msg_conv;
21639         msg_conv.inner = untag_ptr(msg);
21640         msg_conv.is_owned = ptr_is_owned(msg);
21641         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21642         msg_conv = ClosingSigned_clone(&msg_conv);
21643         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21644         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21645         uint64_t ret_ref = tag_ptr(ret_copy, true);
21646         return ret_ref;
21647 }
21648
21649 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
21650         LDKPublicKey node_id_ref;
21651         CHECK(node_id->arr_len == 33);
21652         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21653         LDKShutdown msg_conv;
21654         msg_conv.inner = untag_ptr(msg);
21655         msg_conv.is_owned = ptr_is_owned(msg);
21656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21657         msg_conv = Shutdown_clone(&msg_conv);
21658         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21659         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
21660         uint64_t ret_ref = tag_ptr(ret_copy, true);
21661         return ret_ref;
21662 }
21663
21664 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
21665         LDKPublicKey node_id_ref;
21666         CHECK(node_id->arr_len == 33);
21667         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21668         LDKChannelReestablish msg_conv;
21669         msg_conv.inner = untag_ptr(msg);
21670         msg_conv.is_owned = ptr_is_owned(msg);
21671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21672         msg_conv = ChannelReestablish_clone(&msg_conv);
21673         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21674         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
21675         uint64_t ret_ref = tag_ptr(ret_copy, true);
21676         return ret_ref;
21677 }
21678
21679 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) {
21680         LDKPublicKey node_id_ref;
21681         CHECK(node_id->arr_len == 33);
21682         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21683         LDKChannelAnnouncement msg_conv;
21684         msg_conv.inner = untag_ptr(msg);
21685         msg_conv.is_owned = ptr_is_owned(msg);
21686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21687         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21688         LDKChannelUpdate update_msg_conv;
21689         update_msg_conv.inner = untag_ptr(update_msg);
21690         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21691         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21692         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21693         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21694         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
21695         uint64_t ret_ref = tag_ptr(ret_copy, true);
21696         return ret_ref;
21697 }
21698
21699 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
21700         LDKChannelAnnouncement msg_conv;
21701         msg_conv.inner = untag_ptr(msg);
21702         msg_conv.is_owned = ptr_is_owned(msg);
21703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21704         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21705         LDKChannelUpdate update_msg_conv;
21706         update_msg_conv.inner = untag_ptr(update_msg);
21707         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21708         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21709         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21710         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21711         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
21712         uint64_t ret_ref = tag_ptr(ret_copy, true);
21713         return ret_ref;
21714 }
21715
21716 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
21717         LDKChannelUpdate msg_conv;
21718         msg_conv.inner = untag_ptr(msg);
21719         msg_conv.is_owned = ptr_is_owned(msg);
21720         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21721         msg_conv = ChannelUpdate_clone(&msg_conv);
21722         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21723         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
21724         uint64_t ret_ref = tag_ptr(ret_copy, true);
21725         return ret_ref;
21726 }
21727
21728 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
21729         LDKPublicKey node_id_ref;
21730         CHECK(node_id->arr_len == 33);
21731         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21732         LDKChannelUpdate msg_conv;
21733         msg_conv.inner = untag_ptr(msg);
21734         msg_conv.is_owned = ptr_is_owned(msg);
21735         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21736         msg_conv = ChannelUpdate_clone(&msg_conv);
21737         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21738         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
21739         uint64_t ret_ref = tag_ptr(ret_copy, true);
21740         return ret_ref;
21741 }
21742
21743 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
21744         LDKPublicKey node_id_ref;
21745         CHECK(node_id->arr_len == 33);
21746         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21747         void* action_ptr = untag_ptr(action);
21748         CHECK_ACCESS(action_ptr);
21749         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
21750         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
21751         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21752         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
21753         uint64_t ret_ref = tag_ptr(ret_copy, true);
21754         return ret_ref;
21755 }
21756
21757 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
21758         LDKPublicKey node_id_ref;
21759         CHECK(node_id->arr_len == 33);
21760         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21761         LDKQueryChannelRange msg_conv;
21762         msg_conv.inner = untag_ptr(msg);
21763         msg_conv.is_owned = ptr_is_owned(msg);
21764         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21765         msg_conv = QueryChannelRange_clone(&msg_conv);
21766         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21767         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
21768         uint64_t ret_ref = tag_ptr(ret_copy, true);
21769         return ret_ref;
21770 }
21771
21772 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
21773         LDKPublicKey node_id_ref;
21774         CHECK(node_id->arr_len == 33);
21775         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21776         LDKQueryShortChannelIds msg_conv;
21777         msg_conv.inner = untag_ptr(msg);
21778         msg_conv.is_owned = ptr_is_owned(msg);
21779         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21780         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21781         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21782         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
21783         uint64_t ret_ref = tag_ptr(ret_copy, true);
21784         return ret_ref;
21785 }
21786
21787 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
21788         LDKPublicKey node_id_ref;
21789         CHECK(node_id->arr_len == 33);
21790         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21791         LDKReplyChannelRange msg_conv;
21792         msg_conv.inner = untag_ptr(msg);
21793         msg_conv.is_owned = ptr_is_owned(msg);
21794         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21795         msg_conv = ReplyChannelRange_clone(&msg_conv);
21796         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21797         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
21798         uint64_t ret_ref = tag_ptr(ret_copy, true);
21799         return ret_ref;
21800 }
21801
21802 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
21803         LDKPublicKey node_id_ref;
21804         CHECK(node_id->arr_len == 33);
21805         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21806         LDKGossipTimestampFilter msg_conv;
21807         msg_conv.inner = untag_ptr(msg);
21808         msg_conv.is_owned = ptr_is_owned(msg);
21809         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21810         msg_conv = GossipTimestampFilter_clone(&msg_conv);
21811         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21812         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
21813         uint64_t ret_ref = tag_ptr(ret_copy, true);
21814         return ret_ref;
21815 }
21816
21817 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
21818         if (!ptr_is_owned(this_ptr)) return;
21819         void* this_ptr_ptr = untag_ptr(this_ptr);
21820         CHECK_ACCESS(this_ptr_ptr);
21821         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
21822         FREE(untag_ptr(this_ptr));
21823         MessageSendEventsProvider_free(this_ptr_conv);
21824 }
21825
21826 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
21827         if (!ptr_is_owned(this_ptr)) return;
21828         void* this_ptr_ptr = untag_ptr(this_ptr);
21829         CHECK_ACCESS(this_ptr_ptr);
21830         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
21831         FREE(untag_ptr(this_ptr));
21832         OnionMessageProvider_free(this_ptr_conv);
21833 }
21834
21835 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
21836         if (!ptr_is_owned(this_ptr)) return;
21837         void* this_ptr_ptr = untag_ptr(this_ptr);
21838         CHECK_ACCESS(this_ptr_ptr);
21839         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
21840         FREE(untag_ptr(this_ptr));
21841         EventsProvider_free(this_ptr_conv);
21842 }
21843
21844 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
21845         if (!ptr_is_owned(this_ptr)) return;
21846         void* this_ptr_ptr = untag_ptr(this_ptr);
21847         CHECK_ACCESS(this_ptr_ptr);
21848         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
21849         FREE(untag_ptr(this_ptr));
21850         EventHandler_free(this_ptr_conv);
21851 }
21852
21853 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
21854         if (!ptr_is_owned(this_ptr)) return;
21855         void* this_ptr_ptr = untag_ptr(this_ptr);
21856         CHECK_ACCESS(this_ptr_ptr);
21857         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
21858         FREE(untag_ptr(this_ptr));
21859         APIError_free(this_ptr_conv);
21860 }
21861
21862 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
21863         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21864         *ret_copy = APIError_clone(arg);
21865         uint64_t ret_ref = tag_ptr(ret_copy, true);
21866         return ret_ref;
21867 }
21868 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
21869         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
21870         int64_t ret_conv = APIError_clone_ptr(arg_conv);
21871         return ret_conv;
21872 }
21873
21874 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
21875         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
21876         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21877         *ret_copy = APIError_clone(orig_conv);
21878         uint64_t ret_ref = tag_ptr(ret_copy, true);
21879         return ret_ref;
21880 }
21881
21882 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
21883         LDKStr err_conv = str_ref_to_owned_c(err);
21884         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21885         *ret_copy = APIError_apimisuse_error(err_conv);
21886         uint64_t ret_ref = tag_ptr(ret_copy, true);
21887         return ret_ref;
21888 }
21889
21890 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
21891         LDKStr err_conv = str_ref_to_owned_c(err);
21892         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21893         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
21894         uint64_t ret_ref = tag_ptr(ret_copy, true);
21895         return ret_ref;
21896 }
21897
21898 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
21899         LDKStr err_conv = str_ref_to_owned_c(err);
21900         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21901         *ret_copy = APIError_route_error(err_conv);
21902         uint64_t ret_ref = tag_ptr(ret_copy, true);
21903         return ret_ref;
21904 }
21905
21906 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
21907         LDKStr err_conv = str_ref_to_owned_c(err);
21908         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21909         *ret_copy = APIError_channel_unavailable(err_conv);
21910         uint64_t ret_ref = tag_ptr(ret_copy, true);
21911         return ret_ref;
21912 }
21913
21914 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
21915         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21916         *ret_copy = APIError_monitor_update_in_progress();
21917         uint64_t ret_ref = tag_ptr(ret_copy, true);
21918         return ret_ref;
21919 }
21920
21921 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
21922         LDKShutdownScript script_conv;
21923         script_conv.inner = untag_ptr(script);
21924         script_conv.is_owned = ptr_is_owned(script);
21925         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
21926         script_conv = ShutdownScript_clone(&script_conv);
21927         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21928         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
21929         uint64_t ret_ref = tag_ptr(ret_copy, true);
21930         return ret_ref;
21931 }
21932
21933 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
21934         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
21935         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
21936         jboolean ret_conv = APIError_eq(a_conv, b_conv);
21937         return ret_conv;
21938 }
21939
21940 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
21941         LDKBigSize this_obj_conv;
21942         this_obj_conv.inner = untag_ptr(this_obj);
21943         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21945         BigSize_free(this_obj_conv);
21946 }
21947
21948 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
21949         LDKBigSize this_ptr_conv;
21950         this_ptr_conv.inner = untag_ptr(this_ptr);
21951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21953         this_ptr_conv.is_owned = false;
21954         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
21955         return ret_conv;
21956 }
21957
21958 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
21959         LDKBigSize this_ptr_conv;
21960         this_ptr_conv.inner = untag_ptr(this_ptr);
21961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21963         this_ptr_conv.is_owned = false;
21964         BigSize_set_a(&this_ptr_conv, val);
21965 }
21966
21967 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
21968         LDKBigSize ret_var = BigSize_new(a_arg);
21969         uint64_t ret_ref = 0;
21970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21972         return ret_ref;
21973 }
21974
21975 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
21976         LDKHostname this_obj_conv;
21977         this_obj_conv.inner = untag_ptr(this_obj);
21978         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21980         Hostname_free(this_obj_conv);
21981 }
21982
21983 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
21984         LDKHostname ret_var = Hostname_clone(arg);
21985         uint64_t ret_ref = 0;
21986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21988         return ret_ref;
21989 }
21990 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
21991         LDKHostname arg_conv;
21992         arg_conv.inner = untag_ptr(arg);
21993         arg_conv.is_owned = ptr_is_owned(arg);
21994         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21995         arg_conv.is_owned = false;
21996         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
21997         return ret_conv;
21998 }
21999
22000 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22001         LDKHostname orig_conv;
22002         orig_conv.inner = untag_ptr(orig);
22003         orig_conv.is_owned = ptr_is_owned(orig);
22004         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22005         orig_conv.is_owned = false;
22006         LDKHostname ret_var = Hostname_clone(&orig_conv);
22007         uint64_t ret_ref = 0;
22008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22010         return ret_ref;
22011 }
22012
22013 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22014         LDKHostname a_conv;
22015         a_conv.inner = untag_ptr(a);
22016         a_conv.is_owned = ptr_is_owned(a);
22017         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22018         a_conv.is_owned = false;
22019         LDKHostname b_conv;
22020         b_conv.inner = untag_ptr(b);
22021         b_conv.is_owned = ptr_is_owned(b);
22022         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22023         b_conv.is_owned = false;
22024         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22025         return ret_conv;
22026 }
22027
22028 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22029         LDKHostname this_arg_conv;
22030         this_arg_conv.inner = untag_ptr(this_arg);
22031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22033         this_arg_conv.is_owned = false;
22034         int8_t ret_conv = Hostname_len(&this_arg_conv);
22035         return ret_conv;
22036 }
22037
22038 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22039         LDKu8slice msg_ref;
22040         msg_ref.datalen = msg->arr_len;
22041         msg_ref.data = msg->elems;
22042         unsigned char sk_arr[32];
22043         CHECK(sk->arr_len == 32);
22044         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22045         unsigned char (*sk_ref)[32] = &sk_arr;
22046         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22047         *ret_conv = sign(msg_ref, sk_ref);
22048         FREE(msg);
22049         return tag_ptr(ret_conv, true);
22050 }
22051
22052 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22053         LDKu8slice msg_ref;
22054         msg_ref.datalen = msg->arr_len;
22055         msg_ref.data = msg->elems;
22056         LDKStr sig_conv = str_ref_to_owned_c(sig);
22057         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22058         *ret_conv = recover_pk(msg_ref, sig_conv);
22059         FREE(msg);
22060         return tag_ptr(ret_conv, true);
22061 }
22062
22063 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22064         LDKu8slice msg_ref;
22065         msg_ref.datalen = msg->arr_len;
22066         msg_ref.data = msg->elems;
22067         LDKStr sig_conv = str_ref_to_owned_c(sig);
22068         LDKPublicKey pk_ref;
22069         CHECK(pk->arr_len == 33);
22070         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22071         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22072         FREE(msg);
22073         return ret_conv;
22074 }
22075
22076 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22077         LDKu8slice hrp_bytes_ref;
22078         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22079         hrp_bytes_ref.data = hrp_bytes->elems;
22080         LDKCVec_u5Z data_without_signature_constr;
22081         data_without_signature_constr.datalen = data_without_signature->arr_len;
22082         if (data_without_signature_constr.datalen > 0)
22083                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
22084         else
22085                 data_without_signature_constr.data = NULL;
22086         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22087         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22088                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22089                 
22090                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
22091         }
22092         FREE(data_without_signature);
22093         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22094         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22095         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22096         CVec_u8Z_free(ret_var);
22097         FREE(hrp_bytes);
22098         return ret_arr;
22099 }
22100
22101 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22102         if (!ptr_is_owned(this_ptr)) return;
22103         void* this_ptr_ptr = untag_ptr(this_ptr);
22104         CHECK_ACCESS(this_ptr_ptr);
22105         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22106         FREE(untag_ptr(this_ptr));
22107         Persister_free(this_ptr_conv);
22108 }
22109
22110 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
22111         if (!ptr_is_owned(this_ptr)) return;
22112         void* this_ptr_ptr = untag_ptr(this_ptr);
22113         CHECK_ACCESS(this_ptr_ptr);
22114         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
22115         FREE(untag_ptr(this_ptr));
22116         FutureCallback_free(this_ptr_conv);
22117 }
22118
22119 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
22120         LDKFuture this_obj_conv;
22121         this_obj_conv.inner = untag_ptr(this_obj);
22122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22124         Future_free(this_obj_conv);
22125 }
22126
22127 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22128         LDKFuture this_arg_conv;
22129         this_arg_conv.inner = untag_ptr(this_arg);
22130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22132         this_arg_conv.is_owned = false;
22133         void* callback_ptr = untag_ptr(callback);
22134         CHECK_ACCESS(callback_ptr);
22135         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
22136         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
22137                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22138                 LDKFutureCallback_JCalls_cloned(&callback_conv);
22139         }
22140         Future_register_callback_fn(&this_arg_conv, callback_conv);
22141 }
22142
22143 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
22144         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
22145         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
22146         return ret_conv;
22147 }
22148
22149 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
22150         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
22151         return ret_conv;
22152 }
22153
22154 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
22155         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
22156         return ret_conv;
22157 }
22158
22159 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
22160         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
22161         return ret_conv;
22162 }
22163
22164 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
22165         uint32_t ret_conv = LDKLevel_to_js(Level_info());
22166         return ret_conv;
22167 }
22168
22169 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
22170         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
22171         return ret_conv;
22172 }
22173
22174 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
22175         uint32_t ret_conv = LDKLevel_to_js(Level_error());
22176         return ret_conv;
22177 }
22178
22179 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
22180         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
22181         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
22182         jboolean ret_conv = Level_eq(a_conv, b_conv);
22183         return ret_conv;
22184 }
22185
22186 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
22187         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
22188         int64_t ret_conv = Level_hash(o_conv);
22189         return ret_conv;
22190 }
22191
22192 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
22193         uint32_t ret_conv = LDKLevel_to_js(Level_max());
22194         return ret_conv;
22195 }
22196
22197 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
22198         LDKRecord this_obj_conv;
22199         this_obj_conv.inner = untag_ptr(this_obj);
22200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22202         Record_free(this_obj_conv);
22203 }
22204
22205 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
22206         LDKRecord this_ptr_conv;
22207         this_ptr_conv.inner = untag_ptr(this_ptr);
22208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22210         this_ptr_conv.is_owned = false;
22211         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
22212         return ret_conv;
22213 }
22214
22215 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
22216         LDKRecord this_ptr_conv;
22217         this_ptr_conv.inner = untag_ptr(this_ptr);
22218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22220         this_ptr_conv.is_owned = false;
22221         LDKLevel val_conv = LDKLevel_from_js(val);
22222         Record_set_level(&this_ptr_conv, val_conv);
22223 }
22224
22225 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
22226         LDKRecord this_ptr_conv;
22227         this_ptr_conv.inner = untag_ptr(this_ptr);
22228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22230         this_ptr_conv.is_owned = false;
22231         LDKStr ret_str = Record_get_args(&this_ptr_conv);
22232         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22233         Str_free(ret_str);
22234         return ret_conv;
22235 }
22236
22237 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
22238         LDKRecord this_ptr_conv;
22239         this_ptr_conv.inner = untag_ptr(this_ptr);
22240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22242         this_ptr_conv.is_owned = false;
22243         LDKStr val_conv = str_ref_to_owned_c(val);
22244         Record_set_args(&this_ptr_conv, val_conv);
22245 }
22246
22247 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
22248         LDKRecord this_ptr_conv;
22249         this_ptr_conv.inner = untag_ptr(this_ptr);
22250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22252         this_ptr_conv.is_owned = false;
22253         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
22254         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22255         Str_free(ret_str);
22256         return ret_conv;
22257 }
22258
22259 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
22260         LDKRecord this_ptr_conv;
22261         this_ptr_conv.inner = untag_ptr(this_ptr);
22262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22264         this_ptr_conv.is_owned = false;
22265         LDKStr val_conv = str_ref_to_owned_c(val);
22266         Record_set_module_path(&this_ptr_conv, val_conv);
22267 }
22268
22269 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
22270         LDKRecord this_ptr_conv;
22271         this_ptr_conv.inner = untag_ptr(this_ptr);
22272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22274         this_ptr_conv.is_owned = false;
22275         LDKStr ret_str = Record_get_file(&this_ptr_conv);
22276         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22277         Str_free(ret_str);
22278         return ret_conv;
22279 }
22280
22281 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
22282         LDKRecord this_ptr_conv;
22283         this_ptr_conv.inner = untag_ptr(this_ptr);
22284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22286         this_ptr_conv.is_owned = false;
22287         LDKStr val_conv = str_ref_to_owned_c(val);
22288         Record_set_file(&this_ptr_conv, val_conv);
22289 }
22290
22291 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
22292         LDKRecord this_ptr_conv;
22293         this_ptr_conv.inner = untag_ptr(this_ptr);
22294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22296         this_ptr_conv.is_owned = false;
22297         int32_t ret_conv = Record_get_line(&this_ptr_conv);
22298         return ret_conv;
22299 }
22300
22301 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
22302         LDKRecord this_ptr_conv;
22303         this_ptr_conv.inner = untag_ptr(this_ptr);
22304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22306         this_ptr_conv.is_owned = false;
22307         Record_set_line(&this_ptr_conv, val);
22308 }
22309
22310 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22311         LDKRecord ret_var = Record_clone(arg);
22312         uint64_t ret_ref = 0;
22313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22315         return ret_ref;
22316 }
22317 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
22318         LDKRecord arg_conv;
22319         arg_conv.inner = untag_ptr(arg);
22320         arg_conv.is_owned = ptr_is_owned(arg);
22321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22322         arg_conv.is_owned = false;
22323         int64_t ret_conv = Record_clone_ptr(&arg_conv);
22324         return ret_conv;
22325 }
22326
22327 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
22328         LDKRecord orig_conv;
22329         orig_conv.inner = untag_ptr(orig);
22330         orig_conv.is_owned = ptr_is_owned(orig);
22331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22332         orig_conv.is_owned = false;
22333         LDKRecord ret_var = Record_clone(&orig_conv);
22334         uint64_t ret_ref = 0;
22335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22337         return ret_ref;
22338 }
22339
22340 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
22341         if (!ptr_is_owned(this_ptr)) return;
22342         void* this_ptr_ptr = untag_ptr(this_ptr);
22343         CHECK_ACCESS(this_ptr_ptr);
22344         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22345         FREE(untag_ptr(this_ptr));
22346         Logger_free(this_ptr_conv);
22347 }
22348
22349 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
22350         LDKChannelHandshakeConfig this_obj_conv;
22351         this_obj_conv.inner = untag_ptr(this_obj);
22352         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22354         ChannelHandshakeConfig_free(this_obj_conv);
22355 }
22356
22357 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
22358         LDKChannelHandshakeConfig this_ptr_conv;
22359         this_ptr_conv.inner = untag_ptr(this_ptr);
22360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22362         this_ptr_conv.is_owned = false;
22363         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22364         return ret_conv;
22365 }
22366
22367 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
22368         LDKChannelHandshakeConfig this_ptr_conv;
22369         this_ptr_conv.inner = untag_ptr(this_ptr);
22370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22372         this_ptr_conv.is_owned = false;
22373         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22374 }
22375
22376 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
22377         LDKChannelHandshakeConfig this_ptr_conv;
22378         this_ptr_conv.inner = untag_ptr(this_ptr);
22379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22381         this_ptr_conv.is_owned = false;
22382         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22383         return ret_conv;
22384 }
22385
22386 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) {
22387         LDKChannelHandshakeConfig this_ptr_conv;
22388         this_ptr_conv.inner = untag_ptr(this_ptr);
22389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22391         this_ptr_conv.is_owned = false;
22392         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22393 }
22394
22395 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
22396         LDKChannelHandshakeConfig this_ptr_conv;
22397         this_ptr_conv.inner = untag_ptr(this_ptr);
22398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22400         this_ptr_conv.is_owned = false;
22401         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22402         return ret_conv;
22403 }
22404
22405 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) {
22406         LDKChannelHandshakeConfig this_ptr_conv;
22407         this_ptr_conv.inner = untag_ptr(this_ptr);
22408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22410         this_ptr_conv.is_owned = false;
22411         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22412 }
22413
22414 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) {
22415         LDKChannelHandshakeConfig this_ptr_conv;
22416         this_ptr_conv.inner = untag_ptr(this_ptr);
22417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22419         this_ptr_conv.is_owned = false;
22420         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
22421         return ret_conv;
22422 }
22423
22424 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) {
22425         LDKChannelHandshakeConfig this_ptr_conv;
22426         this_ptr_conv.inner = untag_ptr(this_ptr);
22427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22429         this_ptr_conv.is_owned = false;
22430         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
22431 }
22432
22433 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
22434         LDKChannelHandshakeConfig this_ptr_conv;
22435         this_ptr_conv.inner = untag_ptr(this_ptr);
22436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22438         this_ptr_conv.is_owned = false;
22439         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
22440         return ret_conv;
22441 }
22442
22443 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
22444         LDKChannelHandshakeConfig this_ptr_conv;
22445         this_ptr_conv.inner = untag_ptr(this_ptr);
22446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22448         this_ptr_conv.is_owned = false;
22449         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
22450 }
22451
22452 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
22453         LDKChannelHandshakeConfig this_ptr_conv;
22454         this_ptr_conv.inner = untag_ptr(this_ptr);
22455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22457         this_ptr_conv.is_owned = false;
22458         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
22459         return ret_conv;
22460 }
22461
22462 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
22463         LDKChannelHandshakeConfig this_ptr_conv;
22464         this_ptr_conv.inner = untag_ptr(this_ptr);
22465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22467         this_ptr_conv.is_owned = false;
22468         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
22469 }
22470
22471 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
22472         LDKChannelHandshakeConfig this_ptr_conv;
22473         this_ptr_conv.inner = untag_ptr(this_ptr);
22474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22476         this_ptr_conv.is_owned = false;
22477         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22478         return ret_conv;
22479 }
22480
22481 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
22482         LDKChannelHandshakeConfig this_ptr_conv;
22483         this_ptr_conv.inner = untag_ptr(this_ptr);
22484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22486         this_ptr_conv.is_owned = false;
22487         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22488 }
22489
22490 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) {
22491         LDKChannelHandshakeConfig this_ptr_conv;
22492         this_ptr_conv.inner = untag_ptr(this_ptr);
22493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22495         this_ptr_conv.is_owned = false;
22496         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
22497         return ret_conv;
22498 }
22499
22500 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) {
22501         LDKChannelHandshakeConfig this_ptr_conv;
22502         this_ptr_conv.inner = untag_ptr(this_ptr);
22503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22505         this_ptr_conv.is_owned = false;
22506         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
22507 }
22508
22509 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) {
22510         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);
22511         uint64_t ret_ref = 0;
22512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22514         return ret_ref;
22515 }
22516
22517 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22518         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22519         uint64_t ret_ref = 0;
22520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22522         return ret_ref;
22523 }
22524 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
22525         LDKChannelHandshakeConfig arg_conv;
22526         arg_conv.inner = untag_ptr(arg);
22527         arg_conv.is_owned = ptr_is_owned(arg);
22528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22529         arg_conv.is_owned = false;
22530         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22531         return ret_conv;
22532 }
22533
22534 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
22535         LDKChannelHandshakeConfig orig_conv;
22536         orig_conv.inner = untag_ptr(orig);
22537         orig_conv.is_owned = ptr_is_owned(orig);
22538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22539         orig_conv.is_owned = false;
22540         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22541         uint64_t ret_ref = 0;
22542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22544         return ret_ref;
22545 }
22546
22547 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
22548         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22549         uint64_t ret_ref = 0;
22550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22552         return ret_ref;
22553 }
22554
22555 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
22556         LDKChannelHandshakeLimits this_obj_conv;
22557         this_obj_conv.inner = untag_ptr(this_obj);
22558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22560         ChannelHandshakeLimits_free(this_obj_conv);
22561 }
22562
22563 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
22564         LDKChannelHandshakeLimits this_ptr_conv;
22565         this_ptr_conv.inner = untag_ptr(this_ptr);
22566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22568         this_ptr_conv.is_owned = false;
22569         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22570         return ret_conv;
22571 }
22572
22573 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
22574         LDKChannelHandshakeLimits this_ptr_conv;
22575         this_ptr_conv.inner = untag_ptr(this_ptr);
22576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22578         this_ptr_conv.is_owned = false;
22579         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22580 }
22581
22582 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
22583         LDKChannelHandshakeLimits this_ptr_conv;
22584         this_ptr_conv.inner = untag_ptr(this_ptr);
22585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22587         this_ptr_conv.is_owned = false;
22588         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
22589         return ret_conv;
22590 }
22591
22592 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
22593         LDKChannelHandshakeLimits this_ptr_conv;
22594         this_ptr_conv.inner = untag_ptr(this_ptr);
22595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22597         this_ptr_conv.is_owned = false;
22598         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
22599 }
22600
22601 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
22602         LDKChannelHandshakeLimits this_ptr_conv;
22603         this_ptr_conv.inner = untag_ptr(this_ptr);
22604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22606         this_ptr_conv.is_owned = false;
22607         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22608         return ret_conv;
22609 }
22610
22611 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) {
22612         LDKChannelHandshakeLimits this_ptr_conv;
22613         this_ptr_conv.inner = untag_ptr(this_ptr);
22614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22616         this_ptr_conv.is_owned = false;
22617         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22618 }
22619
22620 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) {
22621         LDKChannelHandshakeLimits this_ptr_conv;
22622         this_ptr_conv.inner = untag_ptr(this_ptr);
22623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22625         this_ptr_conv.is_owned = false;
22626         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22627         return ret_conv;
22628 }
22629
22630 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) {
22631         LDKChannelHandshakeLimits this_ptr_conv;
22632         this_ptr_conv.inner = untag_ptr(this_ptr);
22633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22635         this_ptr_conv.is_owned = false;
22636         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22637 }
22638
22639 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
22640         LDKChannelHandshakeLimits this_ptr_conv;
22641         this_ptr_conv.inner = untag_ptr(this_ptr);
22642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22644         this_ptr_conv.is_owned = false;
22645         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22646         return ret_conv;
22647 }
22648
22649 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) {
22650         LDKChannelHandshakeLimits this_ptr_conv;
22651         this_ptr_conv.inner = untag_ptr(this_ptr);
22652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22654         this_ptr_conv.is_owned = false;
22655         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22656 }
22657
22658 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
22659         LDKChannelHandshakeLimits this_ptr_conv;
22660         this_ptr_conv.inner = untag_ptr(this_ptr);
22661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22663         this_ptr_conv.is_owned = false;
22664         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22665         return ret_conv;
22666 }
22667
22668 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) {
22669         LDKChannelHandshakeLimits this_ptr_conv;
22670         this_ptr_conv.inner = untag_ptr(this_ptr);
22671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22673         this_ptr_conv.is_owned = false;
22674         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22675 }
22676
22677 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
22678         LDKChannelHandshakeLimits this_ptr_conv;
22679         this_ptr_conv.inner = untag_ptr(this_ptr);
22680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22682         this_ptr_conv.is_owned = false;
22683         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22684         return ret_conv;
22685 }
22686
22687 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
22688         LDKChannelHandshakeLimits this_ptr_conv;
22689         this_ptr_conv.inner = untag_ptr(this_ptr);
22690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22692         this_ptr_conv.is_owned = false;
22693         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22694 }
22695
22696 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
22697         LDKChannelHandshakeLimits this_ptr_conv;
22698         this_ptr_conv.inner = untag_ptr(this_ptr);
22699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22701         this_ptr_conv.is_owned = false;
22702         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
22703         return ret_conv;
22704 }
22705
22706 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
22707         LDKChannelHandshakeLimits this_ptr_conv;
22708         this_ptr_conv.inner = untag_ptr(this_ptr);
22709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22711         this_ptr_conv.is_owned = false;
22712         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
22713 }
22714
22715 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
22716         LDKChannelHandshakeLimits this_ptr_conv;
22717         this_ptr_conv.inner = untag_ptr(this_ptr);
22718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22720         this_ptr_conv.is_owned = false;
22721         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22722         return ret_conv;
22723 }
22724
22725 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
22726         LDKChannelHandshakeLimits this_ptr_conv;
22727         this_ptr_conv.inner = untag_ptr(this_ptr);
22728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22730         this_ptr_conv.is_owned = false;
22731         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22732 }
22733
22734 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
22735         LDKChannelHandshakeLimits this_ptr_conv;
22736         this_ptr_conv.inner = untag_ptr(this_ptr);
22737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22739         this_ptr_conv.is_owned = false;
22740         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22741         return ret_conv;
22742 }
22743
22744 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) {
22745         LDKChannelHandshakeLimits this_ptr_conv;
22746         this_ptr_conv.inner = untag_ptr(this_ptr);
22747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22749         this_ptr_conv.is_owned = false;
22750         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22751 }
22752
22753 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) {
22754         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);
22755         uint64_t ret_ref = 0;
22756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22758         return ret_ref;
22759 }
22760
22761 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22762         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22763         uint64_t ret_ref = 0;
22764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22766         return ret_ref;
22767 }
22768 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
22769         LDKChannelHandshakeLimits arg_conv;
22770         arg_conv.inner = untag_ptr(arg);
22771         arg_conv.is_owned = ptr_is_owned(arg);
22772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22773         arg_conv.is_owned = false;
22774         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22775         return ret_conv;
22776 }
22777
22778 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
22779         LDKChannelHandshakeLimits orig_conv;
22780         orig_conv.inner = untag_ptr(orig);
22781         orig_conv.is_owned = ptr_is_owned(orig);
22782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22783         orig_conv.is_owned = false;
22784         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22785         uint64_t ret_ref = 0;
22786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22788         return ret_ref;
22789 }
22790
22791 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
22792         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22793         uint64_t ret_ref = 0;
22794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22796         return ret_ref;
22797 }
22798
22799 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
22800         LDKChannelConfig this_obj_conv;
22801         this_obj_conv.inner = untag_ptr(this_obj);
22802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22804         ChannelConfig_free(this_obj_conv);
22805 }
22806
22807 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
22808         LDKChannelConfig this_ptr_conv;
22809         this_ptr_conv.inner = untag_ptr(this_ptr);
22810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22812         this_ptr_conv.is_owned = false;
22813         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22814         return ret_conv;
22815 }
22816
22817 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) {
22818         LDKChannelConfig this_ptr_conv;
22819         this_ptr_conv.inner = untag_ptr(this_ptr);
22820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22822         this_ptr_conv.is_owned = false;
22823         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22824 }
22825
22826 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
22827         LDKChannelConfig this_ptr_conv;
22828         this_ptr_conv.inner = untag_ptr(this_ptr);
22829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22831         this_ptr_conv.is_owned = false;
22832         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22833         return ret_conv;
22834 }
22835
22836 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) {
22837         LDKChannelConfig this_ptr_conv;
22838         this_ptr_conv.inner = untag_ptr(this_ptr);
22839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22841         this_ptr_conv.is_owned = false;
22842         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22843 }
22844
22845 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
22846         LDKChannelConfig this_ptr_conv;
22847         this_ptr_conv.inner = untag_ptr(this_ptr);
22848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22850         this_ptr_conv.is_owned = false;
22851         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22852         return ret_conv;
22853 }
22854
22855 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
22856         LDKChannelConfig this_ptr_conv;
22857         this_ptr_conv.inner = untag_ptr(this_ptr);
22858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22860         this_ptr_conv.is_owned = false;
22861         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22862 }
22863
22864 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) {
22865         LDKChannelConfig this_ptr_conv;
22866         this_ptr_conv.inner = untag_ptr(this_ptr);
22867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22869         this_ptr_conv.is_owned = false;
22870         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22871         return ret_conv;
22872 }
22873
22874 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) {
22875         LDKChannelConfig this_ptr_conv;
22876         this_ptr_conv.inner = untag_ptr(this_ptr);
22877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22879         this_ptr_conv.is_owned = false;
22880         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22881 }
22882
22883 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) {
22884         LDKChannelConfig this_ptr_conv;
22885         this_ptr_conv.inner = untag_ptr(this_ptr);
22886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22888         this_ptr_conv.is_owned = false;
22889         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22890         return ret_conv;
22891 }
22892
22893 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) {
22894         LDKChannelConfig this_ptr_conv;
22895         this_ptr_conv.inner = untag_ptr(this_ptr);
22896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22898         this_ptr_conv.is_owned = false;
22899         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22900 }
22901
22902 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) {
22903         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);
22904         uint64_t ret_ref = 0;
22905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22907         return ret_ref;
22908 }
22909
22910 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22911         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22912         uint64_t ret_ref = 0;
22913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22915         return ret_ref;
22916 }
22917 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
22918         LDKChannelConfig arg_conv;
22919         arg_conv.inner = untag_ptr(arg);
22920         arg_conv.is_owned = ptr_is_owned(arg);
22921         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22922         arg_conv.is_owned = false;
22923         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
22924         return ret_conv;
22925 }
22926
22927 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
22928         LDKChannelConfig orig_conv;
22929         orig_conv.inner = untag_ptr(orig);
22930         orig_conv.is_owned = ptr_is_owned(orig);
22931         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22932         orig_conv.is_owned = false;
22933         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22934         uint64_t ret_ref = 0;
22935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22937         return ret_ref;
22938 }
22939
22940 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
22941         LDKChannelConfig a_conv;
22942         a_conv.inner = untag_ptr(a);
22943         a_conv.is_owned = ptr_is_owned(a);
22944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22945         a_conv.is_owned = false;
22946         LDKChannelConfig b_conv;
22947         b_conv.inner = untag_ptr(b);
22948         b_conv.is_owned = ptr_is_owned(b);
22949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22950         b_conv.is_owned = false;
22951         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
22952         return ret_conv;
22953 }
22954
22955 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
22956         LDKChannelConfig ret_var = ChannelConfig_default();
22957         uint64_t ret_ref = 0;
22958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22960         return ret_ref;
22961 }
22962
22963 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
22964         LDKChannelConfig obj_conv;
22965         obj_conv.inner = untag_ptr(obj);
22966         obj_conv.is_owned = ptr_is_owned(obj);
22967         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22968         obj_conv.is_owned = false;
22969         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
22970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22972         CVec_u8Z_free(ret_var);
22973         return ret_arr;
22974 }
22975
22976 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
22977         LDKu8slice ser_ref;
22978         ser_ref.datalen = ser->arr_len;
22979         ser_ref.data = ser->elems;
22980         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
22981         *ret_conv = ChannelConfig_read(ser_ref);
22982         FREE(ser);
22983         return tag_ptr(ret_conv, true);
22984 }
22985
22986 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
22987         LDKUserConfig this_obj_conv;
22988         this_obj_conv.inner = untag_ptr(this_obj);
22989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22991         UserConfig_free(this_obj_conv);
22992 }
22993
22994 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
22995         LDKUserConfig this_ptr_conv;
22996         this_ptr_conv.inner = untag_ptr(this_ptr);
22997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22999         this_ptr_conv.is_owned = false;
23000         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
23001         uint64_t ret_ref = 0;
23002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23004         return ret_ref;
23005 }
23006
23007 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
23008         LDKUserConfig this_ptr_conv;
23009         this_ptr_conv.inner = untag_ptr(this_ptr);
23010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23012         this_ptr_conv.is_owned = false;
23013         LDKChannelHandshakeConfig val_conv;
23014         val_conv.inner = untag_ptr(val);
23015         val_conv.is_owned = ptr_is_owned(val);
23016         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23017         val_conv = ChannelHandshakeConfig_clone(&val_conv);
23018         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
23019 }
23020
23021 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
23022         LDKUserConfig this_ptr_conv;
23023         this_ptr_conv.inner = untag_ptr(this_ptr);
23024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23026         this_ptr_conv.is_owned = false;
23027         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
23028         uint64_t ret_ref = 0;
23029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23031         return ret_ref;
23032 }
23033
23034 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
23035         LDKUserConfig this_ptr_conv;
23036         this_ptr_conv.inner = untag_ptr(this_ptr);
23037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23039         this_ptr_conv.is_owned = false;
23040         LDKChannelHandshakeLimits val_conv;
23041         val_conv.inner = untag_ptr(val);
23042         val_conv.is_owned = ptr_is_owned(val);
23043         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23044         val_conv = ChannelHandshakeLimits_clone(&val_conv);
23045         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
23046 }
23047
23048 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
23049         LDKUserConfig this_ptr_conv;
23050         this_ptr_conv.inner = untag_ptr(this_ptr);
23051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23053         this_ptr_conv.is_owned = false;
23054         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
23055         uint64_t ret_ref = 0;
23056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23058         return ret_ref;
23059 }
23060
23061 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
23062         LDKUserConfig this_ptr_conv;
23063         this_ptr_conv.inner = untag_ptr(this_ptr);
23064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23066         this_ptr_conv.is_owned = false;
23067         LDKChannelConfig val_conv;
23068         val_conv.inner = untag_ptr(val);
23069         val_conv.is_owned = ptr_is_owned(val);
23070         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23071         val_conv = ChannelConfig_clone(&val_conv);
23072         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
23073 }
23074
23075 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
23076         LDKUserConfig this_ptr_conv;
23077         this_ptr_conv.inner = untag_ptr(this_ptr);
23078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23080         this_ptr_conv.is_owned = false;
23081         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
23082         return ret_conv;
23083 }
23084
23085 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) {
23086         LDKUserConfig this_ptr_conv;
23087         this_ptr_conv.inner = untag_ptr(this_ptr);
23088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23090         this_ptr_conv.is_owned = false;
23091         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
23092 }
23093
23094 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
23095         LDKUserConfig this_ptr_conv;
23096         this_ptr_conv.inner = untag_ptr(this_ptr);
23097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23099         this_ptr_conv.is_owned = false;
23100         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
23101         return ret_conv;
23102 }
23103
23104 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23105         LDKUserConfig this_ptr_conv;
23106         this_ptr_conv.inner = untag_ptr(this_ptr);
23107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23109         this_ptr_conv.is_owned = false;
23110         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
23111 }
23112
23113 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
23114         LDKUserConfig this_ptr_conv;
23115         this_ptr_conv.inner = untag_ptr(this_ptr);
23116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23118         this_ptr_conv.is_owned = false;
23119         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
23120         return ret_conv;
23121 }
23122
23123 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23124         LDKUserConfig this_ptr_conv;
23125         this_ptr_conv.inner = untag_ptr(this_ptr);
23126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23128         this_ptr_conv.is_owned = false;
23129         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
23130 }
23131
23132 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) {
23133         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
23134         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
23135         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
23136         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
23137         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
23138         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
23139         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
23140         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
23141         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
23142         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
23143         LDKChannelConfig channel_config_arg_conv;
23144         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
23145         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
23146         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
23147         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
23148         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);
23149         uint64_t ret_ref = 0;
23150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23152         return ret_ref;
23153 }
23154
23155 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
23156         LDKUserConfig ret_var = UserConfig_clone(arg);
23157         uint64_t ret_ref = 0;
23158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23160         return ret_ref;
23161 }
23162 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
23163         LDKUserConfig arg_conv;
23164         arg_conv.inner = untag_ptr(arg);
23165         arg_conv.is_owned = ptr_is_owned(arg);
23166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23167         arg_conv.is_owned = false;
23168         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
23169         return ret_conv;
23170 }
23171
23172 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
23173         LDKUserConfig orig_conv;
23174         orig_conv.inner = untag_ptr(orig);
23175         orig_conv.is_owned = ptr_is_owned(orig);
23176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23177         orig_conv.is_owned = false;
23178         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
23179         uint64_t ret_ref = 0;
23180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23182         return ret_ref;
23183 }
23184
23185 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
23186         LDKUserConfig ret_var = UserConfig_default();
23187         uint64_t ret_ref = 0;
23188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23190         return ret_ref;
23191 }
23192
23193 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
23194         LDKBestBlock this_obj_conv;
23195         this_obj_conv.inner = untag_ptr(this_obj);
23196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23198         BestBlock_free(this_obj_conv);
23199 }
23200
23201 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
23202         LDKBestBlock ret_var = BestBlock_clone(arg);
23203         uint64_t ret_ref = 0;
23204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23206         return ret_ref;
23207 }
23208 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
23209         LDKBestBlock arg_conv;
23210         arg_conv.inner = untag_ptr(arg);
23211         arg_conv.is_owned = ptr_is_owned(arg);
23212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23213         arg_conv.is_owned = false;
23214         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
23215         return ret_conv;
23216 }
23217
23218 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
23219         LDKBestBlock orig_conv;
23220         orig_conv.inner = untag_ptr(orig);
23221         orig_conv.is_owned = ptr_is_owned(orig);
23222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23223         orig_conv.is_owned = false;
23224         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
23225         uint64_t ret_ref = 0;
23226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23228         return ret_ref;
23229 }
23230
23231 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
23232         LDKBestBlock a_conv;
23233         a_conv.inner = untag_ptr(a);
23234         a_conv.is_owned = ptr_is_owned(a);
23235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23236         a_conv.is_owned = false;
23237         LDKBestBlock b_conv;
23238         b_conv.inner = untag_ptr(b);
23239         b_conv.is_owned = ptr_is_owned(b);
23240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23241         b_conv.is_owned = false;
23242         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
23243         return ret_conv;
23244 }
23245
23246 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
23247         LDKNetwork network_conv = LDKNetwork_from_js(network);
23248         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
23249         uint64_t ret_ref = 0;
23250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23252         return ret_ref;
23253 }
23254
23255 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
23256         LDKThirtyTwoBytes block_hash_ref;
23257         CHECK(block_hash->arr_len == 32);
23258         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
23259         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
23260         uint64_t ret_ref = 0;
23261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23263         return ret_ref;
23264 }
23265
23266 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
23267         LDKBestBlock this_arg_conv;
23268         this_arg_conv.inner = untag_ptr(this_arg);
23269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23271         this_arg_conv.is_owned = false;
23272         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23273         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
23274         return ret_arr;
23275 }
23276
23277 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
23278         LDKBestBlock this_arg_conv;
23279         this_arg_conv.inner = untag_ptr(this_arg);
23280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23282         this_arg_conv.is_owned = false;
23283         int32_t ret_conv = BestBlock_height(&this_arg_conv);
23284         return ret_conv;
23285 }
23286
23287 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
23288         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
23289         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
23290         return ret_conv;
23291 }
23292
23293 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
23294         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
23295         return ret_conv;
23296 }
23297
23298 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
23299         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
23300         return ret_conv;
23301 }
23302
23303 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
23304         if (!ptr_is_owned(this_ptr)) return;
23305         void* this_ptr_ptr = untag_ptr(this_ptr);
23306         CHECK_ACCESS(this_ptr_ptr);
23307         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23308         FREE(untag_ptr(this_ptr));
23309         Access_free(this_ptr_conv);
23310 }
23311
23312 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
23313         if (!ptr_is_owned(this_ptr)) return;
23314         void* this_ptr_ptr = untag_ptr(this_ptr);
23315         CHECK_ACCESS(this_ptr_ptr);
23316         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23317         FREE(untag_ptr(this_ptr));
23318         Listen_free(this_ptr_conv);
23319 }
23320
23321 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
23322         if (!ptr_is_owned(this_ptr)) return;
23323         void* this_ptr_ptr = untag_ptr(this_ptr);
23324         CHECK_ACCESS(this_ptr_ptr);
23325         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23326         FREE(untag_ptr(this_ptr));
23327         Confirm_free(this_ptr_conv);
23328 }
23329
23330 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
23331         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
23332         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
23333         return ret_conv;
23334 }
23335
23336 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
23337         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
23338         return ret_conv;
23339 }
23340
23341 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
23342         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
23343         return ret_conv;
23344 }
23345
23346 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
23347         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
23348         return ret_conv;
23349 }
23350
23351 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
23352         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
23353         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
23354         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
23355         return ret_conv;
23356 }
23357
23358 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
23359         if (!ptr_is_owned(this_ptr)) return;
23360         void* this_ptr_ptr = untag_ptr(this_ptr);
23361         CHECK_ACCESS(this_ptr_ptr);
23362         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23363         FREE(untag_ptr(this_ptr));
23364         Watch_free(this_ptr_conv);
23365 }
23366
23367 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
23368         if (!ptr_is_owned(this_ptr)) return;
23369         void* this_ptr_ptr = untag_ptr(this_ptr);
23370         CHECK_ACCESS(this_ptr_ptr);
23371         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23372         FREE(untag_ptr(this_ptr));
23373         Filter_free(this_ptr_conv);
23374 }
23375
23376 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
23377         LDKWatchedOutput this_obj_conv;
23378         this_obj_conv.inner = untag_ptr(this_obj);
23379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23381         WatchedOutput_free(this_obj_conv);
23382 }
23383
23384 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
23385         LDKWatchedOutput this_ptr_conv;
23386         this_ptr_conv.inner = untag_ptr(this_ptr);
23387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23389         this_ptr_conv.is_owned = false;
23390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23391         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
23392         return ret_arr;
23393 }
23394
23395 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
23396         LDKWatchedOutput this_ptr_conv;
23397         this_ptr_conv.inner = untag_ptr(this_ptr);
23398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23400         this_ptr_conv.is_owned = false;
23401         LDKThirtyTwoBytes val_ref;
23402         CHECK(val->arr_len == 32);
23403         memcpy(val_ref.data, val->elems, 32); FREE(val);
23404         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23405 }
23406
23407 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
23408         LDKWatchedOutput this_ptr_conv;
23409         this_ptr_conv.inner = untag_ptr(this_ptr);
23410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23412         this_ptr_conv.is_owned = false;
23413         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23414         uint64_t ret_ref = 0;
23415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23417         return ret_ref;
23418 }
23419
23420 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
23421         LDKWatchedOutput this_ptr_conv;
23422         this_ptr_conv.inner = untag_ptr(this_ptr);
23423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23425         this_ptr_conv.is_owned = false;
23426         LDKOutPoint val_conv;
23427         val_conv.inner = untag_ptr(val);
23428         val_conv.is_owned = ptr_is_owned(val);
23429         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23430         val_conv = OutPoint_clone(&val_conv);
23431         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23432 }
23433
23434 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
23435         LDKWatchedOutput this_ptr_conv;
23436         this_ptr_conv.inner = untag_ptr(this_ptr);
23437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23439         this_ptr_conv.is_owned = false;
23440         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23443         return ret_arr;
23444 }
23445
23446 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
23447         LDKWatchedOutput this_ptr_conv;
23448         this_ptr_conv.inner = untag_ptr(this_ptr);
23449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23451         this_ptr_conv.is_owned = false;
23452         LDKCVec_u8Z val_ref;
23453         val_ref.datalen = val->arr_len;
23454         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23455         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
23456         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23457 }
23458
23459 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) {
23460         LDKThirtyTwoBytes block_hash_arg_ref;
23461         CHECK(block_hash_arg->arr_len == 32);
23462         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
23463         LDKOutPoint outpoint_arg_conv;
23464         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23465         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23466         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23467         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23468         LDKCVec_u8Z script_pubkey_arg_ref;
23469         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
23470         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23471         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
23472         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23473         uint64_t ret_ref = 0;
23474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23476         return ret_ref;
23477 }
23478
23479 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23480         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23481         uint64_t ret_ref = 0;
23482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23484         return ret_ref;
23485 }
23486 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
23487         LDKWatchedOutput arg_conv;
23488         arg_conv.inner = untag_ptr(arg);
23489         arg_conv.is_owned = ptr_is_owned(arg);
23490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23491         arg_conv.is_owned = false;
23492         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
23493         return ret_conv;
23494 }
23495
23496 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
23497         LDKWatchedOutput orig_conv;
23498         orig_conv.inner = untag_ptr(orig);
23499         orig_conv.is_owned = ptr_is_owned(orig);
23500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23501         orig_conv.is_owned = false;
23502         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23503         uint64_t ret_ref = 0;
23504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23506         return ret_ref;
23507 }
23508
23509 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
23510         LDKWatchedOutput a_conv;
23511         a_conv.inner = untag_ptr(a);
23512         a_conv.is_owned = ptr_is_owned(a);
23513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23514         a_conv.is_owned = false;
23515         LDKWatchedOutput b_conv;
23516         b_conv.inner = untag_ptr(b);
23517         b_conv.is_owned = ptr_is_owned(b);
23518         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23519         b_conv.is_owned = false;
23520         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
23521         return ret_conv;
23522 }
23523
23524 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
23525         LDKWatchedOutput o_conv;
23526         o_conv.inner = untag_ptr(o);
23527         o_conv.is_owned = ptr_is_owned(o);
23528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23529         o_conv.is_owned = false;
23530         int64_t ret_conv = WatchedOutput_hash(&o_conv);
23531         return ret_conv;
23532 }
23533
23534 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
23535         if (!ptr_is_owned(this_ptr)) return;
23536         void* this_ptr_ptr = untag_ptr(this_ptr);
23537         CHECK_ACCESS(this_ptr_ptr);
23538         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23539         FREE(untag_ptr(this_ptr));
23540         BroadcasterInterface_free(this_ptr_conv);
23541 }
23542
23543 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
23544         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
23545         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
23546         return ret_conv;
23547 }
23548
23549 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
23550         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
23551         return ret_conv;
23552 }
23553
23554 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
23555         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
23556         return ret_conv;
23557 }
23558
23559 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
23560         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
23561         return ret_conv;
23562 }
23563
23564 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
23565         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
23566         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
23567         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
23568         return ret_conv;
23569 }
23570
23571 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
23572         if (!ptr_is_owned(this_ptr)) return;
23573         void* this_ptr_ptr = untag_ptr(this_ptr);
23574         CHECK_ACCESS(this_ptr_ptr);
23575         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23576         FREE(untag_ptr(this_ptr));
23577         FeeEstimator_free(this_ptr_conv);
23578 }
23579
23580 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
23581         LDKMonitorUpdateId this_obj_conv;
23582         this_obj_conv.inner = untag_ptr(this_obj);
23583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23585         MonitorUpdateId_free(this_obj_conv);
23586 }
23587
23588 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23589         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23590         uint64_t ret_ref = 0;
23591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23593         return ret_ref;
23594 }
23595 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
23596         LDKMonitorUpdateId arg_conv;
23597         arg_conv.inner = untag_ptr(arg);
23598         arg_conv.is_owned = ptr_is_owned(arg);
23599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23600         arg_conv.is_owned = false;
23601         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
23602         return ret_conv;
23603 }
23604
23605 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
23606         LDKMonitorUpdateId orig_conv;
23607         orig_conv.inner = untag_ptr(orig);
23608         orig_conv.is_owned = ptr_is_owned(orig);
23609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23610         orig_conv.is_owned = false;
23611         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23612         uint64_t ret_ref = 0;
23613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23615         return ret_ref;
23616 }
23617
23618 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
23619         LDKMonitorUpdateId o_conv;
23620         o_conv.inner = untag_ptr(o);
23621         o_conv.is_owned = ptr_is_owned(o);
23622         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23623         o_conv.is_owned = false;
23624         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
23625         return ret_conv;
23626 }
23627
23628 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
23629         LDKMonitorUpdateId a_conv;
23630         a_conv.inner = untag_ptr(a);
23631         a_conv.is_owned = ptr_is_owned(a);
23632         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23633         a_conv.is_owned = false;
23634         LDKMonitorUpdateId b_conv;
23635         b_conv.inner = untag_ptr(b);
23636         b_conv.is_owned = ptr_is_owned(b);
23637         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23638         b_conv.is_owned = false;
23639         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
23640         return ret_conv;
23641 }
23642
23643 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
23644         if (!ptr_is_owned(this_ptr)) return;
23645         void* this_ptr_ptr = untag_ptr(this_ptr);
23646         CHECK_ACCESS(this_ptr_ptr);
23647         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23648         FREE(untag_ptr(this_ptr));
23649         Persist_free(this_ptr_conv);
23650 }
23651
23652 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
23653         LDKLockedChannelMonitor this_obj_conv;
23654         this_obj_conv.inner = untag_ptr(this_obj);
23655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23657         LockedChannelMonitor_free(this_obj_conv);
23658 }
23659
23660 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
23661         LDKChainMonitor this_obj_conv;
23662         this_obj_conv.inner = untag_ptr(this_obj);
23663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23665         ChainMonitor_free(this_obj_conv);
23666 }
23667
23668 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) {
23669         void* chain_source_ptr = untag_ptr(chain_source);
23670         CHECK_ACCESS(chain_source_ptr);
23671         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23672         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
23673         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23674                 // Manually implement clone for Java trait instances
23675                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23676                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23677                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
23678                 }
23679         }
23680         void* broadcaster_ptr = untag_ptr(broadcaster);
23681         CHECK_ACCESS(broadcaster_ptr);
23682         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23683         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23684                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23685                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23686         }
23687         void* logger_ptr = untag_ptr(logger);
23688         CHECK_ACCESS(logger_ptr);
23689         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23690         if (logger_conv.free == LDKLogger_JCalls_free) {
23691                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23692                 LDKLogger_JCalls_cloned(&logger_conv);
23693         }
23694         void* feeest_ptr = untag_ptr(feeest);
23695         CHECK_ACCESS(feeest_ptr);
23696         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23697         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23698                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23699                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23700         }
23701         void* persister_ptr = untag_ptr(persister);
23702         CHECK_ACCESS(persister_ptr);
23703         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23704         if (persister_conv.free == LDKPersist_JCalls_free) {
23705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23706                 LDKPersist_JCalls_cloned(&persister_conv);
23707         }
23708         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23709         uint64_t ret_ref = 0;
23710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23712         return ret_ref;
23713 }
23714
23715 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
23716         LDKChainMonitor this_arg_conv;
23717         this_arg_conv.inner = untag_ptr(this_arg);
23718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23720         this_arg_conv.is_owned = false;
23721         LDKCVec_ChannelDetailsZ ignored_channels_constr;
23722         ignored_channels_constr.datalen = ignored_channels->arr_len;
23723         if (ignored_channels_constr.datalen > 0)
23724                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23725         else
23726                 ignored_channels_constr.data = NULL;
23727         uint64_t* ignored_channels_vals = ignored_channels->elems;
23728         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23729                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
23730                 LDKChannelDetails ignored_channels_conv_16_conv;
23731                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
23732                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
23733                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23734                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23735                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23736         }
23737         FREE(ignored_channels);
23738         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23739         uint64_tArray ret_arr = NULL;
23740         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23741         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23742         for (size_t j = 0; j < ret_var.datalen; j++) {
23743                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23744                 *ret_conv_9_copy = ret_var.data[j];
23745                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23746                 ret_arr_ptr[j] = ret_conv_9_ref;
23747         }
23748         
23749         FREE(ret_var.data);
23750         return ret_arr;
23751 }
23752
23753 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
23754         LDKChainMonitor this_arg_conv;
23755         this_arg_conv.inner = untag_ptr(this_arg);
23756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23758         this_arg_conv.is_owned = false;
23759         LDKOutPoint funding_txo_conv;
23760         funding_txo_conv.inner = untag_ptr(funding_txo);
23761         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23762         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23763         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23764         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23765         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23766         return tag_ptr(ret_conv, true);
23767 }
23768
23769 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
23770         LDKChainMonitor this_arg_conv;
23771         this_arg_conv.inner = untag_ptr(this_arg);
23772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23774         this_arg_conv.is_owned = false;
23775         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23776         uint64_tArray ret_arr = NULL;
23777         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23778         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23779         for (size_t k = 0; k < ret_var.datalen; k++) {
23780                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23781                 uint64_t ret_conv_10_ref = 0;
23782                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23783                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
23784                 ret_arr_ptr[k] = ret_conv_10_ref;
23785         }
23786         
23787         FREE(ret_var.data);
23788         return ret_arr;
23789 }
23790
23791 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) {
23792         LDKChainMonitor this_arg_conv;
23793         this_arg_conv.inner = untag_ptr(this_arg);
23794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23796         this_arg_conv.is_owned = false;
23797         LDKOutPoint funding_txo_conv;
23798         funding_txo_conv.inner = untag_ptr(funding_txo);
23799         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23800         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23801         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23802         LDKMonitorUpdateId completed_update_id_conv;
23803         completed_update_id_conv.inner = untag_ptr(completed_update_id);
23804         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
23805         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23806         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23807         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23808         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23809         return tag_ptr(ret_conv, true);
23810 }
23811
23812 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
23813         LDKChainMonitor this_arg_conv;
23814         this_arg_conv.inner = untag_ptr(this_arg);
23815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23817         this_arg_conv.is_owned = false;
23818         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23819         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23820         return tag_ptr(ret_ret, true);
23821 }
23822
23823 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
23824         LDKChainMonitor this_arg_conv;
23825         this_arg_conv.inner = untag_ptr(this_arg);
23826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23828         this_arg_conv.is_owned = false;
23829         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23830         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23831         return tag_ptr(ret_ret, true);
23832 }
23833
23834 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
23835         LDKChainMonitor this_arg_conv;
23836         this_arg_conv.inner = untag_ptr(this_arg);
23837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23839         this_arg_conv.is_owned = false;
23840         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23841         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23842         return tag_ptr(ret_ret, true);
23843 }
23844
23845 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
23846         LDKChainMonitor this_arg_conv;
23847         this_arg_conv.inner = untag_ptr(this_arg);
23848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23850         this_arg_conv.is_owned = false;
23851         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23852         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23853         return tag_ptr(ret_ret, true);
23854 }
23855
23856 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
23857         LDKChannelMonitorUpdate this_obj_conv;
23858         this_obj_conv.inner = untag_ptr(this_obj);
23859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23861         ChannelMonitorUpdate_free(this_obj_conv);
23862 }
23863
23864 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
23865         LDKChannelMonitorUpdate this_ptr_conv;
23866         this_ptr_conv.inner = untag_ptr(this_ptr);
23867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23869         this_ptr_conv.is_owned = false;
23870         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23871         return ret_conv;
23872 }
23873
23874 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
23875         LDKChannelMonitorUpdate this_ptr_conv;
23876         this_ptr_conv.inner = untag_ptr(this_ptr);
23877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23879         this_ptr_conv.is_owned = false;
23880         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23881 }
23882
23883 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23884         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23885         uint64_t ret_ref = 0;
23886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23888         return ret_ref;
23889 }
23890 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
23891         LDKChannelMonitorUpdate arg_conv;
23892         arg_conv.inner = untag_ptr(arg);
23893         arg_conv.is_owned = ptr_is_owned(arg);
23894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23895         arg_conv.is_owned = false;
23896         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23897         return ret_conv;
23898 }
23899
23900 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
23901         LDKChannelMonitorUpdate orig_conv;
23902         orig_conv.inner = untag_ptr(orig);
23903         orig_conv.is_owned = ptr_is_owned(orig);
23904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23905         orig_conv.is_owned = false;
23906         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23907         uint64_t ret_ref = 0;
23908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23910         return ret_ref;
23911 }
23912
23913 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
23914         LDKChannelMonitorUpdate obj_conv;
23915         obj_conv.inner = untag_ptr(obj);
23916         obj_conv.is_owned = ptr_is_owned(obj);
23917         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23918         obj_conv.is_owned = false;
23919         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23920         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23921         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23922         CVec_u8Z_free(ret_var);
23923         return ret_arr;
23924 }
23925
23926 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
23927         LDKu8slice ser_ref;
23928         ser_ref.datalen = ser->arr_len;
23929         ser_ref.data = ser->elems;
23930         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23931         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23932         FREE(ser);
23933         return tag_ptr(ret_conv, true);
23934 }
23935
23936 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
23937         if (!ptr_is_owned(this_ptr)) return;
23938         void* this_ptr_ptr = untag_ptr(this_ptr);
23939         CHECK_ACCESS(this_ptr_ptr);
23940         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23941         FREE(untag_ptr(this_ptr));
23942         MonitorEvent_free(this_ptr_conv);
23943 }
23944
23945 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23946         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23947         *ret_copy = MonitorEvent_clone(arg);
23948         uint64_t ret_ref = tag_ptr(ret_copy, true);
23949         return ret_ref;
23950 }
23951 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
23952         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
23953         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
23954         return ret_conv;
23955 }
23956
23957 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
23958         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
23959         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23960         *ret_copy = MonitorEvent_clone(orig_conv);
23961         uint64_t ret_ref = tag_ptr(ret_copy, true);
23962         return ret_ref;
23963 }
23964
23965 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
23966         LDKHTLCUpdate a_conv;
23967         a_conv.inner = untag_ptr(a);
23968         a_conv.is_owned = ptr_is_owned(a);
23969         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23970         a_conv = HTLCUpdate_clone(&a_conv);
23971         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23972         *ret_copy = MonitorEvent_htlcevent(a_conv);
23973         uint64_t ret_ref = tag_ptr(ret_copy, true);
23974         return ret_ref;
23975 }
23976
23977 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
23978         LDKOutPoint a_conv;
23979         a_conv.inner = untag_ptr(a);
23980         a_conv.is_owned = ptr_is_owned(a);
23981         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23982         a_conv = OutPoint_clone(&a_conv);
23983         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23984         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
23985         uint64_t ret_ref = tag_ptr(ret_copy, true);
23986         return ret_ref;
23987 }
23988
23989 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
23990         LDKOutPoint funding_txo_conv;
23991         funding_txo_conv.inner = untag_ptr(funding_txo);
23992         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23993         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23994         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23995         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23996         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
23997         uint64_t ret_ref = tag_ptr(ret_copy, true);
23998         return ret_ref;
23999 }
24000
24001 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
24002         LDKOutPoint a_conv;
24003         a_conv.inner = untag_ptr(a);
24004         a_conv.is_owned = ptr_is_owned(a);
24005         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24006         a_conv = OutPoint_clone(&a_conv);
24007         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24008         *ret_copy = MonitorEvent_update_failed(a_conv);
24009         uint64_t ret_ref = tag_ptr(ret_copy, true);
24010         return ret_ref;
24011 }
24012
24013 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
24014         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
24015         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
24016         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
24017         return ret_conv;
24018 }
24019
24020 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
24021         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
24022         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
24023         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24024         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24025         CVec_u8Z_free(ret_var);
24026         return ret_arr;
24027 }
24028
24029 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
24030         LDKu8slice ser_ref;
24031         ser_ref.datalen = ser->arr_len;
24032         ser_ref.data = ser->elems;
24033         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
24034         *ret_conv = MonitorEvent_read(ser_ref);
24035         FREE(ser);
24036         return tag_ptr(ret_conv, true);
24037 }
24038
24039 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
24040         LDKHTLCUpdate this_obj_conv;
24041         this_obj_conv.inner = untag_ptr(this_obj);
24042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24044         HTLCUpdate_free(this_obj_conv);
24045 }
24046
24047 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
24048         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
24049         uint64_t ret_ref = 0;
24050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24052         return ret_ref;
24053 }
24054 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
24055         LDKHTLCUpdate arg_conv;
24056         arg_conv.inner = untag_ptr(arg);
24057         arg_conv.is_owned = ptr_is_owned(arg);
24058         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24059         arg_conv.is_owned = false;
24060         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
24061         return ret_conv;
24062 }
24063
24064 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
24065         LDKHTLCUpdate orig_conv;
24066         orig_conv.inner = untag_ptr(orig);
24067         orig_conv.is_owned = ptr_is_owned(orig);
24068         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24069         orig_conv.is_owned = false;
24070         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
24071         uint64_t ret_ref = 0;
24072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24074         return ret_ref;
24075 }
24076
24077 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
24078         LDKHTLCUpdate a_conv;
24079         a_conv.inner = untag_ptr(a);
24080         a_conv.is_owned = ptr_is_owned(a);
24081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24082         a_conv.is_owned = false;
24083         LDKHTLCUpdate b_conv;
24084         b_conv.inner = untag_ptr(b);
24085         b_conv.is_owned = ptr_is_owned(b);
24086         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24087         b_conv.is_owned = false;
24088         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
24089         return ret_conv;
24090 }
24091
24092 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
24093         LDKHTLCUpdate obj_conv;
24094         obj_conv.inner = untag_ptr(obj);
24095         obj_conv.is_owned = ptr_is_owned(obj);
24096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24097         obj_conv.is_owned = false;
24098         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
24099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24101         CVec_u8Z_free(ret_var);
24102         return ret_arr;
24103 }
24104
24105 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
24106         LDKu8slice ser_ref;
24107         ser_ref.datalen = ser->arr_len;
24108         ser_ref.data = ser->elems;
24109         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
24110         *ret_conv = HTLCUpdate_read(ser_ref);
24111         FREE(ser);
24112         return tag_ptr(ret_conv, true);
24113 }
24114
24115 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
24116         if (!ptr_is_owned(this_ptr)) return;
24117         void* this_ptr_ptr = untag_ptr(this_ptr);
24118         CHECK_ACCESS(this_ptr_ptr);
24119         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
24120         FREE(untag_ptr(this_ptr));
24121         Balance_free(this_ptr_conv);
24122 }
24123
24124 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
24125         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24126         *ret_copy = Balance_clone(arg);
24127         uint64_t ret_ref = tag_ptr(ret_copy, true);
24128         return ret_ref;
24129 }
24130 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
24131         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
24132         int64_t ret_conv = Balance_clone_ptr(arg_conv);
24133         return ret_conv;
24134 }
24135
24136 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
24137         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
24138         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24139         *ret_copy = Balance_clone(orig_conv);
24140         uint64_t ret_ref = tag_ptr(ret_copy, true);
24141         return ret_ref;
24142 }
24143
24144 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
24145         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24146         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
24147         uint64_t ret_ref = tag_ptr(ret_copy, true);
24148         return ret_ref;
24149 }
24150
24151 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
24152         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24153         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
24154         uint64_t ret_ref = tag_ptr(ret_copy, true);
24155         return ret_ref;
24156 }
24157
24158 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
24159         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24160         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
24161         uint64_t ret_ref = tag_ptr(ret_copy, true);
24162         return ret_ref;
24163 }
24164
24165 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) {
24166         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24167         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
24168         uint64_t ret_ref = tag_ptr(ret_copy, true);
24169         return ret_ref;
24170 }
24171
24172 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) {
24173         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24174         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
24175         uint64_t ret_ref = tag_ptr(ret_copy, true);
24176         return ret_ref;
24177 }
24178
24179 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
24180         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24181         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
24182         uint64_t ret_ref = tag_ptr(ret_copy, true);
24183         return ret_ref;
24184 }
24185
24186 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
24187         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
24188         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
24189         jboolean ret_conv = Balance_eq(a_conv, b_conv);
24190         return ret_conv;
24191 }
24192
24193 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
24194         LDKChannelMonitor this_obj_conv;
24195         this_obj_conv.inner = untag_ptr(this_obj);
24196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24198         ChannelMonitor_free(this_obj_conv);
24199 }
24200
24201 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
24202         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
24203         uint64_t ret_ref = 0;
24204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24206         return ret_ref;
24207 }
24208 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
24209         LDKChannelMonitor arg_conv;
24210         arg_conv.inner = untag_ptr(arg);
24211         arg_conv.is_owned = ptr_is_owned(arg);
24212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24213         arg_conv.is_owned = false;
24214         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
24215         return ret_conv;
24216 }
24217
24218 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
24219         LDKChannelMonitor orig_conv;
24220         orig_conv.inner = untag_ptr(orig);
24221         orig_conv.is_owned = ptr_is_owned(orig);
24222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24223         orig_conv.is_owned = false;
24224         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
24225         uint64_t ret_ref = 0;
24226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24228         return ret_ref;
24229 }
24230
24231 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
24232         LDKChannelMonitor obj_conv;
24233         obj_conv.inner = untag_ptr(obj);
24234         obj_conv.is_owned = ptr_is_owned(obj);
24235         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24236         obj_conv.is_owned = false;
24237         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
24238         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24239         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24240         CVec_u8Z_free(ret_var);
24241         return ret_arr;
24242 }
24243
24244 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) {
24245         LDKChannelMonitor this_arg_conv;
24246         this_arg_conv.inner = untag_ptr(this_arg);
24247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24249         this_arg_conv.is_owned = false;
24250         LDKChannelMonitorUpdate updates_conv;
24251         updates_conv.inner = untag_ptr(updates);
24252         updates_conv.is_owned = ptr_is_owned(updates);
24253         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24254         updates_conv.is_owned = false;
24255         void* broadcaster_ptr = untag_ptr(broadcaster);
24256         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
24257         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
24258         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24259         CHECK_ACCESS(fee_estimator_ptr);
24260         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24261         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24263                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24264         }
24265         void* logger_ptr = untag_ptr(logger);
24266         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24267         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24268         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
24269         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
24270         return tag_ptr(ret_conv, true);
24271 }
24272
24273 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
24274         LDKChannelMonitor this_arg_conv;
24275         this_arg_conv.inner = untag_ptr(this_arg);
24276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24278         this_arg_conv.is_owned = false;
24279         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
24280         return ret_conv;
24281 }
24282
24283 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
24284         LDKChannelMonitor this_arg_conv;
24285         this_arg_conv.inner = untag_ptr(this_arg);
24286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24288         this_arg_conv.is_owned = false;
24289         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
24290         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
24291         return tag_ptr(ret_conv, true);
24292 }
24293
24294 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
24295         LDKChannelMonitor this_arg_conv;
24296         this_arg_conv.inner = untag_ptr(this_arg);
24297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24299         this_arg_conv.is_owned = false;
24300         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
24301         uint64_tArray ret_arr = NULL;
24302         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24303         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24304         for (size_t o = 0; o < ret_var.datalen; o++) {
24305                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
24306                 *ret_conv_40_conv = ret_var.data[o];
24307                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
24308         }
24309         
24310         FREE(ret_var.data);
24311         return ret_arr;
24312 }
24313
24314 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
24315         LDKChannelMonitor this_arg_conv;
24316         this_arg_conv.inner = untag_ptr(this_arg);
24317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24319         this_arg_conv.is_owned = false;
24320         void* filter_ptr = untag_ptr(filter);
24321         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
24322         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24323         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24324 }
24325
24326 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) {
24327         LDKChannelMonitor this_arg_conv;
24328         this_arg_conv.inner = untag_ptr(this_arg);
24329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24331         this_arg_conv.is_owned = false;
24332         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24333         uint64_tArray ret_arr = NULL;
24334         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24335         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24336         for (size_t o = 0; o < ret_var.datalen; o++) {
24337                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24338                 *ret_conv_14_copy = ret_var.data[o];
24339                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
24340                 ret_arr_ptr[o] = ret_conv_14_ref;
24341         }
24342         
24343         FREE(ret_var.data);
24344         return ret_arr;
24345 }
24346
24347 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
24348         LDKChannelMonitor this_arg_conv;
24349         this_arg_conv.inner = untag_ptr(this_arg);
24350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24352         this_arg_conv.is_owned = false;
24353         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24354         uint64_tArray ret_arr = NULL;
24355         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24356         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24357         for (size_t h = 0; h < ret_var.datalen; h++) {
24358                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24359                 *ret_conv_7_copy = ret_var.data[h];
24360                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
24361                 ret_arr_ptr[h] = ret_conv_7_ref;
24362         }
24363         
24364         FREE(ret_var.data);
24365         return ret_arr;
24366 }
24367
24368 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
24369         LDKChannelMonitor this_arg_conv;
24370         this_arg_conv.inner = untag_ptr(this_arg);
24371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24373         this_arg_conv.is_owned = false;
24374         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24375         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
24376         return ret_arr;
24377 }
24378
24379 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) {
24380         LDKChannelMonitor this_arg_conv;
24381         this_arg_conv.inner = untag_ptr(this_arg);
24382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24384         this_arg_conv.is_owned = false;
24385         void* logger_ptr = untag_ptr(logger);
24386         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24387         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24388         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24389         ptrArray ret_arr = NULL;
24390         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24391         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24392         for (size_t m = 0; m < ret_var.datalen; m++) {
24393                 LDKTransaction ret_conv_12_var = ret_var.data[m];
24394                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
24395                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
24396                 Transaction_free(ret_conv_12_var);
24397                 ret_arr_ptr[m] = ret_conv_12_arr;
24398         }
24399         
24400         FREE(ret_var.data);
24401         return ret_arr;
24402 }
24403
24404 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) {
24405         LDKChannelMonitor this_arg_conv;
24406         this_arg_conv.inner = untag_ptr(this_arg);
24407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24409         this_arg_conv.is_owned = false;
24410         unsigned char header_arr[80];
24411         CHECK(header->arr_len == 80);
24412         memcpy(header_arr, header->elems, 80); FREE(header);
24413         unsigned char (*header_ref)[80] = &header_arr;
24414         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24415         txdata_constr.datalen = txdata->arr_len;
24416         if (txdata_constr.datalen > 0)
24417                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24418         else
24419                 txdata_constr.data = NULL;
24420         uint64_t* txdata_vals = txdata->elems;
24421         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24422                 uint64_t txdata_conv_28 = txdata_vals[c];
24423                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24424                 CHECK_ACCESS(txdata_conv_28_ptr);
24425                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24426                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24427                 txdata_constr.data[c] = txdata_conv_28_conv;
24428         }
24429         FREE(txdata);
24430         void* broadcaster_ptr = untag_ptr(broadcaster);
24431         CHECK_ACCESS(broadcaster_ptr);
24432         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24433         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24435                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24436         }
24437         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24438         CHECK_ACCESS(fee_estimator_ptr);
24439         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24440         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24442                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24443         }
24444         void* logger_ptr = untag_ptr(logger);
24445         CHECK_ACCESS(logger_ptr);
24446         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24447         if (logger_conv.free == LDKLogger_JCalls_free) {
24448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24449                 LDKLogger_JCalls_cloned(&logger_conv);
24450         }
24451         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);
24452         uint64_tArray ret_arr = NULL;
24453         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24454         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24455         for (size_t n = 0; n < ret_var.datalen; n++) {
24456                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24457                 *ret_conv_39_conv = ret_var.data[n];
24458                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24459         }
24460         
24461         FREE(ret_var.data);
24462         return ret_arr;
24463 }
24464
24465 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) {
24466         LDKChannelMonitor this_arg_conv;
24467         this_arg_conv.inner = untag_ptr(this_arg);
24468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24470         this_arg_conv.is_owned = false;
24471         unsigned char header_arr[80];
24472         CHECK(header->arr_len == 80);
24473         memcpy(header_arr, header->elems, 80); FREE(header);
24474         unsigned char (*header_ref)[80] = &header_arr;
24475         void* broadcaster_ptr = untag_ptr(broadcaster);
24476         CHECK_ACCESS(broadcaster_ptr);
24477         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24478         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24480                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24481         }
24482         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24483         CHECK_ACCESS(fee_estimator_ptr);
24484         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24485         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24487                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24488         }
24489         void* logger_ptr = untag_ptr(logger);
24490         CHECK_ACCESS(logger_ptr);
24491         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24492         if (logger_conv.free == LDKLogger_JCalls_free) {
24493                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24494                 LDKLogger_JCalls_cloned(&logger_conv);
24495         }
24496         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24497 }
24498
24499 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) {
24500         LDKChannelMonitor this_arg_conv;
24501         this_arg_conv.inner = untag_ptr(this_arg);
24502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24504         this_arg_conv.is_owned = false;
24505         unsigned char header_arr[80];
24506         CHECK(header->arr_len == 80);
24507         memcpy(header_arr, header->elems, 80); FREE(header);
24508         unsigned char (*header_ref)[80] = &header_arr;
24509         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24510         txdata_constr.datalen = txdata->arr_len;
24511         if (txdata_constr.datalen > 0)
24512                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24513         else
24514                 txdata_constr.data = NULL;
24515         uint64_t* txdata_vals = txdata->elems;
24516         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24517                 uint64_t txdata_conv_28 = txdata_vals[c];
24518                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24519                 CHECK_ACCESS(txdata_conv_28_ptr);
24520                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24521                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24522                 txdata_constr.data[c] = txdata_conv_28_conv;
24523         }
24524         FREE(txdata);
24525         void* broadcaster_ptr = untag_ptr(broadcaster);
24526         CHECK_ACCESS(broadcaster_ptr);
24527         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24528         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24529                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24530                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24531         }
24532         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24533         CHECK_ACCESS(fee_estimator_ptr);
24534         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24535         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24536                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24537                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24538         }
24539         void* logger_ptr = untag_ptr(logger);
24540         CHECK_ACCESS(logger_ptr);
24541         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24542         if (logger_conv.free == LDKLogger_JCalls_free) {
24543                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24544                 LDKLogger_JCalls_cloned(&logger_conv);
24545         }
24546         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);
24547         uint64_tArray ret_arr = NULL;
24548         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24549         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24550         for (size_t n = 0; n < ret_var.datalen; n++) {
24551                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24552                 *ret_conv_39_conv = ret_var.data[n];
24553                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24554         }
24555         
24556         FREE(ret_var.data);
24557         return ret_arr;
24558 }
24559
24560 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) {
24561         LDKChannelMonitor this_arg_conv;
24562         this_arg_conv.inner = untag_ptr(this_arg);
24563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24565         this_arg_conv.is_owned = false;
24566         unsigned char txid_arr[32];
24567         CHECK(txid->arr_len == 32);
24568         memcpy(txid_arr, txid->elems, 32); FREE(txid);
24569         unsigned char (*txid_ref)[32] = &txid_arr;
24570         void* broadcaster_ptr = untag_ptr(broadcaster);
24571         CHECK_ACCESS(broadcaster_ptr);
24572         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24573         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24575                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24576         }
24577         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24578         CHECK_ACCESS(fee_estimator_ptr);
24579         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24580         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24581                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24582                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24583         }
24584         void* logger_ptr = untag_ptr(logger);
24585         CHECK_ACCESS(logger_ptr);
24586         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24587         if (logger_conv.free == LDKLogger_JCalls_free) {
24588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24589                 LDKLogger_JCalls_cloned(&logger_conv);
24590         }
24591         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24592 }
24593
24594 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) {
24595         LDKChannelMonitor this_arg_conv;
24596         this_arg_conv.inner = untag_ptr(this_arg);
24597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24599         this_arg_conv.is_owned = false;
24600         unsigned char header_arr[80];
24601         CHECK(header->arr_len == 80);
24602         memcpy(header_arr, header->elems, 80); FREE(header);
24603         unsigned char (*header_ref)[80] = &header_arr;
24604         void* broadcaster_ptr = untag_ptr(broadcaster);
24605         CHECK_ACCESS(broadcaster_ptr);
24606         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24607         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24609                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24610         }
24611         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24612         CHECK_ACCESS(fee_estimator_ptr);
24613         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24614         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24615                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24616                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24617         }
24618         void* logger_ptr = untag_ptr(logger);
24619         CHECK_ACCESS(logger_ptr);
24620         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24621         if (logger_conv.free == LDKLogger_JCalls_free) {
24622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24623                 LDKLogger_JCalls_cloned(&logger_conv);
24624         }
24625         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24626         uint64_tArray ret_arr = NULL;
24627         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24628         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24629         for (size_t n = 0; n < ret_var.datalen; n++) {
24630                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24631                 *ret_conv_39_conv = ret_var.data[n];
24632                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24633         }
24634         
24635         FREE(ret_var.data);
24636         return ret_arr;
24637 }
24638
24639 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
24640         LDKChannelMonitor this_arg_conv;
24641         this_arg_conv.inner = untag_ptr(this_arg);
24642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24644         this_arg_conv.is_owned = false;
24645         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24646         ptrArray ret_arr = NULL;
24647         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24648         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24649         for (size_t m = 0; m < ret_var.datalen; m++) {
24650                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
24651                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
24652                 ret_arr_ptr[m] = ret_conv_12_arr;
24653         }
24654         
24655         FREE(ret_var.data);
24656         return ret_arr;
24657 }
24658
24659 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
24660         LDKChannelMonitor this_arg_conv;
24661         this_arg_conv.inner = untag_ptr(this_arg);
24662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24664         this_arg_conv.is_owned = false;
24665         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24666         uint64_t ret_ref = 0;
24667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24669         return ret_ref;
24670 }
24671
24672 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
24673         LDKChannelMonitor this_arg_conv;
24674         this_arg_conv.inner = untag_ptr(this_arg);
24675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24677         this_arg_conv.is_owned = false;
24678         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24679         uint64_tArray ret_arr = NULL;
24680         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24681         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24682         for (size_t j = 0; j < ret_var.datalen; j++) {
24683                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24684                 *ret_conv_9_copy = ret_var.data[j];
24685                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24686                 ret_arr_ptr[j] = ret_conv_9_ref;
24687         }
24688         
24689         FREE(ret_var.data);
24690         return ret_arr;
24691 }
24692
24693 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
24694         LDKu8slice ser_ref;
24695         ser_ref.datalen = ser->arr_len;
24696         ser_ref.data = ser->elems;
24697         void* arg_ptr = untag_ptr(arg);
24698         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
24699         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24700         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24701         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24702         FREE(ser);
24703         return tag_ptr(ret_conv, true);
24704 }
24705
24706 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
24707         LDKOutPoint this_obj_conv;
24708         this_obj_conv.inner = untag_ptr(this_obj);
24709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24711         OutPoint_free(this_obj_conv);
24712 }
24713
24714 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
24715         LDKOutPoint this_ptr_conv;
24716         this_ptr_conv.inner = untag_ptr(this_ptr);
24717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24719         this_ptr_conv.is_owned = false;
24720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24721         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
24722         return ret_arr;
24723 }
24724
24725 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
24726         LDKOutPoint this_ptr_conv;
24727         this_ptr_conv.inner = untag_ptr(this_ptr);
24728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24730         this_ptr_conv.is_owned = false;
24731         LDKThirtyTwoBytes val_ref;
24732         CHECK(val->arr_len == 32);
24733         memcpy(val_ref.data, val->elems, 32); FREE(val);
24734         OutPoint_set_txid(&this_ptr_conv, val_ref);
24735 }
24736
24737 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
24738         LDKOutPoint this_ptr_conv;
24739         this_ptr_conv.inner = untag_ptr(this_ptr);
24740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24742         this_ptr_conv.is_owned = false;
24743         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
24744         return ret_conv;
24745 }
24746
24747 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
24748         LDKOutPoint this_ptr_conv;
24749         this_ptr_conv.inner = untag_ptr(this_ptr);
24750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24752         this_ptr_conv.is_owned = false;
24753         OutPoint_set_index(&this_ptr_conv, val);
24754 }
24755
24756 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
24757         LDKThirtyTwoBytes txid_arg_ref;
24758         CHECK(txid_arg->arr_len == 32);
24759         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
24760         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24761         uint64_t ret_ref = 0;
24762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24764         return ret_ref;
24765 }
24766
24767 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24768         LDKOutPoint ret_var = OutPoint_clone(arg);
24769         uint64_t ret_ref = 0;
24770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24772         return ret_ref;
24773 }
24774 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
24775         LDKOutPoint arg_conv;
24776         arg_conv.inner = untag_ptr(arg);
24777         arg_conv.is_owned = ptr_is_owned(arg);
24778         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24779         arg_conv.is_owned = false;
24780         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
24781         return ret_conv;
24782 }
24783
24784 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
24785         LDKOutPoint orig_conv;
24786         orig_conv.inner = untag_ptr(orig);
24787         orig_conv.is_owned = ptr_is_owned(orig);
24788         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24789         orig_conv.is_owned = false;
24790         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24791         uint64_t ret_ref = 0;
24792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24794         return ret_ref;
24795 }
24796
24797 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
24798         LDKOutPoint a_conv;
24799         a_conv.inner = untag_ptr(a);
24800         a_conv.is_owned = ptr_is_owned(a);
24801         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24802         a_conv.is_owned = false;
24803         LDKOutPoint b_conv;
24804         b_conv.inner = untag_ptr(b);
24805         b_conv.is_owned = ptr_is_owned(b);
24806         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24807         b_conv.is_owned = false;
24808         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
24809         return ret_conv;
24810 }
24811
24812 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
24813         LDKOutPoint o_conv;
24814         o_conv.inner = untag_ptr(o);
24815         o_conv.is_owned = ptr_is_owned(o);
24816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24817         o_conv.is_owned = false;
24818         int64_t ret_conv = OutPoint_hash(&o_conv);
24819         return ret_conv;
24820 }
24821
24822 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
24823         LDKOutPoint this_arg_conv;
24824         this_arg_conv.inner = untag_ptr(this_arg);
24825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24827         this_arg_conv.is_owned = false;
24828         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24829         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
24830         return ret_arr;
24831 }
24832
24833 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
24834         LDKOutPoint obj_conv;
24835         obj_conv.inner = untag_ptr(obj);
24836         obj_conv.is_owned = ptr_is_owned(obj);
24837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24838         obj_conv.is_owned = false;
24839         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24842         CVec_u8Z_free(ret_var);
24843         return ret_arr;
24844 }
24845
24846 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
24847         LDKu8slice ser_ref;
24848         ser_ref.datalen = ser->arr_len;
24849         ser_ref.data = ser->elems;
24850         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24851         *ret_conv = OutPoint_read(ser_ref);
24852         FREE(ser);
24853         return tag_ptr(ret_conv, true);
24854 }
24855
24856 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
24857         LDKDelayedPaymentOutputDescriptor this_obj_conv;
24858         this_obj_conv.inner = untag_ptr(this_obj);
24859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24861         DelayedPaymentOutputDescriptor_free(this_obj_conv);
24862 }
24863
24864 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24865         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24866         this_ptr_conv.inner = untag_ptr(this_ptr);
24867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24869         this_ptr_conv.is_owned = false;
24870         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24871         uint64_t ret_ref = 0;
24872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24874         return ret_ref;
24875 }
24876
24877 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24878         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24879         this_ptr_conv.inner = untag_ptr(this_ptr);
24880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24882         this_ptr_conv.is_owned = false;
24883         LDKOutPoint val_conv;
24884         val_conv.inner = untag_ptr(val);
24885         val_conv.is_owned = ptr_is_owned(val);
24886         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24887         val_conv = OutPoint_clone(&val_conv);
24888         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24889 }
24890
24891 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
24892         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24893         this_ptr_conv.inner = untag_ptr(this_ptr);
24894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24896         this_ptr_conv.is_owned = false;
24897         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24898         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24899         return ret_arr;
24900 }
24901
24902 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
24903         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24904         this_ptr_conv.inner = untag_ptr(this_ptr);
24905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24907         this_ptr_conv.is_owned = false;
24908         LDKPublicKey val_ref;
24909         CHECK(val->arr_len == 33);
24910         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24911         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24912 }
24913
24914 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
24915         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24916         this_ptr_conv.inner = untag_ptr(this_ptr);
24917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24919         this_ptr_conv.is_owned = false;
24920         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24921         return ret_conv;
24922 }
24923
24924 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
24925         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24926         this_ptr_conv.inner = untag_ptr(this_ptr);
24927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24929         this_ptr_conv.is_owned = false;
24930         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24931 }
24932
24933 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24934         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24935         this_ptr_conv.inner = untag_ptr(this_ptr);
24936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24938         this_ptr_conv.is_owned = false;
24939         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24940         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
24941         return tag_ptr(ret_ref, true);
24942 }
24943
24944 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24945         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24946         this_ptr_conv.inner = untag_ptr(this_ptr);
24947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24949         this_ptr_conv.is_owned = false;
24950         void* val_ptr = untag_ptr(val);
24951         CHECK_ACCESS(val_ptr);
24952         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24953         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24954         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24955 }
24956
24957 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
24958         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24959         this_ptr_conv.inner = untag_ptr(this_ptr);
24960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24962         this_ptr_conv.is_owned = false;
24963         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24964         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
24965         return ret_arr;
24966 }
24967
24968 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
24969         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24970         this_ptr_conv.inner = untag_ptr(this_ptr);
24971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24973         this_ptr_conv.is_owned = false;
24974         LDKPublicKey val_ref;
24975         CHECK(val->arr_len == 33);
24976         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24977         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24978 }
24979
24980 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24981         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24982         this_ptr_conv.inner = untag_ptr(this_ptr);
24983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24985         this_ptr_conv.is_owned = false;
24986         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24987         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24988         return ret_arr;
24989 }
24990
24991 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24992         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24993         this_ptr_conv.inner = untag_ptr(this_ptr);
24994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24996         this_ptr_conv.is_owned = false;
24997         LDKThirtyTwoBytes val_ref;
24998         CHECK(val->arr_len == 32);
24999         memcpy(val_ref.data, val->elems, 32); FREE(val);
25000         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25001 }
25002
25003 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25004         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25005         this_ptr_conv.inner = untag_ptr(this_ptr);
25006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25008         this_ptr_conv.is_owned = false;
25009         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25010         return ret_conv;
25011 }
25012
25013 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25014         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25015         this_ptr_conv.inner = untag_ptr(this_ptr);
25016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25018         this_ptr_conv.is_owned = false;
25019         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25020 }
25021
25022 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) {
25023         LDKOutPoint outpoint_arg_conv;
25024         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25025         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25026         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25027         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25028         LDKPublicKey per_commitment_point_arg_ref;
25029         CHECK(per_commitment_point_arg->arr_len == 33);
25030         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
25031         void* output_arg_ptr = untag_ptr(output_arg);
25032         CHECK_ACCESS(output_arg_ptr);
25033         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25034         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25035         LDKPublicKey revocation_pubkey_arg_ref;
25036         CHECK(revocation_pubkey_arg->arr_len == 33);
25037         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
25038         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25039         CHECK(channel_keys_id_arg->arr_len == 32);
25040         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25041         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);
25042         uint64_t ret_ref = 0;
25043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25045         return ret_ref;
25046 }
25047
25048 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
25049         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
25050         uint64_t ret_ref = 0;
25051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25053         return ret_ref;
25054 }
25055 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25056         LDKDelayedPaymentOutputDescriptor arg_conv;
25057         arg_conv.inner = untag_ptr(arg);
25058         arg_conv.is_owned = ptr_is_owned(arg);
25059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25060         arg_conv.is_owned = false;
25061         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
25062         return ret_conv;
25063 }
25064
25065 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
25066         LDKDelayedPaymentOutputDescriptor orig_conv;
25067         orig_conv.inner = untag_ptr(orig);
25068         orig_conv.is_owned = ptr_is_owned(orig);
25069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25070         orig_conv.is_owned = false;
25071         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
25072         uint64_t ret_ref = 0;
25073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25075         return ret_ref;
25076 }
25077
25078 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25079         LDKDelayedPaymentOutputDescriptor a_conv;
25080         a_conv.inner = untag_ptr(a);
25081         a_conv.is_owned = ptr_is_owned(a);
25082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25083         a_conv.is_owned = false;
25084         LDKDelayedPaymentOutputDescriptor b_conv;
25085         b_conv.inner = untag_ptr(b);
25086         b_conv.is_owned = ptr_is_owned(b);
25087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25088         b_conv.is_owned = false;
25089         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
25090         return ret_conv;
25091 }
25092
25093 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
25094         LDKDelayedPaymentOutputDescriptor obj_conv;
25095         obj_conv.inner = untag_ptr(obj);
25096         obj_conv.is_owned = ptr_is_owned(obj);
25097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25098         obj_conv.is_owned = false;
25099         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
25100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25102         CVec_u8Z_free(ret_var);
25103         return ret_arr;
25104 }
25105
25106 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
25107         LDKu8slice ser_ref;
25108         ser_ref.datalen = ser->arr_len;
25109         ser_ref.data = ser->elems;
25110         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25111         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
25112         FREE(ser);
25113         return tag_ptr(ret_conv, true);
25114 }
25115
25116 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
25117         LDKStaticPaymentOutputDescriptor this_obj_conv;
25118         this_obj_conv.inner = untag_ptr(this_obj);
25119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25121         StaticPaymentOutputDescriptor_free(this_obj_conv);
25122 }
25123
25124 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
25125         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25126         this_ptr_conv.inner = untag_ptr(this_ptr);
25127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25129         this_ptr_conv.is_owned = false;
25130         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
25131         uint64_t ret_ref = 0;
25132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25134         return ret_ref;
25135 }
25136
25137 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
25138         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25139         this_ptr_conv.inner = untag_ptr(this_ptr);
25140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25142         this_ptr_conv.is_owned = false;
25143         LDKOutPoint val_conv;
25144         val_conv.inner = untag_ptr(val);
25145         val_conv.is_owned = ptr_is_owned(val);
25146         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25147         val_conv = OutPoint_clone(&val_conv);
25148         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
25149 }
25150
25151 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
25152         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25153         this_ptr_conv.inner = untag_ptr(this_ptr);
25154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25156         this_ptr_conv.is_owned = false;
25157         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
25158         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
25159         return tag_ptr(ret_ref, true);
25160 }
25161
25162 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
25163         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25164         this_ptr_conv.inner = untag_ptr(this_ptr);
25165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25167         this_ptr_conv.is_owned = false;
25168         void* val_ptr = untag_ptr(val);
25169         CHECK_ACCESS(val_ptr);
25170         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
25171         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
25172         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
25173 }
25174
25175 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
25176         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25177         this_ptr_conv.inner = untag_ptr(this_ptr);
25178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25180         this_ptr_conv.is_owned = false;
25181         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25182         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
25183         return ret_arr;
25184 }
25185
25186 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
25187         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25188         this_ptr_conv.inner = untag_ptr(this_ptr);
25189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25191         this_ptr_conv.is_owned = false;
25192         LDKThirtyTwoBytes val_ref;
25193         CHECK(val->arr_len == 32);
25194         memcpy(val_ref.data, val->elems, 32); FREE(val);
25195         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25196 }
25197
25198 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25199         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25200         this_ptr_conv.inner = untag_ptr(this_ptr);
25201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25203         this_ptr_conv.is_owned = false;
25204         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25205         return ret_conv;
25206 }
25207
25208 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25209         LDKStaticPaymentOutputDescriptor this_ptr_conv;
25210         this_ptr_conv.inner = untag_ptr(this_ptr);
25211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25213         this_ptr_conv.is_owned = false;
25214         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25215 }
25216
25217 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) {
25218         LDKOutPoint outpoint_arg_conv;
25219         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25220         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25221         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25222         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25223         void* output_arg_ptr = untag_ptr(output_arg);
25224         CHECK_ACCESS(output_arg_ptr);
25225         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25226         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25227         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25228         CHECK(channel_keys_id_arg->arr_len == 32);
25229         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25230         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
25231         uint64_t ret_ref = 0;
25232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25234         return ret_ref;
25235 }
25236
25237 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
25238         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
25239         uint64_t ret_ref = 0;
25240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25242         return ret_ref;
25243 }
25244 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25245         LDKStaticPaymentOutputDescriptor arg_conv;
25246         arg_conv.inner = untag_ptr(arg);
25247         arg_conv.is_owned = ptr_is_owned(arg);
25248         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25249         arg_conv.is_owned = false;
25250         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
25251         return ret_conv;
25252 }
25253
25254 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
25255         LDKStaticPaymentOutputDescriptor orig_conv;
25256         orig_conv.inner = untag_ptr(orig);
25257         orig_conv.is_owned = ptr_is_owned(orig);
25258         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25259         orig_conv.is_owned = false;
25260         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
25261         uint64_t ret_ref = 0;
25262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25264         return ret_ref;
25265 }
25266
25267 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25268         LDKStaticPaymentOutputDescriptor a_conv;
25269         a_conv.inner = untag_ptr(a);
25270         a_conv.is_owned = ptr_is_owned(a);
25271         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25272         a_conv.is_owned = false;
25273         LDKStaticPaymentOutputDescriptor b_conv;
25274         b_conv.inner = untag_ptr(b);
25275         b_conv.is_owned = ptr_is_owned(b);
25276         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25277         b_conv.is_owned = false;
25278         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
25279         return ret_conv;
25280 }
25281
25282 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
25283         LDKStaticPaymentOutputDescriptor obj_conv;
25284         obj_conv.inner = untag_ptr(obj);
25285         obj_conv.is_owned = ptr_is_owned(obj);
25286         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25287         obj_conv.is_owned = false;
25288         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
25289         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25290         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25291         CVec_u8Z_free(ret_var);
25292         return ret_arr;
25293 }
25294
25295 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
25296         LDKu8slice ser_ref;
25297         ser_ref.datalen = ser->arr_len;
25298         ser_ref.data = ser->elems;
25299         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25300         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
25301         FREE(ser);
25302         return tag_ptr(ret_conv, true);
25303 }
25304
25305 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
25306         if (!ptr_is_owned(this_ptr)) return;
25307         void* this_ptr_ptr = untag_ptr(this_ptr);
25308         CHECK_ACCESS(this_ptr_ptr);
25309         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
25310         FREE(untag_ptr(this_ptr));
25311         SpendableOutputDescriptor_free(this_ptr_conv);
25312 }
25313
25314 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
25315         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25316         *ret_copy = SpendableOutputDescriptor_clone(arg);
25317         uint64_t ret_ref = tag_ptr(ret_copy, true);
25318         return ret_ref;
25319 }
25320 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
25321         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
25322         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
25323         return ret_conv;
25324 }
25325
25326 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
25327         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
25328         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25329         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
25330         uint64_t ret_ref = tag_ptr(ret_copy, true);
25331         return ret_ref;
25332 }
25333
25334 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
25335         LDKOutPoint outpoint_conv;
25336         outpoint_conv.inner = untag_ptr(outpoint);
25337         outpoint_conv.is_owned = ptr_is_owned(outpoint);
25338         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
25339         outpoint_conv = OutPoint_clone(&outpoint_conv);
25340         void* output_ptr = untag_ptr(output);
25341         CHECK_ACCESS(output_ptr);
25342         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
25343         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
25344         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25345         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
25346         uint64_t ret_ref = tag_ptr(ret_copy, true);
25347         return ret_ref;
25348 }
25349
25350 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
25351         LDKDelayedPaymentOutputDescriptor a_conv;
25352         a_conv.inner = untag_ptr(a);
25353         a_conv.is_owned = ptr_is_owned(a);
25354         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25355         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25356         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25357         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25358         uint64_t ret_ref = tag_ptr(ret_copy, true);
25359         return ret_ref;
25360 }
25361
25362 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
25363         LDKStaticPaymentOutputDescriptor a_conv;
25364         a_conv.inner = untag_ptr(a);
25365         a_conv.is_owned = ptr_is_owned(a);
25366         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25367         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25368         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25369         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25370         uint64_t ret_ref = tag_ptr(ret_copy, true);
25371         return ret_ref;
25372 }
25373
25374 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
25375         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
25376         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
25377         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
25378         return ret_conv;
25379 }
25380
25381 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
25382         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
25383         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25384         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25385         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25386         CVec_u8Z_free(ret_var);
25387         return ret_arr;
25388 }
25389
25390 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
25391         LDKu8slice ser_ref;
25392         ser_ref.datalen = ser->arr_len;
25393         ser_ref.data = ser->elems;
25394         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25395         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25396         FREE(ser);
25397         return tag_ptr(ret_conv, true);
25398 }
25399
25400 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
25401         if (!ptr_is_owned(this_ptr)) return;
25402         void* this_ptr_ptr = untag_ptr(this_ptr);
25403         CHECK_ACCESS(this_ptr_ptr);
25404         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25405         FREE(untag_ptr(this_ptr));
25406         BaseSign_free(this_ptr_conv);
25407 }
25408
25409 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25410         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25411         *ret_ret = Sign_clone(arg);
25412         return tag_ptr(ret_ret, true);
25413 }
25414 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
25415         void* arg_ptr = untag_ptr(arg);
25416         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25417         LDKSign* arg_conv = (LDKSign*)arg_ptr;
25418         int64_t ret_conv = Sign_clone_ptr(arg_conv);
25419         return ret_conv;
25420 }
25421
25422 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
25423         void* orig_ptr = untag_ptr(orig);
25424         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
25425         LDKSign* orig_conv = (LDKSign*)orig_ptr;
25426         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25427         *ret_ret = Sign_clone(orig_conv);
25428         return tag_ptr(ret_ret, true);
25429 }
25430
25431 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
25432         if (!ptr_is_owned(this_ptr)) return;
25433         void* this_ptr_ptr = untag_ptr(this_ptr);
25434         CHECK_ACCESS(this_ptr_ptr);
25435         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25436         FREE(untag_ptr(this_ptr));
25437         Sign_free(this_ptr_conv);
25438 }
25439
25440 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
25441         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
25442         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
25443         return ret_conv;
25444 }
25445
25446 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
25447         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
25448         return ret_conv;
25449 }
25450
25451 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
25452         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
25453         return ret_conv;
25454 }
25455
25456 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
25457         if (!ptr_is_owned(this_ptr)) return;
25458         void* this_ptr_ptr = untag_ptr(this_ptr);
25459         CHECK_ACCESS(this_ptr_ptr);
25460         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25461         FREE(untag_ptr(this_ptr));
25462         KeysInterface_free(this_ptr_conv);
25463 }
25464
25465 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
25466         LDKInMemorySigner this_obj_conv;
25467         this_obj_conv.inner = untag_ptr(this_obj);
25468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25470         InMemorySigner_free(this_obj_conv);
25471 }
25472
25473 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
25474         LDKInMemorySigner this_ptr_conv;
25475         this_ptr_conv.inner = untag_ptr(this_ptr);
25476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25478         this_ptr_conv.is_owned = false;
25479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25480         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
25481         return ret_arr;
25482 }
25483
25484 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
25485         LDKInMemorySigner this_ptr_conv;
25486         this_ptr_conv.inner = untag_ptr(this_ptr);
25487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25489         this_ptr_conv.is_owned = false;
25490         LDKSecretKey val_ref;
25491         CHECK(val->arr_len == 32);
25492         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25493         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25494 }
25495
25496 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
25497         LDKInMemorySigner this_ptr_conv;
25498         this_ptr_conv.inner = untag_ptr(this_ptr);
25499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25501         this_ptr_conv.is_owned = false;
25502         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25503         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
25504         return ret_arr;
25505 }
25506
25507 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
25508         LDKInMemorySigner this_ptr_conv;
25509         this_ptr_conv.inner = untag_ptr(this_ptr);
25510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25512         this_ptr_conv.is_owned = false;
25513         LDKSecretKey val_ref;
25514         CHECK(val->arr_len == 32);
25515         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25516         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25517 }
25518
25519 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
25520         LDKInMemorySigner this_ptr_conv;
25521         this_ptr_conv.inner = untag_ptr(this_ptr);
25522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25524         this_ptr_conv.is_owned = false;
25525         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25526         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
25527         return ret_arr;
25528 }
25529
25530 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
25531         LDKInMemorySigner this_ptr_conv;
25532         this_ptr_conv.inner = untag_ptr(this_ptr);
25533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25535         this_ptr_conv.is_owned = false;
25536         LDKSecretKey val_ref;
25537         CHECK(val->arr_len == 32);
25538         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25539         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25540 }
25541
25542 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
25543         LDKInMemorySigner this_ptr_conv;
25544         this_ptr_conv.inner = untag_ptr(this_ptr);
25545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25547         this_ptr_conv.is_owned = false;
25548         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25549         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
25550         return ret_arr;
25551 }
25552
25553 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) {
25554         LDKInMemorySigner this_ptr_conv;
25555         this_ptr_conv.inner = untag_ptr(this_ptr);
25556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25558         this_ptr_conv.is_owned = false;
25559         LDKSecretKey val_ref;
25560         CHECK(val->arr_len == 32);
25561         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25562         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25563 }
25564
25565 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
25566         LDKInMemorySigner this_ptr_conv;
25567         this_ptr_conv.inner = untag_ptr(this_ptr);
25568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25570         this_ptr_conv.is_owned = false;
25571         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25572         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
25573         return ret_arr;
25574 }
25575
25576 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
25577         LDKInMemorySigner this_ptr_conv;
25578         this_ptr_conv.inner = untag_ptr(this_ptr);
25579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25581         this_ptr_conv.is_owned = false;
25582         LDKSecretKey val_ref;
25583         CHECK(val->arr_len == 32);
25584         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25585         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25586 }
25587
25588 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
25589         LDKInMemorySigner this_ptr_conv;
25590         this_ptr_conv.inner = untag_ptr(this_ptr);
25591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25593         this_ptr_conv.is_owned = false;
25594         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25595         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
25596         return ret_arr;
25597 }
25598
25599 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
25600         LDKInMemorySigner this_ptr_conv;
25601         this_ptr_conv.inner = untag_ptr(this_ptr);
25602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25604         this_ptr_conv.is_owned = false;
25605         LDKThirtyTwoBytes val_ref;
25606         CHECK(val->arr_len == 32);
25607         memcpy(val_ref.data, val->elems, 32); FREE(val);
25608         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25609 }
25610
25611 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25612         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25613         uint64_t ret_ref = 0;
25614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25616         return ret_ref;
25617 }
25618 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
25619         LDKInMemorySigner arg_conv;
25620         arg_conv.inner = untag_ptr(arg);
25621         arg_conv.is_owned = ptr_is_owned(arg);
25622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25623         arg_conv.is_owned = false;
25624         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
25625         return ret_conv;
25626 }
25627
25628 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
25629         LDKInMemorySigner orig_conv;
25630         orig_conv.inner = untag_ptr(orig);
25631         orig_conv.is_owned = ptr_is_owned(orig);
25632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25633         orig_conv.is_owned = false;
25634         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25635         uint64_t ret_ref = 0;
25636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25638         return ret_ref;
25639 }
25640
25641 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) {
25642         LDKSecretKey node_secret_ref;
25643         CHECK(node_secret->arr_len == 32);
25644         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
25645         LDKSecretKey funding_key_ref;
25646         CHECK(funding_key->arr_len == 32);
25647         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
25648         LDKSecretKey revocation_base_key_ref;
25649         CHECK(revocation_base_key->arr_len == 32);
25650         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
25651         LDKSecretKey payment_key_ref;
25652         CHECK(payment_key->arr_len == 32);
25653         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
25654         LDKSecretKey delayed_payment_base_key_ref;
25655         CHECK(delayed_payment_base_key->arr_len == 32);
25656         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
25657         LDKSecretKey htlc_base_key_ref;
25658         CHECK(htlc_base_key->arr_len == 32);
25659         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
25660         LDKThirtyTwoBytes commitment_seed_ref;
25661         CHECK(commitment_seed->arr_len == 32);
25662         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
25663         LDKThirtyTwoBytes channel_keys_id_ref;
25664         CHECK(channel_keys_id->arr_len == 32);
25665         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
25666         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);
25667         uint64_t ret_ref = 0;
25668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25670         return ret_ref;
25671 }
25672
25673 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
25674         LDKInMemorySigner this_arg_conv;
25675         this_arg_conv.inner = untag_ptr(this_arg);
25676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25678         this_arg_conv.is_owned = false;
25679         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25680         uint64_t ret_ref = 0;
25681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25683         return ret_ref;
25684 }
25685
25686 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
25687         LDKInMemorySigner this_arg_conv;
25688         this_arg_conv.inner = untag_ptr(this_arg);
25689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25691         this_arg_conv.is_owned = false;
25692         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25693         return ret_conv;
25694 }
25695
25696 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
25697         LDKInMemorySigner this_arg_conv;
25698         this_arg_conv.inner = untag_ptr(this_arg);
25699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25701         this_arg_conv.is_owned = false;
25702         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25703         return ret_conv;
25704 }
25705
25706 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
25707         LDKInMemorySigner this_arg_conv;
25708         this_arg_conv.inner = untag_ptr(this_arg);
25709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25711         this_arg_conv.is_owned = false;
25712         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
25713         return ret_conv;
25714 }
25715
25716 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
25717         LDKInMemorySigner this_arg_conv;
25718         this_arg_conv.inner = untag_ptr(this_arg);
25719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25721         this_arg_conv.is_owned = false;
25722         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25723         uint64_t ret_ref = 0;
25724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25726         return ret_ref;
25727 }
25728
25729 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
25730         LDKInMemorySigner this_arg_conv;
25731         this_arg_conv.inner = untag_ptr(this_arg);
25732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25734         this_arg_conv.is_owned = false;
25735         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25736         uint64_t ret_ref = 0;
25737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25739         return ret_ref;
25740 }
25741
25742 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
25743         LDKInMemorySigner this_arg_conv;
25744         this_arg_conv.inner = untag_ptr(this_arg);
25745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25747         this_arg_conv.is_owned = false;
25748         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
25749         return ret_conv;
25750 }
25751
25752 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) {
25753         LDKInMemorySigner this_arg_conv;
25754         this_arg_conv.inner = untag_ptr(this_arg);
25755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25757         this_arg_conv.is_owned = false;
25758         LDKTransaction spend_tx_ref;
25759         spend_tx_ref.datalen = spend_tx->arr_len;
25760         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25761         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25762         spend_tx_ref.data_is_owned = true;
25763         LDKStaticPaymentOutputDescriptor descriptor_conv;
25764         descriptor_conv.inner = untag_ptr(descriptor);
25765         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25766         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25767         descriptor_conv.is_owned = false;
25768         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25769         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25770         return tag_ptr(ret_conv, true);
25771 }
25772
25773 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) {
25774         LDKInMemorySigner this_arg_conv;
25775         this_arg_conv.inner = untag_ptr(this_arg);
25776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25778         this_arg_conv.is_owned = false;
25779         LDKTransaction spend_tx_ref;
25780         spend_tx_ref.datalen = spend_tx->arr_len;
25781         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25782         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25783         spend_tx_ref.data_is_owned = true;
25784         LDKDelayedPaymentOutputDescriptor descriptor_conv;
25785         descriptor_conv.inner = untag_ptr(descriptor);
25786         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25787         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25788         descriptor_conv.is_owned = false;
25789         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25790         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25791         return tag_ptr(ret_conv, true);
25792 }
25793
25794 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
25795         LDKInMemorySigner this_arg_conv;
25796         this_arg_conv.inner = untag_ptr(this_arg);
25797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25799         this_arg_conv.is_owned = false;
25800         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25801         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25802         return tag_ptr(ret_ret, true);
25803 }
25804
25805 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
25806         LDKInMemorySigner this_arg_conv;
25807         this_arg_conv.inner = untag_ptr(this_arg);
25808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25810         this_arg_conv.is_owned = false;
25811         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25812         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25813         return tag_ptr(ret_ret, true);
25814 }
25815
25816 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
25817         LDKInMemorySigner obj_conv;
25818         obj_conv.inner = untag_ptr(obj);
25819         obj_conv.is_owned = ptr_is_owned(obj);
25820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25821         obj_conv.is_owned = false;
25822         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25825         CVec_u8Z_free(ret_var);
25826         return ret_arr;
25827 }
25828
25829 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
25830         LDKu8slice ser_ref;
25831         ser_ref.datalen = ser->arr_len;
25832         ser_ref.data = ser->elems;
25833         LDKSecretKey arg_ref;
25834         CHECK(arg->arr_len == 32);
25835         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
25836         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25837         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
25838         FREE(ser);
25839         return tag_ptr(ret_conv, true);
25840 }
25841
25842 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
25843         LDKKeysManager this_obj_conv;
25844         this_obj_conv.inner = untag_ptr(this_obj);
25845         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25847         KeysManager_free(this_obj_conv);
25848 }
25849
25850 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
25851         unsigned char seed_arr[32];
25852         CHECK(seed->arr_len == 32);
25853         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25854         unsigned char (*seed_ref)[32] = &seed_arr;
25855         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25856         uint64_t ret_ref = 0;
25857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25859         return ret_ref;
25860 }
25861
25862 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) {
25863         LDKKeysManager this_arg_conv;
25864         this_arg_conv.inner = untag_ptr(this_arg);
25865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25867         this_arg_conv.is_owned = false;
25868         unsigned char params_arr[32];
25869         CHECK(params->arr_len == 32);
25870         memcpy(params_arr, params->elems, 32); FREE(params);
25871         unsigned char (*params_ref)[32] = &params_arr;
25872         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25873         uint64_t ret_ref = 0;
25874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25876         return ret_ref;
25877 }
25878
25879 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) {
25880         LDKKeysManager this_arg_conv;
25881         this_arg_conv.inner = untag_ptr(this_arg);
25882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25884         this_arg_conv.is_owned = false;
25885         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25886         descriptors_constr.datalen = descriptors->arr_len;
25887         if (descriptors_constr.datalen > 0)
25888                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25889         else
25890                 descriptors_constr.data = NULL;
25891         uint64_t* descriptors_vals = descriptors->elems;
25892         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25893                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25894                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25895                 CHECK_ACCESS(descriptors_conv_27_ptr);
25896                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25897                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25898                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25899         }
25900         FREE(descriptors);
25901         LDKCVec_TxOutZ outputs_constr;
25902         outputs_constr.datalen = outputs->arr_len;
25903         if (outputs_constr.datalen > 0)
25904                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25905         else
25906                 outputs_constr.data = NULL;
25907         uint64_t* outputs_vals = outputs->elems;
25908         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25909                 uint64_t outputs_conv_7 = outputs_vals[h];
25910                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25911                 CHECK_ACCESS(outputs_conv_7_ptr);
25912                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25913                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25914                 outputs_constr.data[h] = outputs_conv_7_conv;
25915         }
25916         FREE(outputs);
25917         LDKCVec_u8Z change_destination_script_ref;
25918         change_destination_script_ref.datalen = change_destination_script->arr_len;
25919         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25920         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25921         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25922         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25923         return tag_ptr(ret_conv, true);
25924 }
25925
25926 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
25927         LDKKeysManager this_arg_conv;
25928         this_arg_conv.inner = untag_ptr(this_arg);
25929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25931         this_arg_conv.is_owned = false;
25932         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25933         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25934         return tag_ptr(ret_ret, true);
25935 }
25936
25937 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
25938         LDKPhantomKeysManager this_obj_conv;
25939         this_obj_conv.inner = untag_ptr(this_obj);
25940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25942         PhantomKeysManager_free(this_obj_conv);
25943 }
25944
25945 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
25946         LDKPhantomKeysManager this_arg_conv;
25947         this_arg_conv.inner = untag_ptr(this_arg);
25948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25950         this_arg_conv.is_owned = false;
25951         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25952         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
25953         return tag_ptr(ret_ret, true);
25954 }
25955
25956 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) {
25957         unsigned char seed_arr[32];
25958         CHECK(seed->arr_len == 32);
25959         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25960         unsigned char (*seed_ref)[32] = &seed_arr;
25961         unsigned char cross_node_seed_arr[32];
25962         CHECK(cross_node_seed->arr_len == 32);
25963         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
25964         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
25965         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
25966         uint64_t ret_ref = 0;
25967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25969         return ret_ref;
25970 }
25971
25972 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) {
25973         LDKPhantomKeysManager this_arg_conv;
25974         this_arg_conv.inner = untag_ptr(this_arg);
25975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25977         this_arg_conv.is_owned = false;
25978         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25979         descriptors_constr.datalen = descriptors->arr_len;
25980         if (descriptors_constr.datalen > 0)
25981                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25982         else
25983                 descriptors_constr.data = NULL;
25984         uint64_t* descriptors_vals = descriptors->elems;
25985         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25986                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25987                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25988                 CHECK_ACCESS(descriptors_conv_27_ptr);
25989                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25990                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25991                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25992         }
25993         FREE(descriptors);
25994         LDKCVec_TxOutZ outputs_constr;
25995         outputs_constr.datalen = outputs->arr_len;
25996         if (outputs_constr.datalen > 0)
25997                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25998         else
25999                 outputs_constr.data = NULL;
26000         uint64_t* outputs_vals = outputs->elems;
26001         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26002                 uint64_t outputs_conv_7 = outputs_vals[h];
26003                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26004                 CHECK_ACCESS(outputs_conv_7_ptr);
26005                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26006                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26007                 outputs_constr.data[h] = outputs_conv_7_conv;
26008         }
26009         FREE(outputs);
26010         LDKCVec_u8Z change_destination_script_ref;
26011         change_destination_script_ref.datalen = change_destination_script->arr_len;
26012         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26013         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26014         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26015         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26016         return tag_ptr(ret_conv, true);
26017 }
26018
26019 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) {
26020         LDKPhantomKeysManager this_arg_conv;
26021         this_arg_conv.inner = untag_ptr(this_arg);
26022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26024         this_arg_conv.is_owned = false;
26025         unsigned char params_arr[32];
26026         CHECK(params->arr_len == 32);
26027         memcpy(params_arr, params->elems, 32); FREE(params);
26028         unsigned char (*params_ref)[32] = &params_arr;
26029         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26030         uint64_t ret_ref = 0;
26031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26033         return ret_ref;
26034 }
26035
26036 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
26037         LDKChannelManager this_obj_conv;
26038         this_obj_conv.inner = untag_ptr(this_obj);
26039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26041         ChannelManager_free(this_obj_conv);
26042 }
26043
26044 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
26045         LDKChainParameters this_obj_conv;
26046         this_obj_conv.inner = untag_ptr(this_obj);
26047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26049         ChainParameters_free(this_obj_conv);
26050 }
26051
26052 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
26053         LDKChainParameters this_ptr_conv;
26054         this_ptr_conv.inner = untag_ptr(this_ptr);
26055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26057         this_ptr_conv.is_owned = false;
26058         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
26059         return ret_conv;
26060 }
26061
26062 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
26063         LDKChainParameters this_ptr_conv;
26064         this_ptr_conv.inner = untag_ptr(this_ptr);
26065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26067         this_ptr_conv.is_owned = false;
26068         LDKNetwork val_conv = LDKNetwork_from_js(val);
26069         ChainParameters_set_network(&this_ptr_conv, val_conv);
26070 }
26071
26072 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
26073         LDKChainParameters this_ptr_conv;
26074         this_ptr_conv.inner = untag_ptr(this_ptr);
26075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26077         this_ptr_conv.is_owned = false;
26078         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
26079         uint64_t ret_ref = 0;
26080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26082         return ret_ref;
26083 }
26084
26085 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
26086         LDKChainParameters this_ptr_conv;
26087         this_ptr_conv.inner = untag_ptr(this_ptr);
26088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26090         this_ptr_conv.is_owned = false;
26091         LDKBestBlock val_conv;
26092         val_conv.inner = untag_ptr(val);
26093         val_conv.is_owned = ptr_is_owned(val);
26094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26095         val_conv = BestBlock_clone(&val_conv);
26096         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
26097 }
26098
26099 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
26100         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
26101         LDKBestBlock best_block_arg_conv;
26102         best_block_arg_conv.inner = untag_ptr(best_block_arg);
26103         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
26104         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
26105         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
26106         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
26107         uint64_t ret_ref = 0;
26108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26110         return ret_ref;
26111 }
26112
26113 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
26114         LDKChainParameters ret_var = ChainParameters_clone(arg);
26115         uint64_t ret_ref = 0;
26116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26118         return ret_ref;
26119 }
26120 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
26121         LDKChainParameters arg_conv;
26122         arg_conv.inner = untag_ptr(arg);
26123         arg_conv.is_owned = ptr_is_owned(arg);
26124         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26125         arg_conv.is_owned = false;
26126         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
26127         return ret_conv;
26128 }
26129
26130 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
26131         LDKChainParameters orig_conv;
26132         orig_conv.inner = untag_ptr(orig);
26133         orig_conv.is_owned = ptr_is_owned(orig);
26134         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26135         orig_conv.is_owned = false;
26136         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
26137         uint64_t ret_ref = 0;
26138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26140         return ret_ref;
26141 }
26142
26143 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
26144         LDKCounterpartyForwardingInfo this_obj_conv;
26145         this_obj_conv.inner = untag_ptr(this_obj);
26146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26148         CounterpartyForwardingInfo_free(this_obj_conv);
26149 }
26150
26151 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
26152         LDKCounterpartyForwardingInfo this_ptr_conv;
26153         this_ptr_conv.inner = untag_ptr(this_ptr);
26154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26156         this_ptr_conv.is_owned = false;
26157         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
26158         return ret_conv;
26159 }
26160
26161 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
26162         LDKCounterpartyForwardingInfo this_ptr_conv;
26163         this_ptr_conv.inner = untag_ptr(this_ptr);
26164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26166         this_ptr_conv.is_owned = false;
26167         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
26168 }
26169
26170 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
26171         LDKCounterpartyForwardingInfo this_ptr_conv;
26172         this_ptr_conv.inner = untag_ptr(this_ptr);
26173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26175         this_ptr_conv.is_owned = false;
26176         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
26177         return ret_conv;
26178 }
26179
26180 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
26181         LDKCounterpartyForwardingInfo this_ptr_conv;
26182         this_ptr_conv.inner = untag_ptr(this_ptr);
26183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26185         this_ptr_conv.is_owned = false;
26186         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
26187 }
26188
26189 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
26190         LDKCounterpartyForwardingInfo this_ptr_conv;
26191         this_ptr_conv.inner = untag_ptr(this_ptr);
26192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26194         this_ptr_conv.is_owned = false;
26195         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
26196         return ret_conv;
26197 }
26198
26199 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
26200         LDKCounterpartyForwardingInfo this_ptr_conv;
26201         this_ptr_conv.inner = untag_ptr(this_ptr);
26202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26204         this_ptr_conv.is_owned = false;
26205         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
26206 }
26207
26208 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) {
26209         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
26210         uint64_t ret_ref = 0;
26211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26213         return ret_ref;
26214 }
26215
26216 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
26217         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
26218         uint64_t ret_ref = 0;
26219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26221         return ret_ref;
26222 }
26223 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
26224         LDKCounterpartyForwardingInfo arg_conv;
26225         arg_conv.inner = untag_ptr(arg);
26226         arg_conv.is_owned = ptr_is_owned(arg);
26227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26228         arg_conv.is_owned = false;
26229         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
26230         return ret_conv;
26231 }
26232
26233 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
26234         LDKCounterpartyForwardingInfo orig_conv;
26235         orig_conv.inner = untag_ptr(orig);
26236         orig_conv.is_owned = ptr_is_owned(orig);
26237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26238         orig_conv.is_owned = false;
26239         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
26240         uint64_t ret_ref = 0;
26241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26243         return ret_ref;
26244 }
26245
26246 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
26247         LDKChannelCounterparty this_obj_conv;
26248         this_obj_conv.inner = untag_ptr(this_obj);
26249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26251         ChannelCounterparty_free(this_obj_conv);
26252 }
26253
26254 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
26255         LDKChannelCounterparty this_ptr_conv;
26256         this_ptr_conv.inner = untag_ptr(this_ptr);
26257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26259         this_ptr_conv.is_owned = false;
26260         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26261         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
26262         return ret_arr;
26263 }
26264
26265 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
26266         LDKChannelCounterparty this_ptr_conv;
26267         this_ptr_conv.inner = untag_ptr(this_ptr);
26268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26270         this_ptr_conv.is_owned = false;
26271         LDKPublicKey val_ref;
26272         CHECK(val->arr_len == 33);
26273         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26274         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
26275 }
26276
26277 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
26278         LDKChannelCounterparty this_ptr_conv;
26279         this_ptr_conv.inner = untag_ptr(this_ptr);
26280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26282         this_ptr_conv.is_owned = false;
26283         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
26284         uint64_t ret_ref = 0;
26285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26287         return ret_ref;
26288 }
26289
26290 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
26291         LDKChannelCounterparty this_ptr_conv;
26292         this_ptr_conv.inner = untag_ptr(this_ptr);
26293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26295         this_ptr_conv.is_owned = false;
26296         LDKInitFeatures val_conv;
26297         val_conv.inner = untag_ptr(val);
26298         val_conv.is_owned = ptr_is_owned(val);
26299         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26300         val_conv = InitFeatures_clone(&val_conv);
26301         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
26302 }
26303
26304 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26305         LDKChannelCounterparty this_ptr_conv;
26306         this_ptr_conv.inner = untag_ptr(this_ptr);
26307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26309         this_ptr_conv.is_owned = false;
26310         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
26311         return ret_conv;
26312 }
26313
26314 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
26315         LDKChannelCounterparty this_ptr_conv;
26316         this_ptr_conv.inner = untag_ptr(this_ptr);
26317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26319         this_ptr_conv.is_owned = false;
26320         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
26321 }
26322
26323 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
26324         LDKChannelCounterparty this_ptr_conv;
26325         this_ptr_conv.inner = untag_ptr(this_ptr);
26326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26328         this_ptr_conv.is_owned = false;
26329         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26330         uint64_t ret_ref = 0;
26331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26333         return ret_ref;
26334 }
26335
26336 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
26337         LDKChannelCounterparty this_ptr_conv;
26338         this_ptr_conv.inner = untag_ptr(this_ptr);
26339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26341         this_ptr_conv.is_owned = false;
26342         LDKCounterpartyForwardingInfo val_conv;
26343         val_conv.inner = untag_ptr(val);
26344         val_conv.is_owned = ptr_is_owned(val);
26345         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26346         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26347         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26348 }
26349
26350 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
26351         LDKChannelCounterparty this_ptr_conv;
26352         this_ptr_conv.inner = untag_ptr(this_ptr);
26353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26355         this_ptr_conv.is_owned = false;
26356         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26357         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
26358         uint64_t ret_ref = tag_ptr(ret_copy, true);
26359         return ret_ref;
26360 }
26361
26362 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) {
26363         LDKChannelCounterparty this_ptr_conv;
26364         this_ptr_conv.inner = untag_ptr(this_ptr);
26365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26367         this_ptr_conv.is_owned = false;
26368         void* val_ptr = untag_ptr(val);
26369         CHECK_ACCESS(val_ptr);
26370         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26371         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26372         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26373 }
26374
26375 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
26376         LDKChannelCounterparty this_ptr_conv;
26377         this_ptr_conv.inner = untag_ptr(this_ptr);
26378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26380         this_ptr_conv.is_owned = false;
26381         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26382         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
26383         uint64_t ret_ref = tag_ptr(ret_copy, true);
26384         return ret_ref;
26385 }
26386
26387 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) {
26388         LDKChannelCounterparty this_ptr_conv;
26389         this_ptr_conv.inner = untag_ptr(this_ptr);
26390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26392         this_ptr_conv.is_owned = false;
26393         void* val_ptr = untag_ptr(val);
26394         CHECK_ACCESS(val_ptr);
26395         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26396         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26397         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26398 }
26399
26400 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) {
26401         LDKPublicKey node_id_arg_ref;
26402         CHECK(node_id_arg->arr_len == 33);
26403         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
26404         LDKInitFeatures features_arg_conv;
26405         features_arg_conv.inner = untag_ptr(features_arg);
26406         features_arg_conv.is_owned = ptr_is_owned(features_arg);
26407         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26408         features_arg_conv = InitFeatures_clone(&features_arg_conv);
26409         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26410         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
26411         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
26412         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26413         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26414         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
26415         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
26416         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
26417         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
26418         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
26419         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
26420         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
26421         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
26422         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);
26423         uint64_t ret_ref = 0;
26424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26426         return ret_ref;
26427 }
26428
26429 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26430         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26431         uint64_t ret_ref = 0;
26432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26434         return ret_ref;
26435 }
26436 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
26437         LDKChannelCounterparty arg_conv;
26438         arg_conv.inner = untag_ptr(arg);
26439         arg_conv.is_owned = ptr_is_owned(arg);
26440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26441         arg_conv.is_owned = false;
26442         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
26443         return ret_conv;
26444 }
26445
26446 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
26447         LDKChannelCounterparty orig_conv;
26448         orig_conv.inner = untag_ptr(orig);
26449         orig_conv.is_owned = ptr_is_owned(orig);
26450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26451         orig_conv.is_owned = false;
26452         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26453         uint64_t ret_ref = 0;
26454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26456         return ret_ref;
26457 }
26458
26459 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
26460         LDKChannelDetails this_obj_conv;
26461         this_obj_conv.inner = untag_ptr(this_obj);
26462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26464         ChannelDetails_free(this_obj_conv);
26465 }
26466
26467 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
26468         LDKChannelDetails this_ptr_conv;
26469         this_ptr_conv.inner = untag_ptr(this_ptr);
26470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26472         this_ptr_conv.is_owned = false;
26473         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26474         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
26475         return ret_arr;
26476 }
26477
26478 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
26479         LDKChannelDetails this_ptr_conv;
26480         this_ptr_conv.inner = untag_ptr(this_ptr);
26481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26483         this_ptr_conv.is_owned = false;
26484         LDKThirtyTwoBytes val_ref;
26485         CHECK(val->arr_len == 32);
26486         memcpy(val_ref.data, val->elems, 32); FREE(val);
26487         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26488 }
26489
26490 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
26491         LDKChannelDetails this_ptr_conv;
26492         this_ptr_conv.inner = untag_ptr(this_ptr);
26493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26495         this_ptr_conv.is_owned = false;
26496         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26497         uint64_t ret_ref = 0;
26498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26500         return ret_ref;
26501 }
26502
26503 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
26504         LDKChannelDetails this_ptr_conv;
26505         this_ptr_conv.inner = untag_ptr(this_ptr);
26506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26508         this_ptr_conv.is_owned = false;
26509         LDKChannelCounterparty val_conv;
26510         val_conv.inner = untag_ptr(val);
26511         val_conv.is_owned = ptr_is_owned(val);
26512         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26513         val_conv = ChannelCounterparty_clone(&val_conv);
26514         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26515 }
26516
26517 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
26518         LDKChannelDetails this_ptr_conv;
26519         this_ptr_conv.inner = untag_ptr(this_ptr);
26520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26522         this_ptr_conv.is_owned = false;
26523         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26524         uint64_t ret_ref = 0;
26525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26527         return ret_ref;
26528 }
26529
26530 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
26531         LDKChannelDetails this_ptr_conv;
26532         this_ptr_conv.inner = untag_ptr(this_ptr);
26533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26535         this_ptr_conv.is_owned = false;
26536         LDKOutPoint val_conv;
26537         val_conv.inner = untag_ptr(val);
26538         val_conv.is_owned = ptr_is_owned(val);
26539         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26540         val_conv = OutPoint_clone(&val_conv);
26541         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26542 }
26543
26544 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
26545         LDKChannelDetails this_ptr_conv;
26546         this_ptr_conv.inner = untag_ptr(this_ptr);
26547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26549         this_ptr_conv.is_owned = false;
26550         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
26551         uint64_t ret_ref = 0;
26552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26554         return ret_ref;
26555 }
26556
26557 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
26558         LDKChannelDetails this_ptr_conv;
26559         this_ptr_conv.inner = untag_ptr(this_ptr);
26560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26562         this_ptr_conv.is_owned = false;
26563         LDKChannelTypeFeatures val_conv;
26564         val_conv.inner = untag_ptr(val);
26565         val_conv.is_owned = ptr_is_owned(val);
26566         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26567         val_conv = ChannelTypeFeatures_clone(&val_conv);
26568         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
26569 }
26570
26571 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
26572         LDKChannelDetails this_ptr_conv;
26573         this_ptr_conv.inner = untag_ptr(this_ptr);
26574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26576         this_ptr_conv.is_owned = false;
26577         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26578         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26579         uint64_t ret_ref = tag_ptr(ret_copy, true);
26580         return ret_ref;
26581 }
26582
26583 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
26584         LDKChannelDetails this_ptr_conv;
26585         this_ptr_conv.inner = untag_ptr(this_ptr);
26586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26588         this_ptr_conv.is_owned = false;
26589         void* val_ptr = untag_ptr(val);
26590         CHECK_ACCESS(val_ptr);
26591         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26592         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26593         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26594 }
26595
26596 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
26597         LDKChannelDetails this_ptr_conv;
26598         this_ptr_conv.inner = untag_ptr(this_ptr);
26599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26601         this_ptr_conv.is_owned = false;
26602         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26603         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
26604         uint64_t ret_ref = tag_ptr(ret_copy, true);
26605         return ret_ref;
26606 }
26607
26608 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26609         LDKChannelDetails this_ptr_conv;
26610         this_ptr_conv.inner = untag_ptr(this_ptr);
26611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26613         this_ptr_conv.is_owned = false;
26614         void* val_ptr = untag_ptr(val);
26615         CHECK_ACCESS(val_ptr);
26616         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26617         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26618         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
26619 }
26620
26621 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
26622         LDKChannelDetails this_ptr_conv;
26623         this_ptr_conv.inner = untag_ptr(this_ptr);
26624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26626         this_ptr_conv.is_owned = false;
26627         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26628         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
26629         uint64_t ret_ref = tag_ptr(ret_copy, true);
26630         return ret_ref;
26631 }
26632
26633 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26634         LDKChannelDetails this_ptr_conv;
26635         this_ptr_conv.inner = untag_ptr(this_ptr);
26636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26638         this_ptr_conv.is_owned = false;
26639         void* val_ptr = untag_ptr(val);
26640         CHECK_ACCESS(val_ptr);
26641         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26642         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26643         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
26644 }
26645
26646 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
26647         LDKChannelDetails this_ptr_conv;
26648         this_ptr_conv.inner = untag_ptr(this_ptr);
26649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26651         this_ptr_conv.is_owned = false;
26652         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26653         return ret_conv;
26654 }
26655
26656 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26657         LDKChannelDetails this_ptr_conv;
26658         this_ptr_conv.inner = untag_ptr(this_ptr);
26659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26661         this_ptr_conv.is_owned = false;
26662         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26663 }
26664
26665 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26666         LDKChannelDetails this_ptr_conv;
26667         this_ptr_conv.inner = untag_ptr(this_ptr);
26668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26670         this_ptr_conv.is_owned = false;
26671         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26672         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26673         uint64_t ret_ref = tag_ptr(ret_copy, true);
26674         return ret_ref;
26675 }
26676
26677 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
26678         LDKChannelDetails this_ptr_conv;
26679         this_ptr_conv.inner = untag_ptr(this_ptr);
26680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26682         this_ptr_conv.is_owned = false;
26683         void* val_ptr = untag_ptr(val);
26684         CHECK_ACCESS(val_ptr);
26685         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26686         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26687         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26688 }
26689
26690 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
26691         LDKChannelDetails this_ptr_conv;
26692         this_ptr_conv.inner = untag_ptr(this_ptr);
26693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26695         this_ptr_conv.is_owned = false;
26696         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26697         return ret_conv;
26698 }
26699
26700 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
26701         LDKChannelDetails this_ptr_conv;
26702         this_ptr_conv.inner = untag_ptr(this_ptr);
26703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26705         this_ptr_conv.is_owned = false;
26706         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26707 }
26708
26709 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
26710         LDKChannelDetails this_ptr_conv;
26711         this_ptr_conv.inner = untag_ptr(this_ptr);
26712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26714         this_ptr_conv.is_owned = false;
26715         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
26716         return ret_conv;
26717 }
26718
26719 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
26720         LDKChannelDetails this_ptr_conv;
26721         this_ptr_conv.inner = untag_ptr(this_ptr);
26722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26724         this_ptr_conv.is_owned = false;
26725         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26726 }
26727
26728 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
26729         LDKChannelDetails this_ptr_conv;
26730         this_ptr_conv.inner = untag_ptr(this_ptr);
26731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26733         this_ptr_conv.is_owned = false;
26734         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26735         return ret_conv;
26736 }
26737
26738 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26739         LDKChannelDetails this_ptr_conv;
26740         this_ptr_conv.inner = untag_ptr(this_ptr);
26741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26743         this_ptr_conv.is_owned = false;
26744         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26745 }
26746
26747 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) {
26748         LDKChannelDetails this_ptr_conv;
26749         this_ptr_conv.inner = untag_ptr(this_ptr);
26750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26752         this_ptr_conv.is_owned = false;
26753         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
26754         return ret_conv;
26755 }
26756
26757 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) {
26758         LDKChannelDetails this_ptr_conv;
26759         this_ptr_conv.inner = untag_ptr(this_ptr);
26760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26762         this_ptr_conv.is_owned = false;
26763         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
26764 }
26765
26766 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
26767         LDKChannelDetails this_ptr_conv;
26768         this_ptr_conv.inner = untag_ptr(this_ptr);
26769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26771         this_ptr_conv.is_owned = false;
26772         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26773         return ret_conv;
26774 }
26775
26776 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26777         LDKChannelDetails this_ptr_conv;
26778         this_ptr_conv.inner = untag_ptr(this_ptr);
26779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26781         this_ptr_conv.is_owned = false;
26782         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26783 }
26784
26785 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
26786         LDKChannelDetails this_ptr_conv;
26787         this_ptr_conv.inner = untag_ptr(this_ptr);
26788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26790         this_ptr_conv.is_owned = false;
26791         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26792         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26793         uint64_t ret_ref = tag_ptr(ret_copy, true);
26794         return ret_ref;
26795 }
26796
26797 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
26798         LDKChannelDetails this_ptr_conv;
26799         this_ptr_conv.inner = untag_ptr(this_ptr);
26800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26802         this_ptr_conv.is_owned = false;
26803         void* val_ptr = untag_ptr(val);
26804         CHECK_ACCESS(val_ptr);
26805         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26806         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
26807         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26808 }
26809
26810 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
26811         LDKChannelDetails this_ptr_conv;
26812         this_ptr_conv.inner = untag_ptr(this_ptr);
26813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26815         this_ptr_conv.is_owned = false;
26816         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26817         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26818         uint64_t ret_ref = tag_ptr(ret_copy, true);
26819         return ret_ref;
26820 }
26821
26822 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) {
26823         LDKChannelDetails this_ptr_conv;
26824         this_ptr_conv.inner = untag_ptr(this_ptr);
26825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26827         this_ptr_conv.is_owned = false;
26828         void* val_ptr = untag_ptr(val);
26829         CHECK_ACCESS(val_ptr);
26830         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26831         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
26832         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26833 }
26834
26835 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
26836         LDKChannelDetails this_ptr_conv;
26837         this_ptr_conv.inner = untag_ptr(this_ptr);
26838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26840         this_ptr_conv.is_owned = false;
26841         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
26842         return ret_conv;
26843 }
26844
26845 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
26846         LDKChannelDetails this_ptr_conv;
26847         this_ptr_conv.inner = untag_ptr(this_ptr);
26848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26850         this_ptr_conv.is_owned = false;
26851         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26852 }
26853
26854 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
26855         LDKChannelDetails this_ptr_conv;
26856         this_ptr_conv.inner = untag_ptr(this_ptr);
26857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26859         this_ptr_conv.is_owned = false;
26860         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
26861         return ret_conv;
26862 }
26863
26864 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
26865         LDKChannelDetails this_ptr_conv;
26866         this_ptr_conv.inner = untag_ptr(this_ptr);
26867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26869         this_ptr_conv.is_owned = false;
26870         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
26871 }
26872
26873 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
26874         LDKChannelDetails this_ptr_conv;
26875         this_ptr_conv.inner = untag_ptr(this_ptr);
26876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26878         this_ptr_conv.is_owned = false;
26879         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
26880         return ret_conv;
26881 }
26882
26883 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
26884         LDKChannelDetails this_ptr_conv;
26885         this_ptr_conv.inner = untag_ptr(this_ptr);
26886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26888         this_ptr_conv.is_owned = false;
26889         ChannelDetails_set_is_usable(&this_ptr_conv, val);
26890 }
26891
26892 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
26893         LDKChannelDetails this_ptr_conv;
26894         this_ptr_conv.inner = untag_ptr(this_ptr);
26895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26897         this_ptr_conv.is_owned = false;
26898         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
26899         return ret_conv;
26900 }
26901
26902 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
26903         LDKChannelDetails this_ptr_conv;
26904         this_ptr_conv.inner = untag_ptr(this_ptr);
26905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26907         this_ptr_conv.is_owned = false;
26908         ChannelDetails_set_is_public(&this_ptr_conv, val);
26909 }
26910
26911 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
26912         LDKChannelDetails this_ptr_conv;
26913         this_ptr_conv.inner = untag_ptr(this_ptr);
26914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26916         this_ptr_conv.is_owned = false;
26917         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26918         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
26919         uint64_t ret_ref = tag_ptr(ret_copy, true);
26920         return ret_ref;
26921 }
26922
26923 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) {
26924         LDKChannelDetails this_ptr_conv;
26925         this_ptr_conv.inner = untag_ptr(this_ptr);
26926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26928         this_ptr_conv.is_owned = false;
26929         void* val_ptr = untag_ptr(val);
26930         CHECK_ACCESS(val_ptr);
26931         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26932         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26933         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26934 }
26935
26936 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
26937         LDKChannelDetails this_ptr_conv;
26938         this_ptr_conv.inner = untag_ptr(this_ptr);
26939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26941         this_ptr_conv.is_owned = false;
26942         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26943         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
26944         uint64_t ret_ref = tag_ptr(ret_copy, true);
26945         return ret_ref;
26946 }
26947
26948 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) {
26949         LDKChannelDetails this_ptr_conv;
26950         this_ptr_conv.inner = untag_ptr(this_ptr);
26951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26953         this_ptr_conv.is_owned = false;
26954         void* val_ptr = untag_ptr(val);
26955         CHECK_ACCESS(val_ptr);
26956         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26957         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26958         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26959 }
26960
26961 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
26962         LDKChannelDetails this_ptr_conv;
26963         this_ptr_conv.inner = untag_ptr(this_ptr);
26964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26966         this_ptr_conv.is_owned = false;
26967         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
26968         uint64_t ret_ref = 0;
26969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26971         return ret_ref;
26972 }
26973
26974 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
26975         LDKChannelDetails this_ptr_conv;
26976         this_ptr_conv.inner = untag_ptr(this_ptr);
26977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26979         this_ptr_conv.is_owned = false;
26980         LDKChannelConfig val_conv;
26981         val_conv.inner = untag_ptr(val);
26982         val_conv.is_owned = ptr_is_owned(val);
26983         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26984         val_conv = ChannelConfig_clone(&val_conv);
26985         ChannelDetails_set_config(&this_ptr_conv, val_conv);
26986 }
26987
26988 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) {
26989         LDKThirtyTwoBytes channel_id_arg_ref;
26990         CHECK(channel_id_arg->arr_len == 32);
26991         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26992         LDKChannelCounterparty counterparty_arg_conv;
26993         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
26994         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
26995         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26996         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26997         LDKOutPoint funding_txo_arg_conv;
26998         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
26999         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
27000         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
27001         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
27002         LDKChannelTypeFeatures channel_type_arg_conv;
27003         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
27004         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
27005         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
27006         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
27007         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
27008         CHECK_ACCESS(short_channel_id_arg_ptr);
27009         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
27010         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
27011         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
27012         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
27013         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
27014         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
27015         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
27016         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
27017         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
27018         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
27019         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
27020         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
27021         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
27022         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
27023         CHECK_ACCESS(confirmations_required_arg_ptr);
27024         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
27025         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
27026         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
27027         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
27028         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
27029         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
27030         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
27031         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
27032         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
27033         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
27034         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
27035         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
27036         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
27037         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
27038         LDKChannelConfig config_arg_conv;
27039         config_arg_conv.inner = untag_ptr(config_arg);
27040         config_arg_conv.is_owned = ptr_is_owned(config_arg);
27041         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
27042         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
27043         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);
27044         uint64_t ret_ref = 0;
27045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27047         return ret_ref;
27048 }
27049
27050 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
27051         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
27052         uint64_t ret_ref = 0;
27053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27055         return ret_ref;
27056 }
27057 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
27058         LDKChannelDetails arg_conv;
27059         arg_conv.inner = untag_ptr(arg);
27060         arg_conv.is_owned = ptr_is_owned(arg);
27061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27062         arg_conv.is_owned = false;
27063         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
27064         return ret_conv;
27065 }
27066
27067 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
27068         LDKChannelDetails orig_conv;
27069         orig_conv.inner = untag_ptr(orig);
27070         orig_conv.is_owned = ptr_is_owned(orig);
27071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27072         orig_conv.is_owned = false;
27073         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
27074         uint64_t ret_ref = 0;
27075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27077         return ret_ref;
27078 }
27079
27080 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
27081         LDKChannelDetails this_arg_conv;
27082         this_arg_conv.inner = untag_ptr(this_arg);
27083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27085         this_arg_conv.is_owned = false;
27086         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27087         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
27088         uint64_t ret_ref = tag_ptr(ret_copy, true);
27089         return ret_ref;
27090 }
27091
27092 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
27093         LDKChannelDetails this_arg_conv;
27094         this_arg_conv.inner = untag_ptr(this_arg);
27095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27097         this_arg_conv.is_owned = false;
27098         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27099         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
27100         uint64_t ret_ref = tag_ptr(ret_copy, true);
27101         return ret_ref;
27102 }
27103
27104 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
27105         if (!ptr_is_owned(this_ptr)) return;
27106         void* this_ptr_ptr = untag_ptr(this_ptr);
27107         CHECK_ACCESS(this_ptr_ptr);
27108         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
27109         FREE(untag_ptr(this_ptr));
27110         PaymentSendFailure_free(this_ptr_conv);
27111 }
27112
27113 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
27114         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27115         *ret_copy = PaymentSendFailure_clone(arg);
27116         uint64_t ret_ref = tag_ptr(ret_copy, true);
27117         return ret_ref;
27118 }
27119 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
27120         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
27121         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
27122         return ret_conv;
27123 }
27124
27125 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
27126         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
27127         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27128         *ret_copy = PaymentSendFailure_clone(orig_conv);
27129         uint64_t ret_ref = tag_ptr(ret_copy, true);
27130         return ret_ref;
27131 }
27132
27133 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
27134         void* a_ptr = untag_ptr(a);
27135         CHECK_ACCESS(a_ptr);
27136         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
27137         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
27138         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27139         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
27140         uint64_t ret_ref = tag_ptr(ret_copy, true);
27141         return ret_ref;
27142 }
27143
27144 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
27145         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
27146         a_constr.datalen = a->arr_len;
27147         if (a_constr.datalen > 0)
27148                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
27149         else
27150                 a_constr.data = NULL;
27151         uint64_t* a_vals = a->elems;
27152         for (size_t w = 0; w < a_constr.datalen; w++) {
27153                 uint64_t a_conv_22 = a_vals[w];
27154                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
27155                 CHECK_ACCESS(a_conv_22_ptr);
27156                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
27157                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
27158                 a_constr.data[w] = a_conv_22_conv;
27159         }
27160         FREE(a);
27161         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27162         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
27163         uint64_t ret_ref = tag_ptr(ret_copy, true);
27164         return ret_ref;
27165 }
27166
27167 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
27168         LDKCVec_APIErrorZ a_constr;
27169         a_constr.datalen = a->arr_len;
27170         if (a_constr.datalen > 0)
27171                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
27172         else
27173                 a_constr.data = NULL;
27174         uint64_t* a_vals = a->elems;
27175         for (size_t k = 0; k < a_constr.datalen; k++) {
27176                 uint64_t a_conv_10 = a_vals[k];
27177                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
27178                 CHECK_ACCESS(a_conv_10_ptr);
27179                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
27180                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
27181                 a_constr.data[k] = a_conv_10_conv;
27182         }
27183         FREE(a);
27184         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27185         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
27186         uint64_t ret_ref = tag_ptr(ret_copy, true);
27187         return ret_ref;
27188 }
27189
27190 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) {
27191         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
27192         results_constr.datalen = results->arr_len;
27193         if (results_constr.datalen > 0)
27194                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
27195         else
27196                 results_constr.data = NULL;
27197         uint64_t* results_vals = results->elems;
27198         for (size_t w = 0; w < results_constr.datalen; w++) {
27199                 uint64_t results_conv_22 = results_vals[w];
27200                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
27201                 CHECK_ACCESS(results_conv_22_ptr);
27202                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
27203                 results_constr.data[w] = results_conv_22_conv;
27204         }
27205         FREE(results);
27206         LDKRouteParameters failed_paths_retry_conv;
27207         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
27208         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
27209         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
27210         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
27211         LDKThirtyTwoBytes payment_id_ref;
27212         CHECK(payment_id->arr_len == 32);
27213         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27214         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
27215         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
27216         uint64_t ret_ref = tag_ptr(ret_copy, true);
27217         return ret_ref;
27218 }
27219
27220 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
27221         LDKPhantomRouteHints this_obj_conv;
27222         this_obj_conv.inner = untag_ptr(this_obj);
27223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27225         PhantomRouteHints_free(this_obj_conv);
27226 }
27227
27228 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
27229         LDKPhantomRouteHints this_ptr_conv;
27230         this_ptr_conv.inner = untag_ptr(this_ptr);
27231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27233         this_ptr_conv.is_owned = false;
27234         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
27235         uint64_tArray ret_arr = NULL;
27236         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27237         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27238         for (size_t q = 0; q < ret_var.datalen; q++) {
27239                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27240                 uint64_t ret_conv_16_ref = 0;
27241                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27242                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27243                 ret_arr_ptr[q] = ret_conv_16_ref;
27244         }
27245         
27246         FREE(ret_var.data);
27247         return ret_arr;
27248 }
27249
27250 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
27251         LDKPhantomRouteHints this_ptr_conv;
27252         this_ptr_conv.inner = untag_ptr(this_ptr);
27253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27255         this_ptr_conv.is_owned = false;
27256         LDKCVec_ChannelDetailsZ val_constr;
27257         val_constr.datalen = val->arr_len;
27258         if (val_constr.datalen > 0)
27259                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27260         else
27261                 val_constr.data = NULL;
27262         uint64_t* val_vals = val->elems;
27263         for (size_t q = 0; q < val_constr.datalen; q++) {
27264                 uint64_t val_conv_16 = val_vals[q];
27265                 LDKChannelDetails val_conv_16_conv;
27266                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
27267                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
27268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27269                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
27270                 val_constr.data[q] = val_conv_16_conv;
27271         }
27272         FREE(val);
27273         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
27274 }
27275
27276 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
27277         LDKPhantomRouteHints this_ptr_conv;
27278         this_ptr_conv.inner = untag_ptr(this_ptr);
27279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27281         this_ptr_conv.is_owned = false;
27282         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
27283         return ret_conv;
27284 }
27285
27286 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
27287         LDKPhantomRouteHints this_ptr_conv;
27288         this_ptr_conv.inner = untag_ptr(this_ptr);
27289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27291         this_ptr_conv.is_owned = false;
27292         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
27293 }
27294
27295 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
27296         LDKPhantomRouteHints this_ptr_conv;
27297         this_ptr_conv.inner = untag_ptr(this_ptr);
27298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27300         this_ptr_conv.is_owned = false;
27301         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27302         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
27303         return ret_arr;
27304 }
27305
27306 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
27307         LDKPhantomRouteHints this_ptr_conv;
27308         this_ptr_conv.inner = untag_ptr(this_ptr);
27309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27311         this_ptr_conv.is_owned = false;
27312         LDKPublicKey val_ref;
27313         CHECK(val->arr_len == 33);
27314         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27315         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
27316 }
27317
27318 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) {
27319         LDKCVec_ChannelDetailsZ channels_arg_constr;
27320         channels_arg_constr.datalen = channels_arg->arr_len;
27321         if (channels_arg_constr.datalen > 0)
27322                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27323         else
27324                 channels_arg_constr.data = NULL;
27325         uint64_t* channels_arg_vals = channels_arg->elems;
27326         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
27327                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
27328                 LDKChannelDetails channels_arg_conv_16_conv;
27329                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
27330                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
27331                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
27332                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
27333                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
27334         }
27335         FREE(channels_arg);
27336         LDKPublicKey real_node_pubkey_arg_ref;
27337         CHECK(real_node_pubkey_arg->arr_len == 33);
27338         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
27339         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
27340         uint64_t ret_ref = 0;
27341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27343         return ret_ref;
27344 }
27345
27346 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
27347         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
27348         uint64_t ret_ref = 0;
27349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27351         return ret_ref;
27352 }
27353 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
27354         LDKPhantomRouteHints arg_conv;
27355         arg_conv.inner = untag_ptr(arg);
27356         arg_conv.is_owned = ptr_is_owned(arg);
27357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27358         arg_conv.is_owned = false;
27359         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
27360         return ret_conv;
27361 }
27362
27363 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
27364         LDKPhantomRouteHints orig_conv;
27365         orig_conv.inner = untag_ptr(orig);
27366         orig_conv.is_owned = ptr_is_owned(orig);
27367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27368         orig_conv.is_owned = false;
27369         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
27370         uint64_t ret_ref = 0;
27371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27373         return ret_ref;
27374 }
27375
27376 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) {
27377         void* fee_est_ptr = untag_ptr(fee_est);
27378         CHECK_ACCESS(fee_est_ptr);
27379         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
27380         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
27381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27382                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
27383         }
27384         void* chain_monitor_ptr = untag_ptr(chain_monitor);
27385         CHECK_ACCESS(chain_monitor_ptr);
27386         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27387         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27389                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27390         }
27391         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
27392         CHECK_ACCESS(tx_broadcaster_ptr);
27393         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27394         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27396                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27397         }
27398         void* logger_ptr = untag_ptr(logger);
27399         CHECK_ACCESS(logger_ptr);
27400         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27401         if (logger_conv.free == LDKLogger_JCalls_free) {
27402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27403                 LDKLogger_JCalls_cloned(&logger_conv);
27404         }
27405         void* keys_manager_ptr = untag_ptr(keys_manager);
27406         CHECK_ACCESS(keys_manager_ptr);
27407         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27408         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27410                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27411         }
27412         LDKUserConfig config_conv;
27413         config_conv.inner = untag_ptr(config);
27414         config_conv.is_owned = ptr_is_owned(config);
27415         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27416         config_conv = UserConfig_clone(&config_conv);
27417         LDKChainParameters params_conv;
27418         params_conv.inner = untag_ptr(params);
27419         params_conv.is_owned = ptr_is_owned(params);
27420         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
27421         params_conv = ChainParameters_clone(&params_conv);
27422         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
27423         uint64_t ret_ref = 0;
27424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27426         return ret_ref;
27427 }
27428
27429 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
27430         LDKChannelManager this_arg_conv;
27431         this_arg_conv.inner = untag_ptr(this_arg);
27432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27434         this_arg_conv.is_owned = false;
27435         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
27436         uint64_t ret_ref = 0;
27437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27439         return ret_ref;
27440 }
27441
27442 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) {
27443         LDKChannelManager this_arg_conv;
27444         this_arg_conv.inner = untag_ptr(this_arg);
27445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27447         this_arg_conv.is_owned = false;
27448         LDKPublicKey their_network_key_ref;
27449         CHECK(their_network_key->arr_len == 33);
27450         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
27451         LDKUserConfig override_config_conv;
27452         override_config_conv.inner = untag_ptr(override_config);
27453         override_config_conv.is_owned = ptr_is_owned(override_config);
27454         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
27455         override_config_conv = UserConfig_clone(&override_config_conv);
27456         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
27457         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
27458         return tag_ptr(ret_conv, true);
27459 }
27460
27461 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
27462         LDKChannelManager this_arg_conv;
27463         this_arg_conv.inner = untag_ptr(this_arg);
27464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27466         this_arg_conv.is_owned = false;
27467         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
27468         uint64_tArray ret_arr = NULL;
27469         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27470         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27471         for (size_t q = 0; q < ret_var.datalen; q++) {
27472                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27473                 uint64_t ret_conv_16_ref = 0;
27474                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27475                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27476                 ret_arr_ptr[q] = ret_conv_16_ref;
27477         }
27478         
27479         FREE(ret_var.data);
27480         return ret_arr;
27481 }
27482
27483 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
27484         LDKChannelManager this_arg_conv;
27485         this_arg_conv.inner = untag_ptr(this_arg);
27486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27488         this_arg_conv.is_owned = false;
27489         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
27490         uint64_tArray ret_arr = NULL;
27491         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27492         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27493         for (size_t q = 0; q < ret_var.datalen; q++) {
27494                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27495                 uint64_t ret_conv_16_ref = 0;
27496                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27497                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27498                 ret_arr_ptr[q] = ret_conv_16_ref;
27499         }
27500         
27501         FREE(ret_var.data);
27502         return ret_arr;
27503 }
27504
27505 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) {
27506         LDKChannelManager this_arg_conv;
27507         this_arg_conv.inner = untag_ptr(this_arg);
27508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27510         this_arg_conv.is_owned = false;
27511         unsigned char channel_id_arr[32];
27512         CHECK(channel_id->arr_len == 32);
27513         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27514         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27515         LDKPublicKey counterparty_node_id_ref;
27516         CHECK(counterparty_node_id->arr_len == 33);
27517         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27518         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27519         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27520         return tag_ptr(ret_conv, true);
27521 }
27522
27523 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) {
27524         LDKChannelManager this_arg_conv;
27525         this_arg_conv.inner = untag_ptr(this_arg);
27526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27528         this_arg_conv.is_owned = false;
27529         unsigned char channel_id_arr[32];
27530         CHECK(channel_id->arr_len == 32);
27531         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27532         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27533         LDKPublicKey counterparty_node_id_ref;
27534         CHECK(counterparty_node_id->arr_len == 33);
27535         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27536         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27537         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
27538         return tag_ptr(ret_conv, true);
27539 }
27540
27541 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) {
27542         LDKChannelManager this_arg_conv;
27543         this_arg_conv.inner = untag_ptr(this_arg);
27544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27546         this_arg_conv.is_owned = false;
27547         unsigned char channel_id_arr[32];
27548         CHECK(channel_id->arr_len == 32);
27549         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27550         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27551         LDKPublicKey counterparty_node_id_ref;
27552         CHECK(counterparty_node_id->arr_len == 33);
27553         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27554         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27555         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27556         return tag_ptr(ret_conv, true);
27557 }
27558
27559 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) {
27560         LDKChannelManager this_arg_conv;
27561         this_arg_conv.inner = untag_ptr(this_arg);
27562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27564         this_arg_conv.is_owned = false;
27565         unsigned char channel_id_arr[32];
27566         CHECK(channel_id->arr_len == 32);
27567         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27568         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27569         LDKPublicKey counterparty_node_id_ref;
27570         CHECK(counterparty_node_id->arr_len == 33);
27571         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27572         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27573         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27574         return tag_ptr(ret_conv, true);
27575 }
27576
27577 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) {
27578         LDKChannelManager this_arg_conv;
27579         this_arg_conv.inner = untag_ptr(this_arg);
27580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27582         this_arg_conv.is_owned = false;
27583         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
27584 }
27585
27586 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) {
27587         LDKChannelManager this_arg_conv;
27588         this_arg_conv.inner = untag_ptr(this_arg);
27589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27591         this_arg_conv.is_owned = false;
27592         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
27593 }
27594
27595 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) {
27596         LDKChannelManager this_arg_conv;
27597         this_arg_conv.inner = untag_ptr(this_arg);
27598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27600         this_arg_conv.is_owned = false;
27601         LDKRoute route_conv;
27602         route_conv.inner = untag_ptr(route);
27603         route_conv.is_owned = ptr_is_owned(route);
27604         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27605         route_conv.is_owned = false;
27606         LDKThirtyTwoBytes payment_hash_ref;
27607         CHECK(payment_hash->arr_len == 32);
27608         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27609         LDKThirtyTwoBytes payment_secret_ref;
27610         CHECK(payment_secret->arr_len == 32);
27611         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27612         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27613         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27614         return tag_ptr(ret_conv, true);
27615 }
27616
27617 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
27618         LDKChannelManager this_arg_conv;
27619         this_arg_conv.inner = untag_ptr(this_arg);
27620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27622         this_arg_conv.is_owned = false;
27623         LDKRoute route_conv;
27624         route_conv.inner = untag_ptr(route);
27625         route_conv.is_owned = ptr_is_owned(route);
27626         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27627         route_conv.is_owned = false;
27628         LDKThirtyTwoBytes payment_id_ref;
27629         CHECK(payment_id->arr_len == 32);
27630         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27631         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27632         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27633         return tag_ptr(ret_conv, true);
27634 }
27635
27636 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
27637         LDKChannelManager this_arg_conv;
27638         this_arg_conv.inner = untag_ptr(this_arg);
27639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27641         this_arg_conv.is_owned = false;
27642         LDKThirtyTwoBytes payment_id_ref;
27643         CHECK(payment_id->arr_len == 32);
27644         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27645         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27646 }
27647
27648 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) {
27649         LDKChannelManager this_arg_conv;
27650         this_arg_conv.inner = untag_ptr(this_arg);
27651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27653         this_arg_conv.is_owned = false;
27654         LDKRoute route_conv;
27655         route_conv.inner = untag_ptr(route);
27656         route_conv.is_owned = ptr_is_owned(route);
27657         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27658         route_conv.is_owned = false;
27659         LDKThirtyTwoBytes payment_preimage_ref;
27660         CHECK(payment_preimage->arr_len == 32);
27661         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27662         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27663         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27664         return tag_ptr(ret_conv, true);
27665 }
27666
27667 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
27668         LDKChannelManager this_arg_conv;
27669         this_arg_conv.inner = untag_ptr(this_arg);
27670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27672         this_arg_conv.is_owned = false;
27673         LDKCVec_RouteHopZ hops_constr;
27674         hops_constr.datalen = hops->arr_len;
27675         if (hops_constr.datalen > 0)
27676                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27677         else
27678                 hops_constr.data = NULL;
27679         uint64_t* hops_vals = hops->elems;
27680         for (size_t k = 0; k < hops_constr.datalen; k++) {
27681                 uint64_t hops_conv_10 = hops_vals[k];
27682                 LDKRouteHop hops_conv_10_conv;
27683                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
27684                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
27685                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
27686                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
27687                 hops_constr.data[k] = hops_conv_10_conv;
27688         }
27689         FREE(hops);
27690         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27691         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
27692         return tag_ptr(ret_conv, true);
27693 }
27694
27695 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) {
27696         LDKChannelManager this_arg_conv;
27697         this_arg_conv.inner = untag_ptr(this_arg);
27698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27700         this_arg_conv.is_owned = false;
27701         unsigned char temporary_channel_id_arr[32];
27702         CHECK(temporary_channel_id->arr_len == 32);
27703         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27704         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27705         LDKPublicKey counterparty_node_id_ref;
27706         CHECK(counterparty_node_id->arr_len == 33);
27707         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27708         LDKTransaction funding_transaction_ref;
27709         funding_transaction_ref.datalen = funding_transaction->arr_len;
27710         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27711         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
27712         funding_transaction_ref.data_is_owned = true;
27713         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27714         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
27715         return tag_ptr(ret_conv, true);
27716 }
27717
27718 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) {
27719         LDKChannelManager this_arg_conv;
27720         this_arg_conv.inner = untag_ptr(this_arg);
27721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27723         this_arg_conv.is_owned = false;
27724         LDKPublicKey counterparty_node_id_ref;
27725         CHECK(counterparty_node_id->arr_len == 33);
27726         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27727         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
27728         channel_ids_constr.datalen = channel_ids->arr_len;
27729         if (channel_ids_constr.datalen > 0)
27730                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
27731         else
27732                 channel_ids_constr.data = NULL;
27733         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
27734         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
27735                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
27736                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
27737                 CHECK(channel_ids_conv_12->arr_len == 32);
27738                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
27739                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
27740         }
27741         FREE(channel_ids);
27742         LDKChannelConfig config_conv;
27743         config_conv.inner = untag_ptr(config);
27744         config_conv.is_owned = ptr_is_owned(config);
27745         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27746         config_conv.is_owned = false;
27747         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27748         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
27749         return tag_ptr(ret_conv, true);
27750 }
27751
27752 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
27753         LDKChannelManager this_arg_conv;
27754         this_arg_conv.inner = untag_ptr(this_arg);
27755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27757         this_arg_conv.is_owned = false;
27758         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27759 }
27760
27761 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
27762         LDKChannelManager this_arg_conv;
27763         this_arg_conv.inner = untag_ptr(this_arg);
27764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27766         this_arg_conv.is_owned = false;
27767         ChannelManager_timer_tick_occurred(&this_arg_conv);
27768 }
27769
27770 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
27771         LDKChannelManager this_arg_conv;
27772         this_arg_conv.inner = untag_ptr(this_arg);
27773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27775         this_arg_conv.is_owned = false;
27776         unsigned char payment_hash_arr[32];
27777         CHECK(payment_hash->arr_len == 32);
27778         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
27779         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27780         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27781 }
27782
27783 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
27784         LDKChannelManager this_arg_conv;
27785         this_arg_conv.inner = untag_ptr(this_arg);
27786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27788         this_arg_conv.is_owned = false;
27789         LDKThirtyTwoBytes payment_preimage_ref;
27790         CHECK(payment_preimage->arr_len == 32);
27791         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27792         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27793 }
27794
27795 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
27796         LDKChannelManager this_arg_conv;
27797         this_arg_conv.inner = untag_ptr(this_arg);
27798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27800         this_arg_conv.is_owned = false;
27801         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27802         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
27803         return ret_arr;
27804 }
27805
27806 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) {
27807         LDKChannelManager this_arg_conv;
27808         this_arg_conv.inner = untag_ptr(this_arg);
27809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27811         this_arg_conv.is_owned = false;
27812         unsigned char temporary_channel_id_arr[32];
27813         CHECK(temporary_channel_id->arr_len == 32);
27814         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27815         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27816         LDKPublicKey counterparty_node_id_ref;
27817         CHECK(counterparty_node_id->arr_len == 33);
27818         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27819         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27820         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27821         return tag_ptr(ret_conv, true);
27822 }
27823
27824 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) {
27825         LDKChannelManager this_arg_conv;
27826         this_arg_conv.inner = untag_ptr(this_arg);
27827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27829         this_arg_conv.is_owned = false;
27830         unsigned char temporary_channel_id_arr[32];
27831         CHECK(temporary_channel_id->arr_len == 32);
27832         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27833         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27834         LDKPublicKey counterparty_node_id_ref;
27835         CHECK(counterparty_node_id->arr_len == 33);
27836         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27837         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27838         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27839         return tag_ptr(ret_conv, true);
27840 }
27841
27842 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) {
27843         LDKChannelManager this_arg_conv;
27844         this_arg_conv.inner = untag_ptr(this_arg);
27845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27847         this_arg_conv.is_owned = false;
27848         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27849         CHECK_ACCESS(min_value_msat_ptr);
27850         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27851         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27852         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27853         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27854         return tag_ptr(ret_conv, true);
27855 }
27856
27857 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) {
27858         LDKChannelManager this_arg_conv;
27859         this_arg_conv.inner = untag_ptr(this_arg);
27860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27862         this_arg_conv.is_owned = false;
27863         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27864         CHECK_ACCESS(min_value_msat_ptr);
27865         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27866         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27867         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27868         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27869         return tag_ptr(ret_conv, true);
27870 }
27871
27872 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) {
27873         LDKChannelManager this_arg_conv;
27874         this_arg_conv.inner = untag_ptr(this_arg);
27875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27877         this_arg_conv.is_owned = false;
27878         LDKThirtyTwoBytes payment_hash_ref;
27879         CHECK(payment_hash->arr_len == 32);
27880         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27881         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27882         CHECK_ACCESS(min_value_msat_ptr);
27883         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27884         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27885         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27886         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27887         return tag_ptr(ret_conv, true);
27888 }
27889
27890 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) {
27891         LDKChannelManager this_arg_conv;
27892         this_arg_conv.inner = untag_ptr(this_arg);
27893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27895         this_arg_conv.is_owned = false;
27896         LDKThirtyTwoBytes payment_hash_ref;
27897         CHECK(payment_hash->arr_len == 32);
27898         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27899         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27900         CHECK_ACCESS(min_value_msat_ptr);
27901         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27902         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27903         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27904         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27905         return tag_ptr(ret_conv, true);
27906 }
27907
27908 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) {
27909         LDKChannelManager this_arg_conv;
27910         this_arg_conv.inner = untag_ptr(this_arg);
27911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27913         this_arg_conv.is_owned = false;
27914         LDKThirtyTwoBytes payment_hash_ref;
27915         CHECK(payment_hash->arr_len == 32);
27916         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27917         LDKThirtyTwoBytes payment_secret_ref;
27918         CHECK(payment_secret->arr_len == 32);
27919         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27920         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27921         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27922         return tag_ptr(ret_conv, true);
27923 }
27924
27925 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
27926         LDKChannelManager this_arg_conv;
27927         this_arg_conv.inner = untag_ptr(this_arg);
27928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27930         this_arg_conv.is_owned = false;
27931         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
27932         return ret_conv;
27933 }
27934
27935 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
27936         LDKChannelManager this_arg_conv;
27937         this_arg_conv.inner = untag_ptr(this_arg);
27938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27940         this_arg_conv.is_owned = false;
27941         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
27942         uint64_t ret_ref = 0;
27943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27945         return ret_ref;
27946 }
27947
27948 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
27949         LDKChannelManager this_arg_conv;
27950         this_arg_conv.inner = untag_ptr(this_arg);
27951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27953         this_arg_conv.is_owned = false;
27954         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27955         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27956         return tag_ptr(ret_ret, true);
27957 }
27958
27959 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
27960         LDKChannelManager this_arg_conv;
27961         this_arg_conv.inner = untag_ptr(this_arg);
27962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27964         this_arg_conv.is_owned = false;
27965         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27966         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27967         return tag_ptr(ret_ret, true);
27968 }
27969
27970 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
27971         LDKChannelManager this_arg_conv;
27972         this_arg_conv.inner = untag_ptr(this_arg);
27973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27975         this_arg_conv.is_owned = false;
27976         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27977         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27978         return tag_ptr(ret_ret, true);
27979 }
27980
27981 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
27982         LDKChannelManager this_arg_conv;
27983         this_arg_conv.inner = untag_ptr(this_arg);
27984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27986         this_arg_conv.is_owned = false;
27987         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27988         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27989         return tag_ptr(ret_ret, true);
27990 }
27991
27992 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
27993         LDKChannelManager this_arg_conv;
27994         this_arg_conv.inner = untag_ptr(this_arg);
27995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27997         this_arg_conv.is_owned = false;
27998         ChannelManager_await_persistable_update(&this_arg_conv);
27999 }
28000
28001 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
28002         LDKChannelManager this_arg_conv;
28003         this_arg_conv.inner = untag_ptr(this_arg);
28004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28006         this_arg_conv.is_owned = false;
28007         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
28008         uint64_t ret_ref = 0;
28009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28011         return ret_ref;
28012 }
28013
28014 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
28015         LDKChannelManager this_arg_conv;
28016         this_arg_conv.inner = untag_ptr(this_arg);
28017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28019         this_arg_conv.is_owned = false;
28020         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
28021         uint64_t ret_ref = 0;
28022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28024         return ret_ref;
28025 }
28026
28027 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
28028         LDKChannelManager this_arg_conv;
28029         this_arg_conv.inner = untag_ptr(this_arg);
28030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28032         this_arg_conv.is_owned = false;
28033         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28034         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
28035         return tag_ptr(ret_ret, true);
28036 }
28037
28038 uint64_t  __attribute__((export_name("TS_provided_node_features"))) TS_provided_node_features() {
28039         LDKNodeFeatures ret_var = provided_node_features();
28040         uint64_t ret_ref = 0;
28041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28043         return ret_ref;
28044 }
28045
28046 uint64_t  __attribute__((export_name("TS_provided_channel_features"))) TS_provided_channel_features() {
28047         LDKChannelFeatures ret_var = provided_channel_features();
28048         uint64_t ret_ref = 0;
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28051         return ret_ref;
28052 }
28053
28054 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features() {
28055         LDKInitFeatures ret_var = provided_init_features();
28056         uint64_t ret_ref = 0;
28057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28059         return ret_ref;
28060 }
28061
28062 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
28063         LDKCounterpartyForwardingInfo obj_conv;
28064         obj_conv.inner = untag_ptr(obj);
28065         obj_conv.is_owned = ptr_is_owned(obj);
28066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28067         obj_conv.is_owned = false;
28068         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
28069         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28070         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28071         CVec_u8Z_free(ret_var);
28072         return ret_arr;
28073 }
28074
28075 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
28076         LDKu8slice ser_ref;
28077         ser_ref.datalen = ser->arr_len;
28078         ser_ref.data = ser->elems;
28079         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28080         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
28081         FREE(ser);
28082         return tag_ptr(ret_conv, true);
28083 }
28084
28085 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
28086         LDKChannelCounterparty obj_conv;
28087         obj_conv.inner = untag_ptr(obj);
28088         obj_conv.is_owned = ptr_is_owned(obj);
28089         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28090         obj_conv.is_owned = false;
28091         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
28092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28094         CVec_u8Z_free(ret_var);
28095         return ret_arr;
28096 }
28097
28098 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
28099         LDKu8slice ser_ref;
28100         ser_ref.datalen = ser->arr_len;
28101         ser_ref.data = ser->elems;
28102         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28103         *ret_conv = ChannelCounterparty_read(ser_ref);
28104         FREE(ser);
28105         return tag_ptr(ret_conv, true);
28106 }
28107
28108 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
28109         LDKChannelDetails obj_conv;
28110         obj_conv.inner = untag_ptr(obj);
28111         obj_conv.is_owned = ptr_is_owned(obj);
28112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28113         obj_conv.is_owned = false;
28114         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
28115         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28116         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28117         CVec_u8Z_free(ret_var);
28118         return ret_arr;
28119 }
28120
28121 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
28122         LDKu8slice ser_ref;
28123         ser_ref.datalen = ser->arr_len;
28124         ser_ref.data = ser->elems;
28125         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28126         *ret_conv = ChannelDetails_read(ser_ref);
28127         FREE(ser);
28128         return tag_ptr(ret_conv, true);
28129 }
28130
28131 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
28132         LDKPhantomRouteHints obj_conv;
28133         obj_conv.inner = untag_ptr(obj);
28134         obj_conv.is_owned = ptr_is_owned(obj);
28135         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28136         obj_conv.is_owned = false;
28137         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
28138         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28139         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28140         CVec_u8Z_free(ret_var);
28141         return ret_arr;
28142 }
28143
28144 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
28145         LDKu8slice ser_ref;
28146         ser_ref.datalen = ser->arr_len;
28147         ser_ref.data = ser->elems;
28148         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28149         *ret_conv = PhantomRouteHints_read(ser_ref);
28150         FREE(ser);
28151         return tag_ptr(ret_conv, true);
28152 }
28153
28154 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
28155         LDKChannelManager obj_conv;
28156         obj_conv.inner = untag_ptr(obj);
28157         obj_conv.is_owned = ptr_is_owned(obj);
28158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28159         obj_conv.is_owned = false;
28160         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
28161         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28162         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28163         CVec_u8Z_free(ret_var);
28164         return ret_arr;
28165 }
28166
28167 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
28168         LDKChannelManagerReadArgs this_obj_conv;
28169         this_obj_conv.inner = untag_ptr(this_obj);
28170         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28172         ChannelManagerReadArgs_free(this_obj_conv);
28173 }
28174
28175 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
28176         LDKChannelManagerReadArgs this_ptr_conv;
28177         this_ptr_conv.inner = untag_ptr(this_ptr);
28178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28180         this_ptr_conv.is_owned = false;
28181         // WARNING: This object doesn't live past this scope, needs clone!
28182         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
28183         return ret_ret;
28184 }
28185
28186 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
28187         LDKChannelManagerReadArgs this_ptr_conv;
28188         this_ptr_conv.inner = untag_ptr(this_ptr);
28189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28191         this_ptr_conv.is_owned = false;
28192         void* val_ptr = untag_ptr(val);
28193         CHECK_ACCESS(val_ptr);
28194         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
28195         if (val_conv.free == LDKKeysInterface_JCalls_free) {
28196                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28197                 LDKKeysInterface_JCalls_cloned(&val_conv);
28198         }
28199         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
28200 }
28201
28202 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
28203         LDKChannelManagerReadArgs this_ptr_conv;
28204         this_ptr_conv.inner = untag_ptr(this_ptr);
28205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28207         this_ptr_conv.is_owned = false;
28208         // WARNING: This object doesn't live past this scope, needs clone!
28209         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
28210         return ret_ret;
28211 }
28212
28213 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
28214         LDKChannelManagerReadArgs this_ptr_conv;
28215         this_ptr_conv.inner = untag_ptr(this_ptr);
28216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28218         this_ptr_conv.is_owned = false;
28219         void* val_ptr = untag_ptr(val);
28220         CHECK_ACCESS(val_ptr);
28221         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
28222         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
28223                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28224                 LDKFeeEstimator_JCalls_cloned(&val_conv);
28225         }
28226         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
28227 }
28228
28229 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
28230         LDKChannelManagerReadArgs this_ptr_conv;
28231         this_ptr_conv.inner = untag_ptr(this_ptr);
28232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28234         this_ptr_conv.is_owned = false;
28235         // WARNING: This object doesn't live past this scope, needs clone!
28236         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
28237         return ret_ret;
28238 }
28239
28240 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
28241         LDKChannelManagerReadArgs this_ptr_conv;
28242         this_ptr_conv.inner = untag_ptr(this_ptr);
28243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28245         this_ptr_conv.is_owned = false;
28246         void* val_ptr = untag_ptr(val);
28247         CHECK_ACCESS(val_ptr);
28248         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
28249         if (val_conv.free == LDKWatch_JCalls_free) {
28250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28251                 LDKWatch_JCalls_cloned(&val_conv);
28252         }
28253         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
28254 }
28255
28256 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
28257         LDKChannelManagerReadArgs this_ptr_conv;
28258         this_ptr_conv.inner = untag_ptr(this_ptr);
28259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28261         this_ptr_conv.is_owned = false;
28262         // WARNING: This object doesn't live past this scope, needs clone!
28263         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
28264         return ret_ret;
28265 }
28266
28267 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
28268         LDKChannelManagerReadArgs this_ptr_conv;
28269         this_ptr_conv.inner = untag_ptr(this_ptr);
28270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28272         this_ptr_conv.is_owned = false;
28273         void* val_ptr = untag_ptr(val);
28274         CHECK_ACCESS(val_ptr);
28275         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
28276         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
28277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28278                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
28279         }
28280         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
28281 }
28282
28283 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
28284         LDKChannelManagerReadArgs this_ptr_conv;
28285         this_ptr_conv.inner = untag_ptr(this_ptr);
28286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28288         this_ptr_conv.is_owned = false;
28289         // WARNING: This object doesn't live past this scope, needs clone!
28290         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
28291         return ret_ret;
28292 }
28293
28294 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
28295         LDKChannelManagerReadArgs this_ptr_conv;
28296         this_ptr_conv.inner = untag_ptr(this_ptr);
28297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28299         this_ptr_conv.is_owned = false;
28300         void* val_ptr = untag_ptr(val);
28301         CHECK_ACCESS(val_ptr);
28302         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
28303         if (val_conv.free == LDKLogger_JCalls_free) {
28304                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28305                 LDKLogger_JCalls_cloned(&val_conv);
28306         }
28307         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
28308 }
28309
28310 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
28311         LDKChannelManagerReadArgs this_ptr_conv;
28312         this_ptr_conv.inner = untag_ptr(this_ptr);
28313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28315         this_ptr_conv.is_owned = false;
28316         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
28317         uint64_t ret_ref = 0;
28318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28320         return ret_ref;
28321 }
28322
28323 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
28324         LDKChannelManagerReadArgs this_ptr_conv;
28325         this_ptr_conv.inner = untag_ptr(this_ptr);
28326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28328         this_ptr_conv.is_owned = false;
28329         LDKUserConfig val_conv;
28330         val_conv.inner = untag_ptr(val);
28331         val_conv.is_owned = ptr_is_owned(val);
28332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28333         val_conv = UserConfig_clone(&val_conv);
28334         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
28335 }
28336
28337 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) {
28338         void* keys_manager_ptr = untag_ptr(keys_manager);
28339         CHECK_ACCESS(keys_manager_ptr);
28340         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28341         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28343                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28344         }
28345         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28346         CHECK_ACCESS(fee_estimator_ptr);
28347         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28348         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28349                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28350                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28351         }
28352         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28353         CHECK_ACCESS(chain_monitor_ptr);
28354         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28355         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28357                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28358         }
28359         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28360         CHECK_ACCESS(tx_broadcaster_ptr);
28361         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28362         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28363                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28364                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28365         }
28366         void* logger_ptr = untag_ptr(logger);
28367         CHECK_ACCESS(logger_ptr);
28368         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28369         if (logger_conv.free == LDKLogger_JCalls_free) {
28370                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28371                 LDKLogger_JCalls_cloned(&logger_conv);
28372         }
28373         LDKUserConfig default_config_conv;
28374         default_config_conv.inner = untag_ptr(default_config);
28375         default_config_conv.is_owned = ptr_is_owned(default_config);
28376         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
28377         default_config_conv = UserConfig_clone(&default_config_conv);
28378         LDKCVec_ChannelMonitorZ channel_monitors_constr;
28379         channel_monitors_constr.datalen = channel_monitors->arr_len;
28380         if (channel_monitors_constr.datalen > 0)
28381                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28382         else
28383                 channel_monitors_constr.data = NULL;
28384         uint64_t* channel_monitors_vals = channel_monitors->elems;
28385         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
28386                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
28387                 LDKChannelMonitor channel_monitors_conv_16_conv;
28388                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
28389                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
28390                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
28391                 channel_monitors_conv_16_conv.is_owned = false;
28392                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
28393         }
28394         FREE(channel_monitors);
28395         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);
28396         uint64_t ret_ref = 0;
28397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28399         return ret_ref;
28400 }
28401
28402 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
28403         LDKu8slice ser_ref;
28404         ser_ref.datalen = ser->arr_len;
28405         ser_ref.data = ser->elems;
28406         LDKChannelManagerReadArgs arg_conv;
28407         arg_conv.inner = untag_ptr(arg);
28408         arg_conv.is_owned = ptr_is_owned(arg);
28409         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28410         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
28411         
28412         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
28413         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
28414         FREE(ser);
28415         return tag_ptr(ret_conv, true);
28416 }
28417
28418 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
28419         LDKExpandedKey this_obj_conv;
28420         this_obj_conv.inner = untag_ptr(this_obj);
28421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28423         ExpandedKey_free(this_obj_conv);
28424 }
28425
28426 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
28427         unsigned char key_material_arr[32];
28428         CHECK(key_material->arr_len == 32);
28429         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
28430         unsigned char (*key_material_ref)[32] = &key_material_arr;
28431         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
28432         uint64_t ret_ref = 0;
28433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28435         return ret_ref;
28436 }
28437
28438 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) {
28439         LDKExpandedKey keys_conv;
28440         keys_conv.inner = untag_ptr(keys);
28441         keys_conv.is_owned = ptr_is_owned(keys);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28443         keys_conv.is_owned = false;
28444         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28445         CHECK_ACCESS(min_value_msat_ptr);
28446         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28447         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28448         void* keys_manager_ptr = untag_ptr(keys_manager);
28449         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
28450         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
28451         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28452         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
28453         return tag_ptr(ret_conv, true);
28454 }
28455
28456 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) {
28457         LDKExpandedKey keys_conv;
28458         keys_conv.inner = untag_ptr(keys);
28459         keys_conv.is_owned = ptr_is_owned(keys);
28460         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28461         keys_conv.is_owned = false;
28462         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28463         CHECK_ACCESS(min_value_msat_ptr);
28464         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28465         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28466         LDKThirtyTwoBytes payment_hash_ref;
28467         CHECK(payment_hash->arr_len == 32);
28468         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28469         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28470         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
28471         return tag_ptr(ret_conv, true);
28472 }
28473
28474 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
28475         if (!ptr_is_owned(this_ptr)) return;
28476         void* this_ptr_ptr = untag_ptr(this_ptr);
28477         CHECK_ACCESS(this_ptr_ptr);
28478         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
28479         FREE(untag_ptr(this_ptr));
28480         DecodeError_free(this_ptr_conv);
28481 }
28482
28483 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
28484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28485         *ret_copy = DecodeError_clone(arg);
28486         uint64_t ret_ref = tag_ptr(ret_copy, true);
28487         return ret_ref;
28488 }
28489 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
28490         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
28491         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
28492         return ret_conv;
28493 }
28494
28495 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
28496         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
28497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28498         *ret_copy = DecodeError_clone(orig_conv);
28499         uint64_t ret_ref = tag_ptr(ret_copy, true);
28500         return ret_ref;
28501 }
28502
28503 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
28504         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28505         *ret_copy = DecodeError_unknown_version();
28506         uint64_t ret_ref = tag_ptr(ret_copy, true);
28507         return ret_ref;
28508 }
28509
28510 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
28511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28512         *ret_copy = DecodeError_unknown_required_feature();
28513         uint64_t ret_ref = tag_ptr(ret_copy, true);
28514         return ret_ref;
28515 }
28516
28517 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
28518         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28519         *ret_copy = DecodeError_invalid_value();
28520         uint64_t ret_ref = tag_ptr(ret_copy, true);
28521         return ret_ref;
28522 }
28523
28524 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
28525         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28526         *ret_copy = DecodeError_short_read();
28527         uint64_t ret_ref = tag_ptr(ret_copy, true);
28528         return ret_ref;
28529 }
28530
28531 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
28532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28533         *ret_copy = DecodeError_bad_length_descriptor();
28534         uint64_t ret_ref = tag_ptr(ret_copy, true);
28535         return ret_ref;
28536 }
28537
28538 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
28539         LDKIOError a_conv = LDKIOError_from_js(a);
28540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28541         *ret_copy = DecodeError_io(a_conv);
28542         uint64_t ret_ref = tag_ptr(ret_copy, true);
28543         return ret_ref;
28544 }
28545
28546 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
28547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
28548         *ret_copy = DecodeError_unsupported_compression();
28549         uint64_t ret_ref = tag_ptr(ret_copy, true);
28550         return ret_ref;
28551 }
28552
28553 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
28554         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
28555         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
28556         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
28557         return ret_conv;
28558 }
28559
28560 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
28561         LDKInit this_obj_conv;
28562         this_obj_conv.inner = untag_ptr(this_obj);
28563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28565         Init_free(this_obj_conv);
28566 }
28567
28568 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
28569         LDKInit this_ptr_conv;
28570         this_ptr_conv.inner = untag_ptr(this_ptr);
28571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28573         this_ptr_conv.is_owned = false;
28574         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
28575         uint64_t ret_ref = 0;
28576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28578         return ret_ref;
28579 }
28580
28581 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
28582         LDKInit this_ptr_conv;
28583         this_ptr_conv.inner = untag_ptr(this_ptr);
28584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28586         this_ptr_conv.is_owned = false;
28587         LDKInitFeatures val_conv;
28588         val_conv.inner = untag_ptr(val);
28589         val_conv.is_owned = ptr_is_owned(val);
28590         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28591         val_conv = InitFeatures_clone(&val_conv);
28592         Init_set_features(&this_ptr_conv, val_conv);
28593 }
28594
28595 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
28596         LDKInit this_ptr_conv;
28597         this_ptr_conv.inner = untag_ptr(this_ptr);
28598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28600         this_ptr_conv.is_owned = false;
28601         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
28602         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
28603         uint64_t ret_ref = tag_ptr(ret_copy, true);
28604         return ret_ref;
28605 }
28606
28607 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
28608         LDKInit this_ptr_conv;
28609         this_ptr_conv.inner = untag_ptr(this_ptr);
28610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28612         this_ptr_conv.is_owned = false;
28613         void* val_ptr = untag_ptr(val);
28614         CHECK_ACCESS(val_ptr);
28615         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
28616         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
28617         Init_set_remote_network_address(&this_ptr_conv, val_conv);
28618 }
28619
28620 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
28621         LDKInitFeatures features_arg_conv;
28622         features_arg_conv.inner = untag_ptr(features_arg);
28623         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28624         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28625         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28626         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
28627         CHECK_ACCESS(remote_network_address_arg_ptr);
28628         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
28629         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
28630         uint64_t ret_ref = 0;
28631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28633         return ret_ref;
28634 }
28635
28636 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
28637         LDKInit ret_var = Init_clone(arg);
28638         uint64_t ret_ref = 0;
28639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28641         return ret_ref;
28642 }
28643 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
28644         LDKInit arg_conv;
28645         arg_conv.inner = untag_ptr(arg);
28646         arg_conv.is_owned = ptr_is_owned(arg);
28647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28648         arg_conv.is_owned = false;
28649         int64_t ret_conv = Init_clone_ptr(&arg_conv);
28650         return ret_conv;
28651 }
28652
28653 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
28654         LDKInit orig_conv;
28655         orig_conv.inner = untag_ptr(orig);
28656         orig_conv.is_owned = ptr_is_owned(orig);
28657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28658         orig_conv.is_owned = false;
28659         LDKInit ret_var = Init_clone(&orig_conv);
28660         uint64_t ret_ref = 0;
28661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28663         return ret_ref;
28664 }
28665
28666 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
28667         LDKInit a_conv;
28668         a_conv.inner = untag_ptr(a);
28669         a_conv.is_owned = ptr_is_owned(a);
28670         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28671         a_conv.is_owned = false;
28672         LDKInit b_conv;
28673         b_conv.inner = untag_ptr(b);
28674         b_conv.is_owned = ptr_is_owned(b);
28675         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28676         b_conv.is_owned = false;
28677         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
28678         return ret_conv;
28679 }
28680
28681 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
28682         LDKErrorMessage this_obj_conv;
28683         this_obj_conv.inner = untag_ptr(this_obj);
28684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28686         ErrorMessage_free(this_obj_conv);
28687 }
28688
28689 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
28690         LDKErrorMessage this_ptr_conv;
28691         this_ptr_conv.inner = untag_ptr(this_ptr);
28692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28694         this_ptr_conv.is_owned = false;
28695         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28696         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
28697         return ret_arr;
28698 }
28699
28700 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28701         LDKErrorMessage this_ptr_conv;
28702         this_ptr_conv.inner = untag_ptr(this_ptr);
28703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28705         this_ptr_conv.is_owned = false;
28706         LDKThirtyTwoBytes val_ref;
28707         CHECK(val->arr_len == 32);
28708         memcpy(val_ref.data, val->elems, 32); FREE(val);
28709         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
28710 }
28711
28712 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
28713         LDKErrorMessage this_ptr_conv;
28714         this_ptr_conv.inner = untag_ptr(this_ptr);
28715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28717         this_ptr_conv.is_owned = false;
28718         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
28719         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28720         Str_free(ret_str);
28721         return ret_conv;
28722 }
28723
28724 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
28725         LDKErrorMessage this_ptr_conv;
28726         this_ptr_conv.inner = untag_ptr(this_ptr);
28727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28729         this_ptr_conv.is_owned = false;
28730         LDKStr val_conv = str_ref_to_owned_c(val);
28731         ErrorMessage_set_data(&this_ptr_conv, val_conv);
28732 }
28733
28734 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28735         LDKThirtyTwoBytes channel_id_arg_ref;
28736         CHECK(channel_id_arg->arr_len == 32);
28737         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28738         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28739         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
28740         uint64_t ret_ref = 0;
28741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28743         return ret_ref;
28744 }
28745
28746 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
28747         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
28748         uint64_t ret_ref = 0;
28749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28751         return ret_ref;
28752 }
28753 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
28754         LDKErrorMessage arg_conv;
28755         arg_conv.inner = untag_ptr(arg);
28756         arg_conv.is_owned = ptr_is_owned(arg);
28757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28758         arg_conv.is_owned = false;
28759         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
28760         return ret_conv;
28761 }
28762
28763 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
28764         LDKErrorMessage orig_conv;
28765         orig_conv.inner = untag_ptr(orig);
28766         orig_conv.is_owned = ptr_is_owned(orig);
28767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28768         orig_conv.is_owned = false;
28769         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
28770         uint64_t ret_ref = 0;
28771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28773         return ret_ref;
28774 }
28775
28776 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
28777         LDKErrorMessage a_conv;
28778         a_conv.inner = untag_ptr(a);
28779         a_conv.is_owned = ptr_is_owned(a);
28780         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28781         a_conv.is_owned = false;
28782         LDKErrorMessage b_conv;
28783         b_conv.inner = untag_ptr(b);
28784         b_conv.is_owned = ptr_is_owned(b);
28785         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28786         b_conv.is_owned = false;
28787         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
28788         return ret_conv;
28789 }
28790
28791 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
28792         LDKWarningMessage this_obj_conv;
28793         this_obj_conv.inner = untag_ptr(this_obj);
28794         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28796         WarningMessage_free(this_obj_conv);
28797 }
28798
28799 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
28800         LDKWarningMessage this_ptr_conv;
28801         this_ptr_conv.inner = untag_ptr(this_ptr);
28802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28804         this_ptr_conv.is_owned = false;
28805         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28806         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
28807         return ret_arr;
28808 }
28809
28810 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28811         LDKWarningMessage this_ptr_conv;
28812         this_ptr_conv.inner = untag_ptr(this_ptr);
28813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28815         this_ptr_conv.is_owned = false;
28816         LDKThirtyTwoBytes val_ref;
28817         CHECK(val->arr_len == 32);
28818         memcpy(val_ref.data, val->elems, 32); FREE(val);
28819         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
28820 }
28821
28822 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
28823         LDKWarningMessage this_ptr_conv;
28824         this_ptr_conv.inner = untag_ptr(this_ptr);
28825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28827         this_ptr_conv.is_owned = false;
28828         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
28829         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28830         Str_free(ret_str);
28831         return ret_conv;
28832 }
28833
28834 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
28835         LDKWarningMessage this_ptr_conv;
28836         this_ptr_conv.inner = untag_ptr(this_ptr);
28837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839         this_ptr_conv.is_owned = false;
28840         LDKStr val_conv = str_ref_to_owned_c(val);
28841         WarningMessage_set_data(&this_ptr_conv, val_conv);
28842 }
28843
28844 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28845         LDKThirtyTwoBytes channel_id_arg_ref;
28846         CHECK(channel_id_arg->arr_len == 32);
28847         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28848         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28849         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
28850         uint64_t ret_ref = 0;
28851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28853         return ret_ref;
28854 }
28855
28856 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
28857         LDKWarningMessage ret_var = WarningMessage_clone(arg);
28858         uint64_t ret_ref = 0;
28859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28861         return ret_ref;
28862 }
28863 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
28864         LDKWarningMessage arg_conv;
28865         arg_conv.inner = untag_ptr(arg);
28866         arg_conv.is_owned = ptr_is_owned(arg);
28867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28868         arg_conv.is_owned = false;
28869         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
28870         return ret_conv;
28871 }
28872
28873 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
28874         LDKWarningMessage orig_conv;
28875         orig_conv.inner = untag_ptr(orig);
28876         orig_conv.is_owned = ptr_is_owned(orig);
28877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28878         orig_conv.is_owned = false;
28879         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
28880         uint64_t ret_ref = 0;
28881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28883         return ret_ref;
28884 }
28885
28886 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
28887         LDKWarningMessage a_conv;
28888         a_conv.inner = untag_ptr(a);
28889         a_conv.is_owned = ptr_is_owned(a);
28890         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28891         a_conv.is_owned = false;
28892         LDKWarningMessage b_conv;
28893         b_conv.inner = untag_ptr(b);
28894         b_conv.is_owned = ptr_is_owned(b);
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28896         b_conv.is_owned = false;
28897         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
28898         return ret_conv;
28899 }
28900
28901 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
28902         LDKPing this_obj_conv;
28903         this_obj_conv.inner = untag_ptr(this_obj);
28904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28906         Ping_free(this_obj_conv);
28907 }
28908
28909 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
28910         LDKPing this_ptr_conv;
28911         this_ptr_conv.inner = untag_ptr(this_ptr);
28912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28914         this_ptr_conv.is_owned = false;
28915         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
28916         return ret_conv;
28917 }
28918
28919 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
28920         LDKPing this_ptr_conv;
28921         this_ptr_conv.inner = untag_ptr(this_ptr);
28922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28924         this_ptr_conv.is_owned = false;
28925         Ping_set_ponglen(&this_ptr_conv, val);
28926 }
28927
28928 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
28929         LDKPing this_ptr_conv;
28930         this_ptr_conv.inner = untag_ptr(this_ptr);
28931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28933         this_ptr_conv.is_owned = false;
28934         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
28935         return ret_conv;
28936 }
28937
28938 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
28939         LDKPing this_ptr_conv;
28940         this_ptr_conv.inner = untag_ptr(this_ptr);
28941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28943         this_ptr_conv.is_owned = false;
28944         Ping_set_byteslen(&this_ptr_conv, val);
28945 }
28946
28947 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
28948         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
28949         uint64_t ret_ref = 0;
28950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28952         return ret_ref;
28953 }
28954
28955 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
28956         LDKPing ret_var = Ping_clone(arg);
28957         uint64_t ret_ref = 0;
28958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28960         return ret_ref;
28961 }
28962 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
28963         LDKPing arg_conv;
28964         arg_conv.inner = untag_ptr(arg);
28965         arg_conv.is_owned = ptr_is_owned(arg);
28966         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28967         arg_conv.is_owned = false;
28968         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
28969         return ret_conv;
28970 }
28971
28972 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
28973         LDKPing orig_conv;
28974         orig_conv.inner = untag_ptr(orig);
28975         orig_conv.is_owned = ptr_is_owned(orig);
28976         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28977         orig_conv.is_owned = false;
28978         LDKPing ret_var = Ping_clone(&orig_conv);
28979         uint64_t ret_ref = 0;
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28982         return ret_ref;
28983 }
28984
28985 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
28986         LDKPing a_conv;
28987         a_conv.inner = untag_ptr(a);
28988         a_conv.is_owned = ptr_is_owned(a);
28989         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28990         a_conv.is_owned = false;
28991         LDKPing b_conv;
28992         b_conv.inner = untag_ptr(b);
28993         b_conv.is_owned = ptr_is_owned(b);
28994         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28995         b_conv.is_owned = false;
28996         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
28997         return ret_conv;
28998 }
28999
29000 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
29001         LDKPong this_obj_conv;
29002         this_obj_conv.inner = untag_ptr(this_obj);
29003         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29005         Pong_free(this_obj_conv);
29006 }
29007
29008 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
29009         LDKPong this_ptr_conv;
29010         this_ptr_conv.inner = untag_ptr(this_ptr);
29011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29013         this_ptr_conv.is_owned = false;
29014         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
29015         return ret_conv;
29016 }
29017
29018 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
29019         LDKPong this_ptr_conv;
29020         this_ptr_conv.inner = untag_ptr(this_ptr);
29021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29023         this_ptr_conv.is_owned = false;
29024         Pong_set_byteslen(&this_ptr_conv, val);
29025 }
29026
29027 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
29028         LDKPong ret_var = Pong_new(byteslen_arg);
29029         uint64_t ret_ref = 0;
29030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29032         return ret_ref;
29033 }
29034
29035 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
29036         LDKPong ret_var = Pong_clone(arg);
29037         uint64_t ret_ref = 0;
29038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29040         return ret_ref;
29041 }
29042 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
29043         LDKPong arg_conv;
29044         arg_conv.inner = untag_ptr(arg);
29045         arg_conv.is_owned = ptr_is_owned(arg);
29046         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29047         arg_conv.is_owned = false;
29048         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
29049         return ret_conv;
29050 }
29051
29052 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
29053         LDKPong orig_conv;
29054         orig_conv.inner = untag_ptr(orig);
29055         orig_conv.is_owned = ptr_is_owned(orig);
29056         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29057         orig_conv.is_owned = false;
29058         LDKPong ret_var = Pong_clone(&orig_conv);
29059         uint64_t ret_ref = 0;
29060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29062         return ret_ref;
29063 }
29064
29065 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
29066         LDKPong a_conv;
29067         a_conv.inner = untag_ptr(a);
29068         a_conv.is_owned = ptr_is_owned(a);
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29070         a_conv.is_owned = false;
29071         LDKPong b_conv;
29072         b_conv.inner = untag_ptr(b);
29073         b_conv.is_owned = ptr_is_owned(b);
29074         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29075         b_conv.is_owned = false;
29076         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
29077         return ret_conv;
29078 }
29079
29080 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
29081         LDKOpenChannel this_obj_conv;
29082         this_obj_conv.inner = untag_ptr(this_obj);
29083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29085         OpenChannel_free(this_obj_conv);
29086 }
29087
29088 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
29089         LDKOpenChannel this_ptr_conv;
29090         this_ptr_conv.inner = untag_ptr(this_ptr);
29091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29093         this_ptr_conv.is_owned = false;
29094         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29095         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
29096         return ret_arr;
29097 }
29098
29099 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
29100         LDKOpenChannel this_ptr_conv;
29101         this_ptr_conv.inner = untag_ptr(this_ptr);
29102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29104         this_ptr_conv.is_owned = false;
29105         LDKThirtyTwoBytes val_ref;
29106         CHECK(val->arr_len == 32);
29107         memcpy(val_ref.data, val->elems, 32); FREE(val);
29108         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
29109 }
29110
29111 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
29112         LDKOpenChannel this_ptr_conv;
29113         this_ptr_conv.inner = untag_ptr(this_ptr);
29114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29116         this_ptr_conv.is_owned = false;
29117         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29118         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29119         return ret_arr;
29120 }
29121
29122 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29123         LDKOpenChannel this_ptr_conv;
29124         this_ptr_conv.inner = untag_ptr(this_ptr);
29125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29127         this_ptr_conv.is_owned = false;
29128         LDKThirtyTwoBytes val_ref;
29129         CHECK(val->arr_len == 32);
29130         memcpy(val_ref.data, val->elems, 32); FREE(val);
29131         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29132 }
29133
29134 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
29135         LDKOpenChannel this_ptr_conv;
29136         this_ptr_conv.inner = untag_ptr(this_ptr);
29137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29139         this_ptr_conv.is_owned = false;
29140         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
29141         return ret_conv;
29142 }
29143
29144 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
29145         LDKOpenChannel this_ptr_conv;
29146         this_ptr_conv.inner = untag_ptr(this_ptr);
29147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29149         this_ptr_conv.is_owned = false;
29150         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
29151 }
29152
29153 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
29154         LDKOpenChannel this_ptr_conv;
29155         this_ptr_conv.inner = untag_ptr(this_ptr);
29156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29158         this_ptr_conv.is_owned = false;
29159         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
29160         return ret_conv;
29161 }
29162
29163 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
29164         LDKOpenChannel this_ptr_conv;
29165         this_ptr_conv.inner = untag_ptr(this_ptr);
29166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29168         this_ptr_conv.is_owned = false;
29169         OpenChannel_set_push_msat(&this_ptr_conv, val);
29170 }
29171
29172 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29173         LDKOpenChannel this_ptr_conv;
29174         this_ptr_conv.inner = untag_ptr(this_ptr);
29175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29177         this_ptr_conv.is_owned = false;
29178         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
29179         return ret_conv;
29180 }
29181
29182 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29183         LDKOpenChannel this_ptr_conv;
29184         this_ptr_conv.inner = untag_ptr(this_ptr);
29185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29187         this_ptr_conv.is_owned = false;
29188         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29189 }
29190
29191 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) {
29192         LDKOpenChannel this_ptr_conv;
29193         this_ptr_conv.inner = untag_ptr(this_ptr);
29194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29196         this_ptr_conv.is_owned = false;
29197         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29198         return ret_conv;
29199 }
29200
29201 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) {
29202         LDKOpenChannel this_ptr_conv;
29203         this_ptr_conv.inner = untag_ptr(this_ptr);
29204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29206         this_ptr_conv.is_owned = false;
29207         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29208 }
29209
29210 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29211         LDKOpenChannel this_ptr_conv;
29212         this_ptr_conv.inner = untag_ptr(this_ptr);
29213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29215         this_ptr_conv.is_owned = false;
29216         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29217         return ret_conv;
29218 }
29219
29220 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29221         LDKOpenChannel this_ptr_conv;
29222         this_ptr_conv.inner = untag_ptr(this_ptr);
29223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29225         this_ptr_conv.is_owned = false;
29226         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29227 }
29228
29229 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29230         LDKOpenChannel this_ptr_conv;
29231         this_ptr_conv.inner = untag_ptr(this_ptr);
29232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29234         this_ptr_conv.is_owned = false;
29235         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
29236         return ret_conv;
29237 }
29238
29239 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29240         LDKOpenChannel this_ptr_conv;
29241         this_ptr_conv.inner = untag_ptr(this_ptr);
29242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29244         this_ptr_conv.is_owned = false;
29245         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29246 }
29247
29248 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
29249         LDKOpenChannel this_ptr_conv;
29250         this_ptr_conv.inner = untag_ptr(this_ptr);
29251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29253         this_ptr_conv.is_owned = false;
29254         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
29255         return ret_conv;
29256 }
29257
29258 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
29259         LDKOpenChannel this_ptr_conv;
29260         this_ptr_conv.inner = untag_ptr(this_ptr);
29261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29263         this_ptr_conv.is_owned = false;
29264         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
29265 }
29266
29267 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
29268         LDKOpenChannel this_ptr_conv;
29269         this_ptr_conv.inner = untag_ptr(this_ptr);
29270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29272         this_ptr_conv.is_owned = false;
29273         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
29274         return ret_conv;
29275 }
29276
29277 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29278         LDKOpenChannel this_ptr_conv;
29279         this_ptr_conv.inner = untag_ptr(this_ptr);
29280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29282         this_ptr_conv.is_owned = false;
29283         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
29284 }
29285
29286 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29287         LDKOpenChannel this_ptr_conv;
29288         this_ptr_conv.inner = untag_ptr(this_ptr);
29289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29291         this_ptr_conv.is_owned = false;
29292         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
29293         return ret_conv;
29294 }
29295
29296 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29297         LDKOpenChannel this_ptr_conv;
29298         this_ptr_conv.inner = untag_ptr(this_ptr);
29299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29301         this_ptr_conv.is_owned = false;
29302         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29303 }
29304
29305 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
29306         LDKOpenChannel this_ptr_conv;
29307         this_ptr_conv.inner = untag_ptr(this_ptr);
29308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29310         this_ptr_conv.is_owned = false;
29311         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29312         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29313         return ret_arr;
29314 }
29315
29316 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29317         LDKOpenChannel this_ptr_conv;
29318         this_ptr_conv.inner = untag_ptr(this_ptr);
29319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29321         this_ptr_conv.is_owned = false;
29322         LDKPublicKey val_ref;
29323         CHECK(val->arr_len == 33);
29324         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29325         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29326 }
29327
29328 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
29329         LDKOpenChannel this_ptr_conv;
29330         this_ptr_conv.inner = untag_ptr(this_ptr);
29331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29333         this_ptr_conv.is_owned = false;
29334         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29335         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29336         return ret_arr;
29337 }
29338
29339 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29340         LDKOpenChannel this_ptr_conv;
29341         this_ptr_conv.inner = untag_ptr(this_ptr);
29342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29344         this_ptr_conv.is_owned = false;
29345         LDKPublicKey val_ref;
29346         CHECK(val->arr_len == 33);
29347         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29348         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29349 }
29350
29351 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
29352         LDKOpenChannel this_ptr_conv;
29353         this_ptr_conv.inner = untag_ptr(this_ptr);
29354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29356         this_ptr_conv.is_owned = false;
29357         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29358         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29359         return ret_arr;
29360 }
29361
29362 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29363         LDKOpenChannel this_ptr_conv;
29364         this_ptr_conv.inner = untag_ptr(this_ptr);
29365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29367         this_ptr_conv.is_owned = false;
29368         LDKPublicKey val_ref;
29369         CHECK(val->arr_len == 33);
29370         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29371         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
29372 }
29373
29374 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29375         LDKOpenChannel this_ptr_conv;
29376         this_ptr_conv.inner = untag_ptr(this_ptr);
29377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29379         this_ptr_conv.is_owned = false;
29380         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29381         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29382         return ret_arr;
29383 }
29384
29385 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29386         LDKOpenChannel this_ptr_conv;
29387         this_ptr_conv.inner = untag_ptr(this_ptr);
29388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29390         this_ptr_conv.is_owned = false;
29391         LDKPublicKey val_ref;
29392         CHECK(val->arr_len == 33);
29393         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29394         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29395 }
29396
29397 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
29398         LDKOpenChannel this_ptr_conv;
29399         this_ptr_conv.inner = untag_ptr(this_ptr);
29400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29402         this_ptr_conv.is_owned = false;
29403         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29404         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29405         return ret_arr;
29406 }
29407
29408 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29409         LDKOpenChannel this_ptr_conv;
29410         this_ptr_conv.inner = untag_ptr(this_ptr);
29411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29413         this_ptr_conv.is_owned = false;
29414         LDKPublicKey val_ref;
29415         CHECK(val->arr_len == 33);
29416         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29417         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29418 }
29419
29420 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29421         LDKOpenChannel this_ptr_conv;
29422         this_ptr_conv.inner = untag_ptr(this_ptr);
29423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29425         this_ptr_conv.is_owned = false;
29426         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29427         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29428         return ret_arr;
29429 }
29430
29431 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) {
29432         LDKOpenChannel this_ptr_conv;
29433         this_ptr_conv.inner = untag_ptr(this_ptr);
29434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29436         this_ptr_conv.is_owned = false;
29437         LDKPublicKey val_ref;
29438         CHECK(val->arr_len == 33);
29439         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29440         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29441 }
29442
29443 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
29444         LDKOpenChannel this_ptr_conv;
29445         this_ptr_conv.inner = untag_ptr(this_ptr);
29446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29448         this_ptr_conv.is_owned = false;
29449         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
29450         return ret_conv;
29451 }
29452
29453 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
29454         LDKOpenChannel this_ptr_conv;
29455         this_ptr_conv.inner = untag_ptr(this_ptr);
29456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29458         this_ptr_conv.is_owned = false;
29459         OpenChannel_set_channel_flags(&this_ptr_conv, val);
29460 }
29461
29462 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
29463         LDKOpenChannel this_ptr_conv;
29464         this_ptr_conv.inner = untag_ptr(this_ptr);
29465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29467         this_ptr_conv.is_owned = false;
29468         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
29469         uint64_t ret_ref = 0;
29470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29472         return ret_ref;
29473 }
29474
29475 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29476         LDKOpenChannel this_ptr_conv;
29477         this_ptr_conv.inner = untag_ptr(this_ptr);
29478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29480         this_ptr_conv.is_owned = false;
29481         LDKChannelTypeFeatures val_conv;
29482         val_conv.inner = untag_ptr(val);
29483         val_conv.is_owned = ptr_is_owned(val);
29484         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29485         val_conv = ChannelTypeFeatures_clone(&val_conv);
29486         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
29487 }
29488
29489 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
29490         LDKOpenChannel ret_var = OpenChannel_clone(arg);
29491         uint64_t ret_ref = 0;
29492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29494         return ret_ref;
29495 }
29496 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
29497         LDKOpenChannel arg_conv;
29498         arg_conv.inner = untag_ptr(arg);
29499         arg_conv.is_owned = ptr_is_owned(arg);
29500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29501         arg_conv.is_owned = false;
29502         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
29503         return ret_conv;
29504 }
29505
29506 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
29507         LDKOpenChannel orig_conv;
29508         orig_conv.inner = untag_ptr(orig);
29509         orig_conv.is_owned = ptr_is_owned(orig);
29510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29511         orig_conv.is_owned = false;
29512         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
29513         uint64_t ret_ref = 0;
29514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29516         return ret_ref;
29517 }
29518
29519 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
29520         LDKOpenChannel a_conv;
29521         a_conv.inner = untag_ptr(a);
29522         a_conv.is_owned = ptr_is_owned(a);
29523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29524         a_conv.is_owned = false;
29525         LDKOpenChannel b_conv;
29526         b_conv.inner = untag_ptr(b);
29527         b_conv.is_owned = ptr_is_owned(b);
29528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29529         b_conv.is_owned = false;
29530         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
29531         return ret_conv;
29532 }
29533
29534 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
29535         LDKAcceptChannel this_obj_conv;
29536         this_obj_conv.inner = untag_ptr(this_obj);
29537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29539         AcceptChannel_free(this_obj_conv);
29540 }
29541
29542 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
29543         LDKAcceptChannel this_ptr_conv;
29544         this_ptr_conv.inner = untag_ptr(this_ptr);
29545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29547         this_ptr_conv.is_owned = false;
29548         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29549         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29550         return ret_arr;
29551 }
29552
29553 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29554         LDKAcceptChannel this_ptr_conv;
29555         this_ptr_conv.inner = untag_ptr(this_ptr);
29556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29558         this_ptr_conv.is_owned = false;
29559         LDKThirtyTwoBytes val_ref;
29560         CHECK(val->arr_len == 32);
29561         memcpy(val_ref.data, val->elems, 32); FREE(val);
29562         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29563 }
29564
29565 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29566         LDKAcceptChannel this_ptr_conv;
29567         this_ptr_conv.inner = untag_ptr(this_ptr);
29568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29570         this_ptr_conv.is_owned = false;
29571         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
29572         return ret_conv;
29573 }
29574
29575 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29576         LDKAcceptChannel this_ptr_conv;
29577         this_ptr_conv.inner = untag_ptr(this_ptr);
29578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29580         this_ptr_conv.is_owned = false;
29581         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29582 }
29583
29584 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) {
29585         LDKAcceptChannel this_ptr_conv;
29586         this_ptr_conv.inner = untag_ptr(this_ptr);
29587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29589         this_ptr_conv.is_owned = false;
29590         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29591         return ret_conv;
29592 }
29593
29594 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) {
29595         LDKAcceptChannel this_ptr_conv;
29596         this_ptr_conv.inner = untag_ptr(this_ptr);
29597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29599         this_ptr_conv.is_owned = false;
29600         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29601 }
29602
29603 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29604         LDKAcceptChannel this_ptr_conv;
29605         this_ptr_conv.inner = untag_ptr(this_ptr);
29606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29608         this_ptr_conv.is_owned = false;
29609         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29610         return ret_conv;
29611 }
29612
29613 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29614         LDKAcceptChannel this_ptr_conv;
29615         this_ptr_conv.inner = untag_ptr(this_ptr);
29616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29618         this_ptr_conv.is_owned = false;
29619         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29620 }
29621
29622 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29623         LDKAcceptChannel this_ptr_conv;
29624         this_ptr_conv.inner = untag_ptr(this_ptr);
29625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29627         this_ptr_conv.is_owned = false;
29628         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
29629         return ret_conv;
29630 }
29631
29632 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29633         LDKAcceptChannel this_ptr_conv;
29634         this_ptr_conv.inner = untag_ptr(this_ptr);
29635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29637         this_ptr_conv.is_owned = false;
29638         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29639 }
29640
29641 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
29642         LDKAcceptChannel this_ptr_conv;
29643         this_ptr_conv.inner = untag_ptr(this_ptr);
29644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29646         this_ptr_conv.is_owned = false;
29647         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
29648         return ret_conv;
29649 }
29650
29651 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
29652         LDKAcceptChannel this_ptr_conv;
29653         this_ptr_conv.inner = untag_ptr(this_ptr);
29654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29656         this_ptr_conv.is_owned = false;
29657         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
29658 }
29659
29660 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
29661         LDKAcceptChannel this_ptr_conv;
29662         this_ptr_conv.inner = untag_ptr(this_ptr);
29663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29665         this_ptr_conv.is_owned = false;
29666         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
29667         return ret_conv;
29668 }
29669
29670 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29671         LDKAcceptChannel this_ptr_conv;
29672         this_ptr_conv.inner = untag_ptr(this_ptr);
29673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29675         this_ptr_conv.is_owned = false;
29676         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
29677 }
29678
29679 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29680         LDKAcceptChannel this_ptr_conv;
29681         this_ptr_conv.inner = untag_ptr(this_ptr);
29682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29684         this_ptr_conv.is_owned = false;
29685         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
29686         return ret_conv;
29687 }
29688
29689 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29690         LDKAcceptChannel this_ptr_conv;
29691         this_ptr_conv.inner = untag_ptr(this_ptr);
29692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29694         this_ptr_conv.is_owned = false;
29695         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29696 }
29697
29698 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
29699         LDKAcceptChannel this_ptr_conv;
29700         this_ptr_conv.inner = untag_ptr(this_ptr);
29701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29703         this_ptr_conv.is_owned = false;
29704         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29705         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29706         return ret_arr;
29707 }
29708
29709 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29710         LDKAcceptChannel this_ptr_conv;
29711         this_ptr_conv.inner = untag_ptr(this_ptr);
29712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29714         this_ptr_conv.is_owned = false;
29715         LDKPublicKey val_ref;
29716         CHECK(val->arr_len == 33);
29717         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29718         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29719 }
29720
29721 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
29722         LDKAcceptChannel this_ptr_conv;
29723         this_ptr_conv.inner = untag_ptr(this_ptr);
29724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29726         this_ptr_conv.is_owned = false;
29727         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29728         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29729         return ret_arr;
29730 }
29731
29732 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29733         LDKAcceptChannel this_ptr_conv;
29734         this_ptr_conv.inner = untag_ptr(this_ptr);
29735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29737         this_ptr_conv.is_owned = false;
29738         LDKPublicKey val_ref;
29739         CHECK(val->arr_len == 33);
29740         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29741         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29742 }
29743
29744 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
29745         LDKAcceptChannel this_ptr_conv;
29746         this_ptr_conv.inner = untag_ptr(this_ptr);
29747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29749         this_ptr_conv.is_owned = false;
29750         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29751         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29752         return ret_arr;
29753 }
29754
29755 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29756         LDKAcceptChannel this_ptr_conv;
29757         this_ptr_conv.inner = untag_ptr(this_ptr);
29758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29760         this_ptr_conv.is_owned = false;
29761         LDKPublicKey val_ref;
29762         CHECK(val->arr_len == 33);
29763         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29764         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
29765 }
29766
29767 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29768         LDKAcceptChannel this_ptr_conv;
29769         this_ptr_conv.inner = untag_ptr(this_ptr);
29770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29772         this_ptr_conv.is_owned = false;
29773         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29774         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29775         return ret_arr;
29776 }
29777
29778 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29779         LDKAcceptChannel this_ptr_conv;
29780         this_ptr_conv.inner = untag_ptr(this_ptr);
29781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29783         this_ptr_conv.is_owned = false;
29784         LDKPublicKey val_ref;
29785         CHECK(val->arr_len == 33);
29786         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29787         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29788 }
29789
29790 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
29791         LDKAcceptChannel this_ptr_conv;
29792         this_ptr_conv.inner = untag_ptr(this_ptr);
29793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29795         this_ptr_conv.is_owned = false;
29796         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29797         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29798         return ret_arr;
29799 }
29800
29801 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29802         LDKAcceptChannel this_ptr_conv;
29803         this_ptr_conv.inner = untag_ptr(this_ptr);
29804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29806         this_ptr_conv.is_owned = false;
29807         LDKPublicKey val_ref;
29808         CHECK(val->arr_len == 33);
29809         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29810         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29811 }
29812
29813 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29814         LDKAcceptChannel this_ptr_conv;
29815         this_ptr_conv.inner = untag_ptr(this_ptr);
29816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29818         this_ptr_conv.is_owned = false;
29819         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29820         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29821         return ret_arr;
29822 }
29823
29824 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) {
29825         LDKAcceptChannel this_ptr_conv;
29826         this_ptr_conv.inner = untag_ptr(this_ptr);
29827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29829         this_ptr_conv.is_owned = false;
29830         LDKPublicKey val_ref;
29831         CHECK(val->arr_len == 33);
29832         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29833         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29834 }
29835
29836 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
29837         LDKAcceptChannel this_ptr_conv;
29838         this_ptr_conv.inner = untag_ptr(this_ptr);
29839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29841         this_ptr_conv.is_owned = false;
29842         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
29843         uint64_t ret_ref = 0;
29844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29846         return ret_ref;
29847 }
29848
29849 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29850         LDKAcceptChannel this_ptr_conv;
29851         this_ptr_conv.inner = untag_ptr(this_ptr);
29852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29854         this_ptr_conv.is_owned = false;
29855         LDKChannelTypeFeatures val_conv;
29856         val_conv.inner = untag_ptr(val);
29857         val_conv.is_owned = ptr_is_owned(val);
29858         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29859         val_conv = ChannelTypeFeatures_clone(&val_conv);
29860         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
29861 }
29862
29863 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
29864         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
29865         uint64_t ret_ref = 0;
29866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29868         return ret_ref;
29869 }
29870 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
29871         LDKAcceptChannel arg_conv;
29872         arg_conv.inner = untag_ptr(arg);
29873         arg_conv.is_owned = ptr_is_owned(arg);
29874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29875         arg_conv.is_owned = false;
29876         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
29877         return ret_conv;
29878 }
29879
29880 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
29881         LDKAcceptChannel orig_conv;
29882         orig_conv.inner = untag_ptr(orig);
29883         orig_conv.is_owned = ptr_is_owned(orig);
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29885         orig_conv.is_owned = false;
29886         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
29887         uint64_t ret_ref = 0;
29888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29890         return ret_ref;
29891 }
29892
29893 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
29894         LDKAcceptChannel a_conv;
29895         a_conv.inner = untag_ptr(a);
29896         a_conv.is_owned = ptr_is_owned(a);
29897         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29898         a_conv.is_owned = false;
29899         LDKAcceptChannel b_conv;
29900         b_conv.inner = untag_ptr(b);
29901         b_conv.is_owned = ptr_is_owned(b);
29902         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29903         b_conv.is_owned = false;
29904         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
29905         return ret_conv;
29906 }
29907
29908 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
29909         LDKFundingCreated this_obj_conv;
29910         this_obj_conv.inner = untag_ptr(this_obj);
29911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29913         FundingCreated_free(this_obj_conv);
29914 }
29915
29916 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
29917         LDKFundingCreated this_ptr_conv;
29918         this_ptr_conv.inner = untag_ptr(this_ptr);
29919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29921         this_ptr_conv.is_owned = false;
29922         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29923         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
29924         return ret_arr;
29925 }
29926
29927 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29928         LDKFundingCreated this_ptr_conv;
29929         this_ptr_conv.inner = untag_ptr(this_ptr);
29930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29932         this_ptr_conv.is_owned = false;
29933         LDKThirtyTwoBytes val_ref;
29934         CHECK(val->arr_len == 32);
29935         memcpy(val_ref.data, val->elems, 32); FREE(val);
29936         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
29937 }
29938
29939 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
29940         LDKFundingCreated this_ptr_conv;
29941         this_ptr_conv.inner = untag_ptr(this_ptr);
29942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29944         this_ptr_conv.is_owned = false;
29945         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29946         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
29947         return ret_arr;
29948 }
29949
29950 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
29951         LDKFundingCreated this_ptr_conv;
29952         this_ptr_conv.inner = untag_ptr(this_ptr);
29953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29955         this_ptr_conv.is_owned = false;
29956         LDKThirtyTwoBytes val_ref;
29957         CHECK(val->arr_len == 32);
29958         memcpy(val_ref.data, val->elems, 32); FREE(val);
29959         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
29960 }
29961
29962 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
29963         LDKFundingCreated this_ptr_conv;
29964         this_ptr_conv.inner = untag_ptr(this_ptr);
29965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29967         this_ptr_conv.is_owned = false;
29968         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
29969         return ret_conv;
29970 }
29971
29972 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
29973         LDKFundingCreated this_ptr_conv;
29974         this_ptr_conv.inner = untag_ptr(this_ptr);
29975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29977         this_ptr_conv.is_owned = false;
29978         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
29979 }
29980
29981 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
29982         LDKFundingCreated this_ptr_conv;
29983         this_ptr_conv.inner = untag_ptr(this_ptr);
29984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29986         this_ptr_conv.is_owned = false;
29987         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29988         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
29989         return ret_arr;
29990 }
29991
29992 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
29993         LDKFundingCreated this_ptr_conv;
29994         this_ptr_conv.inner = untag_ptr(this_ptr);
29995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29997         this_ptr_conv.is_owned = false;
29998         LDKSignature val_ref;
29999         CHECK(val->arr_len == 64);
30000         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30001         FundingCreated_set_signature(&this_ptr_conv, val_ref);
30002 }
30003
30004 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) {
30005         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
30006         CHECK(temporary_channel_id_arg->arr_len == 32);
30007         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
30008         LDKThirtyTwoBytes funding_txid_arg_ref;
30009         CHECK(funding_txid_arg->arr_len == 32);
30010         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
30011         LDKSignature signature_arg_ref;
30012         CHECK(signature_arg->arr_len == 64);
30013         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30014         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
30015         uint64_t ret_ref = 0;
30016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30018         return ret_ref;
30019 }
30020
30021 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
30022         LDKFundingCreated ret_var = FundingCreated_clone(arg);
30023         uint64_t ret_ref = 0;
30024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30026         return ret_ref;
30027 }
30028 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
30029         LDKFundingCreated arg_conv;
30030         arg_conv.inner = untag_ptr(arg);
30031         arg_conv.is_owned = ptr_is_owned(arg);
30032         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30033         arg_conv.is_owned = false;
30034         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
30035         return ret_conv;
30036 }
30037
30038 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
30039         LDKFundingCreated orig_conv;
30040         orig_conv.inner = untag_ptr(orig);
30041         orig_conv.is_owned = ptr_is_owned(orig);
30042         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30043         orig_conv.is_owned = false;
30044         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
30045         uint64_t ret_ref = 0;
30046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30048         return ret_ref;
30049 }
30050
30051 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
30052         LDKFundingCreated a_conv;
30053         a_conv.inner = untag_ptr(a);
30054         a_conv.is_owned = ptr_is_owned(a);
30055         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30056         a_conv.is_owned = false;
30057         LDKFundingCreated b_conv;
30058         b_conv.inner = untag_ptr(b);
30059         b_conv.is_owned = ptr_is_owned(b);
30060         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30061         b_conv.is_owned = false;
30062         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
30063         return ret_conv;
30064 }
30065
30066 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
30067         LDKFundingSigned this_obj_conv;
30068         this_obj_conv.inner = untag_ptr(this_obj);
30069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30071         FundingSigned_free(this_obj_conv);
30072 }
30073
30074 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
30075         LDKFundingSigned this_ptr_conv;
30076         this_ptr_conv.inner = untag_ptr(this_ptr);
30077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30079         this_ptr_conv.is_owned = false;
30080         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30081         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
30082         return ret_arr;
30083 }
30084
30085 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30086         LDKFundingSigned this_ptr_conv;
30087         this_ptr_conv.inner = untag_ptr(this_ptr);
30088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30090         this_ptr_conv.is_owned = false;
30091         LDKThirtyTwoBytes val_ref;
30092         CHECK(val->arr_len == 32);
30093         memcpy(val_ref.data, val->elems, 32); FREE(val);
30094         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
30095 }
30096
30097 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
30098         LDKFundingSigned this_ptr_conv;
30099         this_ptr_conv.inner = untag_ptr(this_ptr);
30100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30102         this_ptr_conv.is_owned = false;
30103         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30104         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30105         return ret_arr;
30106 }
30107
30108 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30109         LDKFundingSigned this_ptr_conv;
30110         this_ptr_conv.inner = untag_ptr(this_ptr);
30111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30113         this_ptr_conv.is_owned = false;
30114         LDKSignature val_ref;
30115         CHECK(val->arr_len == 64);
30116         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30117         FundingSigned_set_signature(&this_ptr_conv, val_ref);
30118 }
30119
30120 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
30121         LDKThirtyTwoBytes channel_id_arg_ref;
30122         CHECK(channel_id_arg->arr_len == 32);
30123         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30124         LDKSignature signature_arg_ref;
30125         CHECK(signature_arg->arr_len == 64);
30126         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30127         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
30128         uint64_t ret_ref = 0;
30129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30131         return ret_ref;
30132 }
30133
30134 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
30135         LDKFundingSigned ret_var = FundingSigned_clone(arg);
30136         uint64_t ret_ref = 0;
30137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30139         return ret_ref;
30140 }
30141 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
30142         LDKFundingSigned arg_conv;
30143         arg_conv.inner = untag_ptr(arg);
30144         arg_conv.is_owned = ptr_is_owned(arg);
30145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30146         arg_conv.is_owned = false;
30147         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
30148         return ret_conv;
30149 }
30150
30151 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
30152         LDKFundingSigned orig_conv;
30153         orig_conv.inner = untag_ptr(orig);
30154         orig_conv.is_owned = ptr_is_owned(orig);
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30156         orig_conv.is_owned = false;
30157         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
30158         uint64_t ret_ref = 0;
30159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30161         return ret_ref;
30162 }
30163
30164 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
30165         LDKFundingSigned a_conv;
30166         a_conv.inner = untag_ptr(a);
30167         a_conv.is_owned = ptr_is_owned(a);
30168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30169         a_conv.is_owned = false;
30170         LDKFundingSigned b_conv;
30171         b_conv.inner = untag_ptr(b);
30172         b_conv.is_owned = ptr_is_owned(b);
30173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30174         b_conv.is_owned = false;
30175         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
30176         return ret_conv;
30177 }
30178
30179 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
30180         LDKChannelReady this_obj_conv;
30181         this_obj_conv.inner = untag_ptr(this_obj);
30182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30184         ChannelReady_free(this_obj_conv);
30185 }
30186
30187 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
30188         LDKChannelReady this_ptr_conv;
30189         this_ptr_conv.inner = untag_ptr(this_ptr);
30190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30192         this_ptr_conv.is_owned = false;
30193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30194         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
30195         return ret_arr;
30196 }
30197
30198 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30199         LDKChannelReady this_ptr_conv;
30200         this_ptr_conv.inner = untag_ptr(this_ptr);
30201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30203         this_ptr_conv.is_owned = false;
30204         LDKThirtyTwoBytes val_ref;
30205         CHECK(val->arr_len == 32);
30206         memcpy(val_ref.data, val->elems, 32); FREE(val);
30207         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
30208 }
30209
30210 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
30211         LDKChannelReady this_ptr_conv;
30212         this_ptr_conv.inner = untag_ptr(this_ptr);
30213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30215         this_ptr_conv.is_owned = false;
30216         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30217         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30218         return ret_arr;
30219 }
30220
30221 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) {
30222         LDKChannelReady this_ptr_conv;
30223         this_ptr_conv.inner = untag_ptr(this_ptr);
30224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30226         this_ptr_conv.is_owned = false;
30227         LDKPublicKey val_ref;
30228         CHECK(val->arr_len == 33);
30229         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30230         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30231 }
30232
30233 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
30234         LDKChannelReady this_ptr_conv;
30235         this_ptr_conv.inner = untag_ptr(this_ptr);
30236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30238         this_ptr_conv.is_owned = false;
30239         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30240         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
30241         uint64_t ret_ref = tag_ptr(ret_copy, true);
30242         return ret_ref;
30243 }
30244
30245 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) {
30246         LDKChannelReady this_ptr_conv;
30247         this_ptr_conv.inner = untag_ptr(this_ptr);
30248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30250         this_ptr_conv.is_owned = false;
30251         void* val_ptr = untag_ptr(val);
30252         CHECK_ACCESS(val_ptr);
30253         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30254         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30255         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
30256 }
30257
30258 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) {
30259         LDKThirtyTwoBytes channel_id_arg_ref;
30260         CHECK(channel_id_arg->arr_len == 32);
30261         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30262         LDKPublicKey next_per_commitment_point_arg_ref;
30263         CHECK(next_per_commitment_point_arg->arr_len == 33);
30264         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
30265         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
30266         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
30267         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
30268         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
30269         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
30270         uint64_t ret_ref = 0;
30271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30273         return ret_ref;
30274 }
30275
30276 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
30277         LDKChannelReady ret_var = ChannelReady_clone(arg);
30278         uint64_t ret_ref = 0;
30279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30281         return ret_ref;
30282 }
30283 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
30284         LDKChannelReady arg_conv;
30285         arg_conv.inner = untag_ptr(arg);
30286         arg_conv.is_owned = ptr_is_owned(arg);
30287         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30288         arg_conv.is_owned = false;
30289         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
30290         return ret_conv;
30291 }
30292
30293 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
30294         LDKChannelReady orig_conv;
30295         orig_conv.inner = untag_ptr(orig);
30296         orig_conv.is_owned = ptr_is_owned(orig);
30297         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30298         orig_conv.is_owned = false;
30299         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
30300         uint64_t ret_ref = 0;
30301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30303         return ret_ref;
30304 }
30305
30306 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
30307         LDKChannelReady a_conv;
30308         a_conv.inner = untag_ptr(a);
30309         a_conv.is_owned = ptr_is_owned(a);
30310         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30311         a_conv.is_owned = false;
30312         LDKChannelReady b_conv;
30313         b_conv.inner = untag_ptr(b);
30314         b_conv.is_owned = ptr_is_owned(b);
30315         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30316         b_conv.is_owned = false;
30317         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
30318         return ret_conv;
30319 }
30320
30321 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
30322         LDKShutdown this_obj_conv;
30323         this_obj_conv.inner = untag_ptr(this_obj);
30324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30326         Shutdown_free(this_obj_conv);
30327 }
30328
30329 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
30330         LDKShutdown this_ptr_conv;
30331         this_ptr_conv.inner = untag_ptr(this_ptr);
30332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30334         this_ptr_conv.is_owned = false;
30335         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30336         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
30337         return ret_arr;
30338 }
30339
30340 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30341         LDKShutdown this_ptr_conv;
30342         this_ptr_conv.inner = untag_ptr(this_ptr);
30343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30345         this_ptr_conv.is_owned = false;
30346         LDKThirtyTwoBytes val_ref;
30347         CHECK(val->arr_len == 32);
30348         memcpy(val_ref.data, val->elems, 32); FREE(val);
30349         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
30350 }
30351
30352 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
30353         LDKShutdown this_ptr_conv;
30354         this_ptr_conv.inner = untag_ptr(this_ptr);
30355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30357         this_ptr_conv.is_owned = false;
30358         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
30359         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30360         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30361         return ret_arr;
30362 }
30363
30364 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
30365         LDKShutdown this_ptr_conv;
30366         this_ptr_conv.inner = untag_ptr(this_ptr);
30367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30369         this_ptr_conv.is_owned = false;
30370         LDKCVec_u8Z val_ref;
30371         val_ref.datalen = val->arr_len;
30372         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
30373         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
30374         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
30375 }
30376
30377 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
30378         LDKThirtyTwoBytes channel_id_arg_ref;
30379         CHECK(channel_id_arg->arr_len == 32);
30380         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30381         LDKCVec_u8Z scriptpubkey_arg_ref;
30382         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
30383         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
30384         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
30385         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
30386         uint64_t ret_ref = 0;
30387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30389         return ret_ref;
30390 }
30391
30392 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
30393         LDKShutdown ret_var = Shutdown_clone(arg);
30394         uint64_t ret_ref = 0;
30395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30397         return ret_ref;
30398 }
30399 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
30400         LDKShutdown arg_conv;
30401         arg_conv.inner = untag_ptr(arg);
30402         arg_conv.is_owned = ptr_is_owned(arg);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30404         arg_conv.is_owned = false;
30405         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
30406         return ret_conv;
30407 }
30408
30409 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
30410         LDKShutdown orig_conv;
30411         orig_conv.inner = untag_ptr(orig);
30412         orig_conv.is_owned = ptr_is_owned(orig);
30413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30414         orig_conv.is_owned = false;
30415         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
30416         uint64_t ret_ref = 0;
30417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30419         return ret_ref;
30420 }
30421
30422 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
30423         LDKShutdown a_conv;
30424         a_conv.inner = untag_ptr(a);
30425         a_conv.is_owned = ptr_is_owned(a);
30426         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30427         a_conv.is_owned = false;
30428         LDKShutdown b_conv;
30429         b_conv.inner = untag_ptr(b);
30430         b_conv.is_owned = ptr_is_owned(b);
30431         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30432         b_conv.is_owned = false;
30433         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
30434         return ret_conv;
30435 }
30436
30437 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
30438         LDKClosingSignedFeeRange this_obj_conv;
30439         this_obj_conv.inner = untag_ptr(this_obj);
30440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30442         ClosingSignedFeeRange_free(this_obj_conv);
30443 }
30444
30445 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
30446         LDKClosingSignedFeeRange this_ptr_conv;
30447         this_ptr_conv.inner = untag_ptr(this_ptr);
30448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30450         this_ptr_conv.is_owned = false;
30451         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
30452         return ret_conv;
30453 }
30454
30455 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
30456         LDKClosingSignedFeeRange this_ptr_conv;
30457         this_ptr_conv.inner = untag_ptr(this_ptr);
30458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30460         this_ptr_conv.is_owned = false;
30461         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
30462 }
30463
30464 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
30465         LDKClosingSignedFeeRange this_ptr_conv;
30466         this_ptr_conv.inner = untag_ptr(this_ptr);
30467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30469         this_ptr_conv.is_owned = false;
30470         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
30471         return ret_conv;
30472 }
30473
30474 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
30475         LDKClosingSignedFeeRange this_ptr_conv;
30476         this_ptr_conv.inner = untag_ptr(this_ptr);
30477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30479         this_ptr_conv.is_owned = false;
30480         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
30481 }
30482
30483 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
30484         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
30485         uint64_t ret_ref = 0;
30486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30488         return ret_ref;
30489 }
30490
30491 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
30492         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
30493         uint64_t ret_ref = 0;
30494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30496         return ret_ref;
30497 }
30498 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
30499         LDKClosingSignedFeeRange arg_conv;
30500         arg_conv.inner = untag_ptr(arg);
30501         arg_conv.is_owned = ptr_is_owned(arg);
30502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30503         arg_conv.is_owned = false;
30504         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
30505         return ret_conv;
30506 }
30507
30508 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
30509         LDKClosingSignedFeeRange orig_conv;
30510         orig_conv.inner = untag_ptr(orig);
30511         orig_conv.is_owned = ptr_is_owned(orig);
30512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30513         orig_conv.is_owned = false;
30514         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
30515         uint64_t ret_ref = 0;
30516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30518         return ret_ref;
30519 }
30520
30521 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
30522         LDKClosingSignedFeeRange a_conv;
30523         a_conv.inner = untag_ptr(a);
30524         a_conv.is_owned = ptr_is_owned(a);
30525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30526         a_conv.is_owned = false;
30527         LDKClosingSignedFeeRange b_conv;
30528         b_conv.inner = untag_ptr(b);
30529         b_conv.is_owned = ptr_is_owned(b);
30530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30531         b_conv.is_owned = false;
30532         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
30533         return ret_conv;
30534 }
30535
30536 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
30537         LDKClosingSigned this_obj_conv;
30538         this_obj_conv.inner = untag_ptr(this_obj);
30539         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30541         ClosingSigned_free(this_obj_conv);
30542 }
30543
30544 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
30545         LDKClosingSigned this_ptr_conv;
30546         this_ptr_conv.inner = untag_ptr(this_ptr);
30547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30549         this_ptr_conv.is_owned = false;
30550         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30551         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
30552         return ret_arr;
30553 }
30554
30555 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30556         LDKClosingSigned this_ptr_conv;
30557         this_ptr_conv.inner = untag_ptr(this_ptr);
30558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30560         this_ptr_conv.is_owned = false;
30561         LDKThirtyTwoBytes val_ref;
30562         CHECK(val->arr_len == 32);
30563         memcpy(val_ref.data, val->elems, 32); FREE(val);
30564         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
30565 }
30566
30567 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
30568         LDKClosingSigned this_ptr_conv;
30569         this_ptr_conv.inner = untag_ptr(this_ptr);
30570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30572         this_ptr_conv.is_owned = false;
30573         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
30574         return ret_conv;
30575 }
30576
30577 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
30578         LDKClosingSigned this_ptr_conv;
30579         this_ptr_conv.inner = untag_ptr(this_ptr);
30580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30582         this_ptr_conv.is_owned = false;
30583         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
30584 }
30585
30586 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
30587         LDKClosingSigned this_ptr_conv;
30588         this_ptr_conv.inner = untag_ptr(this_ptr);
30589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30591         this_ptr_conv.is_owned = false;
30592         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30593         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30594         return ret_arr;
30595 }
30596
30597 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30598         LDKClosingSigned this_ptr_conv;
30599         this_ptr_conv.inner = untag_ptr(this_ptr);
30600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30602         this_ptr_conv.is_owned = false;
30603         LDKSignature val_ref;
30604         CHECK(val->arr_len == 64);
30605         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30606         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
30607 }
30608
30609 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
30610         LDKClosingSigned this_ptr_conv;
30611         this_ptr_conv.inner = untag_ptr(this_ptr);
30612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30614         this_ptr_conv.is_owned = false;
30615         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
30616         uint64_t ret_ref = 0;
30617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30619         return ret_ref;
30620 }
30621
30622 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
30623         LDKClosingSigned this_ptr_conv;
30624         this_ptr_conv.inner = untag_ptr(this_ptr);
30625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30627         this_ptr_conv.is_owned = false;
30628         LDKClosingSignedFeeRange val_conv;
30629         val_conv.inner = untag_ptr(val);
30630         val_conv.is_owned = ptr_is_owned(val);
30631         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30632         val_conv = ClosingSignedFeeRange_clone(&val_conv);
30633         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
30634 }
30635
30636 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) {
30637         LDKThirtyTwoBytes channel_id_arg_ref;
30638         CHECK(channel_id_arg->arr_len == 32);
30639         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30640         LDKSignature signature_arg_ref;
30641         CHECK(signature_arg->arr_len == 64);
30642         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30643         LDKClosingSignedFeeRange fee_range_arg_conv;
30644         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
30645         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
30646         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
30647         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
30648         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
30649         uint64_t ret_ref = 0;
30650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30652         return ret_ref;
30653 }
30654
30655 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
30656         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
30657         uint64_t ret_ref = 0;
30658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30660         return ret_ref;
30661 }
30662 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
30663         LDKClosingSigned arg_conv;
30664         arg_conv.inner = untag_ptr(arg);
30665         arg_conv.is_owned = ptr_is_owned(arg);
30666         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30667         arg_conv.is_owned = false;
30668         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
30669         return ret_conv;
30670 }
30671
30672 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
30673         LDKClosingSigned orig_conv;
30674         orig_conv.inner = untag_ptr(orig);
30675         orig_conv.is_owned = ptr_is_owned(orig);
30676         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30677         orig_conv.is_owned = false;
30678         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
30679         uint64_t ret_ref = 0;
30680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30682         return ret_ref;
30683 }
30684
30685 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
30686         LDKClosingSigned a_conv;
30687         a_conv.inner = untag_ptr(a);
30688         a_conv.is_owned = ptr_is_owned(a);
30689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30690         a_conv.is_owned = false;
30691         LDKClosingSigned b_conv;
30692         b_conv.inner = untag_ptr(b);
30693         b_conv.is_owned = ptr_is_owned(b);
30694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30695         b_conv.is_owned = false;
30696         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
30697         return ret_conv;
30698 }
30699
30700 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
30701         LDKUpdateAddHTLC this_obj_conv;
30702         this_obj_conv.inner = untag_ptr(this_obj);
30703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30705         UpdateAddHTLC_free(this_obj_conv);
30706 }
30707
30708 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
30709         LDKUpdateAddHTLC this_ptr_conv;
30710         this_ptr_conv.inner = untag_ptr(this_ptr);
30711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30713         this_ptr_conv.is_owned = false;
30714         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30715         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
30716         return ret_arr;
30717 }
30718
30719 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30720         LDKUpdateAddHTLC this_ptr_conv;
30721         this_ptr_conv.inner = untag_ptr(this_ptr);
30722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30724         this_ptr_conv.is_owned = false;
30725         LDKThirtyTwoBytes val_ref;
30726         CHECK(val->arr_len == 32);
30727         memcpy(val_ref.data, val->elems, 32); FREE(val);
30728         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
30729 }
30730
30731 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
30732         LDKUpdateAddHTLC this_ptr_conv;
30733         this_ptr_conv.inner = untag_ptr(this_ptr);
30734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30736         this_ptr_conv.is_owned = false;
30737         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
30738         return ret_conv;
30739 }
30740
30741 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30742         LDKUpdateAddHTLC this_ptr_conv;
30743         this_ptr_conv.inner = untag_ptr(this_ptr);
30744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30746         this_ptr_conv.is_owned = false;
30747         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
30748 }
30749
30750 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
30751         LDKUpdateAddHTLC this_ptr_conv;
30752         this_ptr_conv.inner = untag_ptr(this_ptr);
30753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30755         this_ptr_conv.is_owned = false;
30756         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
30757         return ret_conv;
30758 }
30759
30760 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
30761         LDKUpdateAddHTLC this_ptr_conv;
30762         this_ptr_conv.inner = untag_ptr(this_ptr);
30763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30765         this_ptr_conv.is_owned = false;
30766         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
30767 }
30768
30769 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
30770         LDKUpdateAddHTLC this_ptr_conv;
30771         this_ptr_conv.inner = untag_ptr(this_ptr);
30772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30774         this_ptr_conv.is_owned = false;
30775         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30776         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
30777         return ret_arr;
30778 }
30779
30780 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
30781         LDKUpdateAddHTLC this_ptr_conv;
30782         this_ptr_conv.inner = untag_ptr(this_ptr);
30783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30785         this_ptr_conv.is_owned = false;
30786         LDKThirtyTwoBytes val_ref;
30787         CHECK(val->arr_len == 32);
30788         memcpy(val_ref.data, val->elems, 32); FREE(val);
30789         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
30790 }
30791
30792 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
30793         LDKUpdateAddHTLC this_ptr_conv;
30794         this_ptr_conv.inner = untag_ptr(this_ptr);
30795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30797         this_ptr_conv.is_owned = false;
30798         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
30799         return ret_conv;
30800 }
30801
30802 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
30803         LDKUpdateAddHTLC this_ptr_conv;
30804         this_ptr_conv.inner = untag_ptr(this_ptr);
30805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30807         this_ptr_conv.is_owned = false;
30808         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
30809 }
30810
30811 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
30812         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
30813         uint64_t ret_ref = 0;
30814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30816         return ret_ref;
30817 }
30818 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
30819         LDKUpdateAddHTLC arg_conv;
30820         arg_conv.inner = untag_ptr(arg);
30821         arg_conv.is_owned = ptr_is_owned(arg);
30822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30823         arg_conv.is_owned = false;
30824         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
30825         return ret_conv;
30826 }
30827
30828 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
30829         LDKUpdateAddHTLC orig_conv;
30830         orig_conv.inner = untag_ptr(orig);
30831         orig_conv.is_owned = ptr_is_owned(orig);
30832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30833         orig_conv.is_owned = false;
30834         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
30835         uint64_t ret_ref = 0;
30836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30838         return ret_ref;
30839 }
30840
30841 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
30842         LDKUpdateAddHTLC a_conv;
30843         a_conv.inner = untag_ptr(a);
30844         a_conv.is_owned = ptr_is_owned(a);
30845         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30846         a_conv.is_owned = false;
30847         LDKUpdateAddHTLC b_conv;
30848         b_conv.inner = untag_ptr(b);
30849         b_conv.is_owned = ptr_is_owned(b);
30850         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30851         b_conv.is_owned = false;
30852         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
30853         return ret_conv;
30854 }
30855
30856 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
30857         LDKOnionMessage this_obj_conv;
30858         this_obj_conv.inner = untag_ptr(this_obj);
30859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30861         OnionMessage_free(this_obj_conv);
30862 }
30863
30864 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
30865         LDKOnionMessage this_ptr_conv;
30866         this_ptr_conv.inner = untag_ptr(this_ptr);
30867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30869         this_ptr_conv.is_owned = false;
30870         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30871         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
30872         return ret_arr;
30873 }
30874
30875 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
30876         LDKOnionMessage this_ptr_conv;
30877         this_ptr_conv.inner = untag_ptr(this_ptr);
30878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30880         this_ptr_conv.is_owned = false;
30881         LDKPublicKey val_ref;
30882         CHECK(val->arr_len == 33);
30883         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30884         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
30885 }
30886
30887 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
30888         LDKOnionMessage ret_var = OnionMessage_clone(arg);
30889         uint64_t ret_ref = 0;
30890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30892         return ret_ref;
30893 }
30894 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
30895         LDKOnionMessage arg_conv;
30896         arg_conv.inner = untag_ptr(arg);
30897         arg_conv.is_owned = ptr_is_owned(arg);
30898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30899         arg_conv.is_owned = false;
30900         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
30901         return ret_conv;
30902 }
30903
30904 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
30905         LDKOnionMessage orig_conv;
30906         orig_conv.inner = untag_ptr(orig);
30907         orig_conv.is_owned = ptr_is_owned(orig);
30908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30909         orig_conv.is_owned = false;
30910         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
30911         uint64_t ret_ref = 0;
30912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30914         return ret_ref;
30915 }
30916
30917 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
30918         LDKOnionMessage a_conv;
30919         a_conv.inner = untag_ptr(a);
30920         a_conv.is_owned = ptr_is_owned(a);
30921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30922         a_conv.is_owned = false;
30923         LDKOnionMessage b_conv;
30924         b_conv.inner = untag_ptr(b);
30925         b_conv.is_owned = ptr_is_owned(b);
30926         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30927         b_conv.is_owned = false;
30928         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
30929         return ret_conv;
30930 }
30931
30932 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
30933         LDKUpdateFulfillHTLC this_obj_conv;
30934         this_obj_conv.inner = untag_ptr(this_obj);
30935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30937         UpdateFulfillHTLC_free(this_obj_conv);
30938 }
30939
30940 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
30941         LDKUpdateFulfillHTLC this_ptr_conv;
30942         this_ptr_conv.inner = untag_ptr(this_ptr);
30943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30945         this_ptr_conv.is_owned = false;
30946         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30947         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
30948         return ret_arr;
30949 }
30950
30951 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30952         LDKUpdateFulfillHTLC this_ptr_conv;
30953         this_ptr_conv.inner = untag_ptr(this_ptr);
30954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30956         this_ptr_conv.is_owned = false;
30957         LDKThirtyTwoBytes val_ref;
30958         CHECK(val->arr_len == 32);
30959         memcpy(val_ref.data, val->elems, 32); FREE(val);
30960         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
30961 }
30962
30963 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
30964         LDKUpdateFulfillHTLC this_ptr_conv;
30965         this_ptr_conv.inner = untag_ptr(this_ptr);
30966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30968         this_ptr_conv.is_owned = false;
30969         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
30970         return ret_conv;
30971 }
30972
30973 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30974         LDKUpdateFulfillHTLC this_ptr_conv;
30975         this_ptr_conv.inner = untag_ptr(this_ptr);
30976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30978         this_ptr_conv.is_owned = false;
30979         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
30980 }
30981
30982 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
30983         LDKUpdateFulfillHTLC this_ptr_conv;
30984         this_ptr_conv.inner = untag_ptr(this_ptr);
30985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30987         this_ptr_conv.is_owned = false;
30988         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30989         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
30990         return ret_arr;
30991 }
30992
30993 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
30994         LDKUpdateFulfillHTLC this_ptr_conv;
30995         this_ptr_conv.inner = untag_ptr(this_ptr);
30996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30998         this_ptr_conv.is_owned = false;
30999         LDKThirtyTwoBytes val_ref;
31000         CHECK(val->arr_len == 32);
31001         memcpy(val_ref.data, val->elems, 32); FREE(val);
31002         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
31003 }
31004
31005 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) {
31006         LDKThirtyTwoBytes channel_id_arg_ref;
31007         CHECK(channel_id_arg->arr_len == 32);
31008         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31009         LDKThirtyTwoBytes payment_preimage_arg_ref;
31010         CHECK(payment_preimage_arg->arr_len == 32);
31011         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
31012         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
31013         uint64_t ret_ref = 0;
31014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31016         return ret_ref;
31017 }
31018
31019 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
31020         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
31021         uint64_t ret_ref = 0;
31022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31024         return ret_ref;
31025 }
31026 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
31027         LDKUpdateFulfillHTLC arg_conv;
31028         arg_conv.inner = untag_ptr(arg);
31029         arg_conv.is_owned = ptr_is_owned(arg);
31030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31031         arg_conv.is_owned = false;
31032         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
31033         return ret_conv;
31034 }
31035
31036 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
31037         LDKUpdateFulfillHTLC orig_conv;
31038         orig_conv.inner = untag_ptr(orig);
31039         orig_conv.is_owned = ptr_is_owned(orig);
31040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31041         orig_conv.is_owned = false;
31042         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
31043         uint64_t ret_ref = 0;
31044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31046         return ret_ref;
31047 }
31048
31049 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
31050         LDKUpdateFulfillHTLC a_conv;
31051         a_conv.inner = untag_ptr(a);
31052         a_conv.is_owned = ptr_is_owned(a);
31053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31054         a_conv.is_owned = false;
31055         LDKUpdateFulfillHTLC b_conv;
31056         b_conv.inner = untag_ptr(b);
31057         b_conv.is_owned = ptr_is_owned(b);
31058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31059         b_conv.is_owned = false;
31060         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
31061         return ret_conv;
31062 }
31063
31064 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
31065         LDKUpdateFailHTLC this_obj_conv;
31066         this_obj_conv.inner = untag_ptr(this_obj);
31067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31069         UpdateFailHTLC_free(this_obj_conv);
31070 }
31071
31072 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
31073         LDKUpdateFailHTLC this_ptr_conv;
31074         this_ptr_conv.inner = untag_ptr(this_ptr);
31075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31077         this_ptr_conv.is_owned = false;
31078         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31079         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
31080         return ret_arr;
31081 }
31082
31083 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31084         LDKUpdateFailHTLC this_ptr_conv;
31085         this_ptr_conv.inner = untag_ptr(this_ptr);
31086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31088         this_ptr_conv.is_owned = false;
31089         LDKThirtyTwoBytes val_ref;
31090         CHECK(val->arr_len == 32);
31091         memcpy(val_ref.data, val->elems, 32); FREE(val);
31092         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
31093 }
31094
31095 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
31096         LDKUpdateFailHTLC this_ptr_conv;
31097         this_ptr_conv.inner = untag_ptr(this_ptr);
31098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31100         this_ptr_conv.is_owned = false;
31101         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
31102         return ret_conv;
31103 }
31104
31105 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31106         LDKUpdateFailHTLC this_ptr_conv;
31107         this_ptr_conv.inner = untag_ptr(this_ptr);
31108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31110         this_ptr_conv.is_owned = false;
31111         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
31112 }
31113
31114 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
31115         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
31116         uint64_t ret_ref = 0;
31117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31119         return ret_ref;
31120 }
31121 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
31122         LDKUpdateFailHTLC arg_conv;
31123         arg_conv.inner = untag_ptr(arg);
31124         arg_conv.is_owned = ptr_is_owned(arg);
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31126         arg_conv.is_owned = false;
31127         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
31128         return ret_conv;
31129 }
31130
31131 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
31132         LDKUpdateFailHTLC orig_conv;
31133         orig_conv.inner = untag_ptr(orig);
31134         orig_conv.is_owned = ptr_is_owned(orig);
31135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31136         orig_conv.is_owned = false;
31137         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
31138         uint64_t ret_ref = 0;
31139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31141         return ret_ref;
31142 }
31143
31144 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
31145         LDKUpdateFailHTLC a_conv;
31146         a_conv.inner = untag_ptr(a);
31147         a_conv.is_owned = ptr_is_owned(a);
31148         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31149         a_conv.is_owned = false;
31150         LDKUpdateFailHTLC b_conv;
31151         b_conv.inner = untag_ptr(b);
31152         b_conv.is_owned = ptr_is_owned(b);
31153         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31154         b_conv.is_owned = false;
31155         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
31156         return ret_conv;
31157 }
31158
31159 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
31160         LDKUpdateFailMalformedHTLC this_obj_conv;
31161         this_obj_conv.inner = untag_ptr(this_obj);
31162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31164         UpdateFailMalformedHTLC_free(this_obj_conv);
31165 }
31166
31167 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
31168         LDKUpdateFailMalformedHTLC this_ptr_conv;
31169         this_ptr_conv.inner = untag_ptr(this_ptr);
31170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31172         this_ptr_conv.is_owned = false;
31173         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31174         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
31175         return ret_arr;
31176 }
31177
31178 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31179         LDKUpdateFailMalformedHTLC this_ptr_conv;
31180         this_ptr_conv.inner = untag_ptr(this_ptr);
31181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31183         this_ptr_conv.is_owned = false;
31184         LDKThirtyTwoBytes val_ref;
31185         CHECK(val->arr_len == 32);
31186         memcpy(val_ref.data, val->elems, 32); FREE(val);
31187         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
31188 }
31189
31190 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
31191         LDKUpdateFailMalformedHTLC this_ptr_conv;
31192         this_ptr_conv.inner = untag_ptr(this_ptr);
31193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31195         this_ptr_conv.is_owned = false;
31196         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
31197         return ret_conv;
31198 }
31199
31200 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31201         LDKUpdateFailMalformedHTLC this_ptr_conv;
31202         this_ptr_conv.inner = untag_ptr(this_ptr);
31203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31205         this_ptr_conv.is_owned = false;
31206         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
31207 }
31208
31209 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
31210         LDKUpdateFailMalformedHTLC this_ptr_conv;
31211         this_ptr_conv.inner = untag_ptr(this_ptr);
31212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31214         this_ptr_conv.is_owned = false;
31215         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
31216         return ret_conv;
31217 }
31218
31219 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
31220         LDKUpdateFailMalformedHTLC this_ptr_conv;
31221         this_ptr_conv.inner = untag_ptr(this_ptr);
31222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31224         this_ptr_conv.is_owned = false;
31225         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
31226 }
31227
31228 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
31229         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
31230         uint64_t ret_ref = 0;
31231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31233         return ret_ref;
31234 }
31235 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
31236         LDKUpdateFailMalformedHTLC arg_conv;
31237         arg_conv.inner = untag_ptr(arg);
31238         arg_conv.is_owned = ptr_is_owned(arg);
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31240         arg_conv.is_owned = false;
31241         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
31242         return ret_conv;
31243 }
31244
31245 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
31246         LDKUpdateFailMalformedHTLC orig_conv;
31247         orig_conv.inner = untag_ptr(orig);
31248         orig_conv.is_owned = ptr_is_owned(orig);
31249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31250         orig_conv.is_owned = false;
31251         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
31252         uint64_t ret_ref = 0;
31253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31255         return ret_ref;
31256 }
31257
31258 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
31259         LDKUpdateFailMalformedHTLC a_conv;
31260         a_conv.inner = untag_ptr(a);
31261         a_conv.is_owned = ptr_is_owned(a);
31262         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31263         a_conv.is_owned = false;
31264         LDKUpdateFailMalformedHTLC b_conv;
31265         b_conv.inner = untag_ptr(b);
31266         b_conv.is_owned = ptr_is_owned(b);
31267         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31268         b_conv.is_owned = false;
31269         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
31270         return ret_conv;
31271 }
31272
31273 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
31274         LDKCommitmentSigned this_obj_conv;
31275         this_obj_conv.inner = untag_ptr(this_obj);
31276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31278         CommitmentSigned_free(this_obj_conv);
31279 }
31280
31281 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
31282         LDKCommitmentSigned this_ptr_conv;
31283         this_ptr_conv.inner = untag_ptr(this_ptr);
31284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31286         this_ptr_conv.is_owned = false;
31287         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31288         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
31289         return ret_arr;
31290 }
31291
31292 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31293         LDKCommitmentSigned this_ptr_conv;
31294         this_ptr_conv.inner = untag_ptr(this_ptr);
31295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31297         this_ptr_conv.is_owned = false;
31298         LDKThirtyTwoBytes val_ref;
31299         CHECK(val->arr_len == 32);
31300         memcpy(val_ref.data, val->elems, 32); FREE(val);
31301         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
31302 }
31303
31304 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
31305         LDKCommitmentSigned this_ptr_conv;
31306         this_ptr_conv.inner = untag_ptr(this_ptr);
31307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31309         this_ptr_conv.is_owned = false;
31310         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31311         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
31312         return ret_arr;
31313 }
31314
31315 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31316         LDKCommitmentSigned this_ptr_conv;
31317         this_ptr_conv.inner = untag_ptr(this_ptr);
31318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31320         this_ptr_conv.is_owned = false;
31321         LDKSignature val_ref;
31322         CHECK(val->arr_len == 64);
31323         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31324         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
31325 }
31326
31327 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
31328         LDKCommitmentSigned this_ptr_conv;
31329         this_ptr_conv.inner = untag_ptr(this_ptr);
31330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31332         this_ptr_conv.is_owned = false;
31333         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
31334         ptrArray ret_arr = NULL;
31335         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
31336         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
31337         for (size_t m = 0; m < ret_var.datalen; m++) {
31338                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
31339                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
31340                 ret_arr_ptr[m] = ret_conv_12_arr;
31341         }
31342         
31343         FREE(ret_var.data);
31344         return ret_arr;
31345 }
31346
31347 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
31348         LDKCommitmentSigned this_ptr_conv;
31349         this_ptr_conv.inner = untag_ptr(this_ptr);
31350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31352         this_ptr_conv.is_owned = false;
31353         LDKCVec_SignatureZ val_constr;
31354         val_constr.datalen = val->arr_len;
31355         if (val_constr.datalen > 0)
31356                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31357         else
31358                 val_constr.data = NULL;
31359         int8_tArray* val_vals = (void*) val->elems;
31360         for (size_t m = 0; m < val_constr.datalen; m++) {
31361                 int8_tArray val_conv_12 = val_vals[m];
31362                 LDKSignature val_conv_12_ref;
31363                 CHECK(val_conv_12->arr_len == 64);
31364                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
31365                 val_constr.data[m] = val_conv_12_ref;
31366         }
31367         FREE(val);
31368         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
31369 }
31370
31371 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
31372         LDKThirtyTwoBytes channel_id_arg_ref;
31373         CHECK(channel_id_arg->arr_len == 32);
31374         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31375         LDKSignature signature_arg_ref;
31376         CHECK(signature_arg->arr_len == 64);
31377         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31378         LDKCVec_SignatureZ htlc_signatures_arg_constr;
31379         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
31380         if (htlc_signatures_arg_constr.datalen > 0)
31381                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31382         else
31383                 htlc_signatures_arg_constr.data = NULL;
31384         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
31385         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
31386                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
31387                 LDKSignature htlc_signatures_arg_conv_12_ref;
31388                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
31389                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
31390                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
31391         }
31392         FREE(htlc_signatures_arg);
31393         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
31394         uint64_t ret_ref = 0;
31395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31397         return ret_ref;
31398 }
31399
31400 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
31401         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
31402         uint64_t ret_ref = 0;
31403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31405         return ret_ref;
31406 }
31407 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
31408         LDKCommitmentSigned arg_conv;
31409         arg_conv.inner = untag_ptr(arg);
31410         arg_conv.is_owned = ptr_is_owned(arg);
31411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31412         arg_conv.is_owned = false;
31413         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
31414         return ret_conv;
31415 }
31416
31417 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
31418         LDKCommitmentSigned orig_conv;
31419         orig_conv.inner = untag_ptr(orig);
31420         orig_conv.is_owned = ptr_is_owned(orig);
31421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31422         orig_conv.is_owned = false;
31423         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
31424         uint64_t ret_ref = 0;
31425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31427         return ret_ref;
31428 }
31429
31430 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
31431         LDKCommitmentSigned a_conv;
31432         a_conv.inner = untag_ptr(a);
31433         a_conv.is_owned = ptr_is_owned(a);
31434         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31435         a_conv.is_owned = false;
31436         LDKCommitmentSigned b_conv;
31437         b_conv.inner = untag_ptr(b);
31438         b_conv.is_owned = ptr_is_owned(b);
31439         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31440         b_conv.is_owned = false;
31441         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
31442         return ret_conv;
31443 }
31444
31445 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
31446         LDKRevokeAndACK this_obj_conv;
31447         this_obj_conv.inner = untag_ptr(this_obj);
31448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31450         RevokeAndACK_free(this_obj_conv);
31451 }
31452
31453 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
31454         LDKRevokeAndACK this_ptr_conv;
31455         this_ptr_conv.inner = untag_ptr(this_ptr);
31456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31458         this_ptr_conv.is_owned = false;
31459         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31460         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
31461         return ret_arr;
31462 }
31463
31464 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31465         LDKRevokeAndACK this_ptr_conv;
31466         this_ptr_conv.inner = untag_ptr(this_ptr);
31467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469         this_ptr_conv.is_owned = false;
31470         LDKThirtyTwoBytes val_ref;
31471         CHECK(val->arr_len == 32);
31472         memcpy(val_ref.data, val->elems, 32); FREE(val);
31473         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
31474 }
31475
31476 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
31477         LDKRevokeAndACK this_ptr_conv;
31478         this_ptr_conv.inner = untag_ptr(this_ptr);
31479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31481         this_ptr_conv.is_owned = false;
31482         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31483         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
31484         return ret_arr;
31485 }
31486
31487 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
31488         LDKRevokeAndACK this_ptr_conv;
31489         this_ptr_conv.inner = untag_ptr(this_ptr);
31490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31492         this_ptr_conv.is_owned = false;
31493         LDKThirtyTwoBytes val_ref;
31494         CHECK(val->arr_len == 32);
31495         memcpy(val_ref.data, val->elems, 32); FREE(val);
31496         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
31497 }
31498
31499 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
31500         LDKRevokeAndACK this_ptr_conv;
31501         this_ptr_conv.inner = untag_ptr(this_ptr);
31502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31504         this_ptr_conv.is_owned = false;
31505         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31506         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31507         return ret_arr;
31508 }
31509
31510 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) {
31511         LDKRevokeAndACK this_ptr_conv;
31512         this_ptr_conv.inner = untag_ptr(this_ptr);
31513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31515         this_ptr_conv.is_owned = false;
31516         LDKPublicKey val_ref;
31517         CHECK(val->arr_len == 33);
31518         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31519         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31520 }
31521
31522 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) {
31523         LDKThirtyTwoBytes channel_id_arg_ref;
31524         CHECK(channel_id_arg->arr_len == 32);
31525         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31526         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
31527         CHECK(per_commitment_secret_arg->arr_len == 32);
31528         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
31529         LDKPublicKey next_per_commitment_point_arg_ref;
31530         CHECK(next_per_commitment_point_arg->arr_len == 33);
31531         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31532         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
31533         uint64_t ret_ref = 0;
31534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31536         return ret_ref;
31537 }
31538
31539 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
31540         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
31541         uint64_t ret_ref = 0;
31542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31544         return ret_ref;
31545 }
31546 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
31547         LDKRevokeAndACK arg_conv;
31548         arg_conv.inner = untag_ptr(arg);
31549         arg_conv.is_owned = ptr_is_owned(arg);
31550         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31551         arg_conv.is_owned = false;
31552         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
31553         return ret_conv;
31554 }
31555
31556 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
31557         LDKRevokeAndACK orig_conv;
31558         orig_conv.inner = untag_ptr(orig);
31559         orig_conv.is_owned = ptr_is_owned(orig);
31560         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31561         orig_conv.is_owned = false;
31562         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
31563         uint64_t ret_ref = 0;
31564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31566         return ret_ref;
31567 }
31568
31569 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
31570         LDKRevokeAndACK a_conv;
31571         a_conv.inner = untag_ptr(a);
31572         a_conv.is_owned = ptr_is_owned(a);
31573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31574         a_conv.is_owned = false;
31575         LDKRevokeAndACK b_conv;
31576         b_conv.inner = untag_ptr(b);
31577         b_conv.is_owned = ptr_is_owned(b);
31578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31579         b_conv.is_owned = false;
31580         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
31581         return ret_conv;
31582 }
31583
31584 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
31585         LDKUpdateFee this_obj_conv;
31586         this_obj_conv.inner = untag_ptr(this_obj);
31587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31589         UpdateFee_free(this_obj_conv);
31590 }
31591
31592 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
31593         LDKUpdateFee this_ptr_conv;
31594         this_ptr_conv.inner = untag_ptr(this_ptr);
31595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31597         this_ptr_conv.is_owned = false;
31598         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31599         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
31600         return ret_arr;
31601 }
31602
31603 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31604         LDKUpdateFee this_ptr_conv;
31605         this_ptr_conv.inner = untag_ptr(this_ptr);
31606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31608         this_ptr_conv.is_owned = false;
31609         LDKThirtyTwoBytes val_ref;
31610         CHECK(val->arr_len == 32);
31611         memcpy(val_ref.data, val->elems, 32); FREE(val);
31612         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
31613 }
31614
31615 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
31616         LDKUpdateFee this_ptr_conv;
31617         this_ptr_conv.inner = untag_ptr(this_ptr);
31618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31620         this_ptr_conv.is_owned = false;
31621         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
31622         return ret_conv;
31623 }
31624
31625 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31626         LDKUpdateFee this_ptr_conv;
31627         this_ptr_conv.inner = untag_ptr(this_ptr);
31628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31630         this_ptr_conv.is_owned = false;
31631         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
31632 }
31633
31634 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
31635         LDKThirtyTwoBytes channel_id_arg_ref;
31636         CHECK(channel_id_arg->arr_len == 32);
31637         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31638         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
31639         uint64_t ret_ref = 0;
31640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31642         return ret_ref;
31643 }
31644
31645 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
31646         LDKUpdateFee ret_var = UpdateFee_clone(arg);
31647         uint64_t ret_ref = 0;
31648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31650         return ret_ref;
31651 }
31652 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
31653         LDKUpdateFee arg_conv;
31654         arg_conv.inner = untag_ptr(arg);
31655         arg_conv.is_owned = ptr_is_owned(arg);
31656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31657         arg_conv.is_owned = false;
31658         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
31659         return ret_conv;
31660 }
31661
31662 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
31663         LDKUpdateFee orig_conv;
31664         orig_conv.inner = untag_ptr(orig);
31665         orig_conv.is_owned = ptr_is_owned(orig);
31666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31667         orig_conv.is_owned = false;
31668         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
31669         uint64_t ret_ref = 0;
31670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31672         return ret_ref;
31673 }
31674
31675 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
31676         LDKUpdateFee a_conv;
31677         a_conv.inner = untag_ptr(a);
31678         a_conv.is_owned = ptr_is_owned(a);
31679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31680         a_conv.is_owned = false;
31681         LDKUpdateFee b_conv;
31682         b_conv.inner = untag_ptr(b);
31683         b_conv.is_owned = ptr_is_owned(b);
31684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31685         b_conv.is_owned = false;
31686         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
31687         return ret_conv;
31688 }
31689
31690 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
31691         LDKDataLossProtect this_obj_conv;
31692         this_obj_conv.inner = untag_ptr(this_obj);
31693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31695         DataLossProtect_free(this_obj_conv);
31696 }
31697
31698 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) {
31699         LDKDataLossProtect this_ptr_conv;
31700         this_ptr_conv.inner = untag_ptr(this_ptr);
31701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31703         this_ptr_conv.is_owned = false;
31704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31705         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
31706         return ret_arr;
31707 }
31708
31709 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) {
31710         LDKDataLossProtect this_ptr_conv;
31711         this_ptr_conv.inner = untag_ptr(this_ptr);
31712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31714         this_ptr_conv.is_owned = false;
31715         LDKThirtyTwoBytes val_ref;
31716         CHECK(val->arr_len == 32);
31717         memcpy(val_ref.data, val->elems, 32); FREE(val);
31718         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
31719 }
31720
31721 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) {
31722         LDKDataLossProtect this_ptr_conv;
31723         this_ptr_conv.inner = untag_ptr(this_ptr);
31724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31726         this_ptr_conv.is_owned = false;
31727         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31728         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31729         return ret_arr;
31730 }
31731
31732 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) {
31733         LDKDataLossProtect this_ptr_conv;
31734         this_ptr_conv.inner = untag_ptr(this_ptr);
31735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737         this_ptr_conv.is_owned = false;
31738         LDKPublicKey val_ref;
31739         CHECK(val->arr_len == 33);
31740         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31741         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
31742 }
31743
31744 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) {
31745         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
31746         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
31747         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
31748         LDKPublicKey my_current_per_commitment_point_arg_ref;
31749         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
31750         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);
31751         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
31752         uint64_t ret_ref = 0;
31753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31755         return ret_ref;
31756 }
31757
31758 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
31759         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
31760         uint64_t ret_ref = 0;
31761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31763         return ret_ref;
31764 }
31765 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
31766         LDKDataLossProtect arg_conv;
31767         arg_conv.inner = untag_ptr(arg);
31768         arg_conv.is_owned = ptr_is_owned(arg);
31769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31770         arg_conv.is_owned = false;
31771         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
31772         return ret_conv;
31773 }
31774
31775 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
31776         LDKDataLossProtect orig_conv;
31777         orig_conv.inner = untag_ptr(orig);
31778         orig_conv.is_owned = ptr_is_owned(orig);
31779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31780         orig_conv.is_owned = false;
31781         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
31782         uint64_t ret_ref = 0;
31783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31785         return ret_ref;
31786 }
31787
31788 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
31789         LDKDataLossProtect a_conv;
31790         a_conv.inner = untag_ptr(a);
31791         a_conv.is_owned = ptr_is_owned(a);
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31793         a_conv.is_owned = false;
31794         LDKDataLossProtect b_conv;
31795         b_conv.inner = untag_ptr(b);
31796         b_conv.is_owned = ptr_is_owned(b);
31797         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31798         b_conv.is_owned = false;
31799         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
31800         return ret_conv;
31801 }
31802
31803 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
31804         LDKChannelReestablish this_obj_conv;
31805         this_obj_conv.inner = untag_ptr(this_obj);
31806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31808         ChannelReestablish_free(this_obj_conv);
31809 }
31810
31811 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
31812         LDKChannelReestablish this_ptr_conv;
31813         this_ptr_conv.inner = untag_ptr(this_ptr);
31814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31816         this_ptr_conv.is_owned = false;
31817         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31818         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
31819         return ret_arr;
31820 }
31821
31822 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31823         LDKChannelReestablish this_ptr_conv;
31824         this_ptr_conv.inner = untag_ptr(this_ptr);
31825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31827         this_ptr_conv.is_owned = false;
31828         LDKThirtyTwoBytes val_ref;
31829         CHECK(val->arr_len == 32);
31830         memcpy(val_ref.data, val->elems, 32); FREE(val);
31831         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
31832 }
31833
31834 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
31835         LDKChannelReestablish this_ptr_conv;
31836         this_ptr_conv.inner = untag_ptr(this_ptr);
31837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31839         this_ptr_conv.is_owned = false;
31840         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
31841         return ret_conv;
31842 }
31843
31844 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) {
31845         LDKChannelReestablish this_ptr_conv;
31846         this_ptr_conv.inner = untag_ptr(this_ptr);
31847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31849         this_ptr_conv.is_owned = false;
31850         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
31851 }
31852
31853 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
31854         LDKChannelReestablish this_ptr_conv;
31855         this_ptr_conv.inner = untag_ptr(this_ptr);
31856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31858         this_ptr_conv.is_owned = false;
31859         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
31860         return ret_conv;
31861 }
31862
31863 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) {
31864         LDKChannelReestablish this_ptr_conv;
31865         this_ptr_conv.inner = untag_ptr(this_ptr);
31866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868         this_ptr_conv.is_owned = false;
31869         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
31870 }
31871
31872 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
31873         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
31874         uint64_t ret_ref = 0;
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31877         return ret_ref;
31878 }
31879 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
31880         LDKChannelReestablish arg_conv;
31881         arg_conv.inner = untag_ptr(arg);
31882         arg_conv.is_owned = ptr_is_owned(arg);
31883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31884         arg_conv.is_owned = false;
31885         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
31886         return ret_conv;
31887 }
31888
31889 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
31890         LDKChannelReestablish orig_conv;
31891         orig_conv.inner = untag_ptr(orig);
31892         orig_conv.is_owned = ptr_is_owned(orig);
31893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31894         orig_conv.is_owned = false;
31895         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
31896         uint64_t ret_ref = 0;
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31899         return ret_ref;
31900 }
31901
31902 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
31903         LDKChannelReestablish a_conv;
31904         a_conv.inner = untag_ptr(a);
31905         a_conv.is_owned = ptr_is_owned(a);
31906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31907         a_conv.is_owned = false;
31908         LDKChannelReestablish b_conv;
31909         b_conv.inner = untag_ptr(b);
31910         b_conv.is_owned = ptr_is_owned(b);
31911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31912         b_conv.is_owned = false;
31913         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
31914         return ret_conv;
31915 }
31916
31917 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
31918         LDKAnnouncementSignatures this_obj_conv;
31919         this_obj_conv.inner = untag_ptr(this_obj);
31920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31922         AnnouncementSignatures_free(this_obj_conv);
31923 }
31924
31925 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
31926         LDKAnnouncementSignatures this_ptr_conv;
31927         this_ptr_conv.inner = untag_ptr(this_ptr);
31928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31930         this_ptr_conv.is_owned = false;
31931         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31932         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
31933         return ret_arr;
31934 }
31935
31936 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31937         LDKAnnouncementSignatures this_ptr_conv;
31938         this_ptr_conv.inner = untag_ptr(this_ptr);
31939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31941         this_ptr_conv.is_owned = false;
31942         LDKThirtyTwoBytes val_ref;
31943         CHECK(val->arr_len == 32);
31944         memcpy(val_ref.data, val->elems, 32); FREE(val);
31945         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
31946 }
31947
31948 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
31949         LDKAnnouncementSignatures this_ptr_conv;
31950         this_ptr_conv.inner = untag_ptr(this_ptr);
31951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31953         this_ptr_conv.is_owned = false;
31954         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
31955         return ret_conv;
31956 }
31957
31958 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31959         LDKAnnouncementSignatures this_ptr_conv;
31960         this_ptr_conv.inner = untag_ptr(this_ptr);
31961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31963         this_ptr_conv.is_owned = false;
31964         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
31965 }
31966
31967 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
31968         LDKAnnouncementSignatures this_ptr_conv;
31969         this_ptr_conv.inner = untag_ptr(this_ptr);
31970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31972         this_ptr_conv.is_owned = false;
31973         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31974         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
31975         return ret_arr;
31976 }
31977
31978 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
31979         LDKAnnouncementSignatures this_ptr_conv;
31980         this_ptr_conv.inner = untag_ptr(this_ptr);
31981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31983         this_ptr_conv.is_owned = false;
31984         LDKSignature val_ref;
31985         CHECK(val->arr_len == 64);
31986         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31987         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
31988 }
31989
31990 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
31991         LDKAnnouncementSignatures this_ptr_conv;
31992         this_ptr_conv.inner = untag_ptr(this_ptr);
31993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31995         this_ptr_conv.is_owned = false;
31996         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31997         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
31998         return ret_arr;
31999 }
32000
32001 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
32002         LDKAnnouncementSignatures this_ptr_conv;
32003         this_ptr_conv.inner = untag_ptr(this_ptr);
32004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006         this_ptr_conv.is_owned = false;
32007         LDKSignature val_ref;
32008         CHECK(val->arr_len == 64);
32009         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32010         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
32011 }
32012
32013 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) {
32014         LDKThirtyTwoBytes channel_id_arg_ref;
32015         CHECK(channel_id_arg->arr_len == 32);
32016         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32017         LDKSignature node_signature_arg_ref;
32018         CHECK(node_signature_arg->arr_len == 64);
32019         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
32020         LDKSignature bitcoin_signature_arg_ref;
32021         CHECK(bitcoin_signature_arg->arr_len == 64);
32022         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
32023         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
32024         uint64_t ret_ref = 0;
32025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32027         return ret_ref;
32028 }
32029
32030 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
32031         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
32032         uint64_t ret_ref = 0;
32033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32035         return ret_ref;
32036 }
32037 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
32038         LDKAnnouncementSignatures arg_conv;
32039         arg_conv.inner = untag_ptr(arg);
32040         arg_conv.is_owned = ptr_is_owned(arg);
32041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32042         arg_conv.is_owned = false;
32043         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
32044         return ret_conv;
32045 }
32046
32047 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
32048         LDKAnnouncementSignatures orig_conv;
32049         orig_conv.inner = untag_ptr(orig);
32050         orig_conv.is_owned = ptr_is_owned(orig);
32051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32052         orig_conv.is_owned = false;
32053         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
32054         uint64_t ret_ref = 0;
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32057         return ret_ref;
32058 }
32059
32060 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
32061         LDKAnnouncementSignatures a_conv;
32062         a_conv.inner = untag_ptr(a);
32063         a_conv.is_owned = ptr_is_owned(a);
32064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32065         a_conv.is_owned = false;
32066         LDKAnnouncementSignatures b_conv;
32067         b_conv.inner = untag_ptr(b);
32068         b_conv.is_owned = ptr_is_owned(b);
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32070         b_conv.is_owned = false;
32071         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
32072         return ret_conv;
32073 }
32074
32075 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
32076         if (!ptr_is_owned(this_ptr)) return;
32077         void* this_ptr_ptr = untag_ptr(this_ptr);
32078         CHECK_ACCESS(this_ptr_ptr);
32079         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
32080         FREE(untag_ptr(this_ptr));
32081         NetAddress_free(this_ptr_conv);
32082 }
32083
32084 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
32085         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32086         *ret_copy = NetAddress_clone(arg);
32087         uint64_t ret_ref = tag_ptr(ret_copy, true);
32088         return ret_ref;
32089 }
32090 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
32091         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
32092         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
32093         return ret_conv;
32094 }
32095
32096 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
32097         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
32098         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32099         *ret_copy = NetAddress_clone(orig_conv);
32100         uint64_t ret_ref = tag_ptr(ret_copy, true);
32101         return ret_ref;
32102 }
32103
32104 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
32105         LDKFourBytes addr_ref;
32106         CHECK(addr->arr_len == 4);
32107         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
32108         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32109         *ret_copy = NetAddress_ipv4(addr_ref, port);
32110         uint64_t ret_ref = tag_ptr(ret_copy, true);
32111         return ret_ref;
32112 }
32113
32114 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
32115         LDKSixteenBytes addr_ref;
32116         CHECK(addr->arr_len == 16);
32117         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
32118         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32119         *ret_copy = NetAddress_ipv6(addr_ref, port);
32120         uint64_t ret_ref = tag_ptr(ret_copy, true);
32121         return ret_ref;
32122 }
32123
32124 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
32125         LDKTwelveBytes a_ref;
32126         CHECK(a->arr_len == 12);
32127         memcpy(a_ref.data, a->elems, 12); FREE(a);
32128         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32129         *ret_copy = NetAddress_onion_v2(a_ref);
32130         uint64_t ret_ref = tag_ptr(ret_copy, true);
32131         return ret_ref;
32132 }
32133
32134 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) {
32135         LDKThirtyTwoBytes ed25519_pubkey_ref;
32136         CHECK(ed25519_pubkey->arr_len == 32);
32137         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
32138         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32139         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
32140         uint64_t ret_ref = tag_ptr(ret_copy, true);
32141         return ret_ref;
32142 }
32143
32144 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
32145         LDKHostname hostname_conv;
32146         hostname_conv.inner = untag_ptr(hostname);
32147         hostname_conv.is_owned = ptr_is_owned(hostname);
32148         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
32149         hostname_conv = Hostname_clone(&hostname_conv);
32150         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32151         *ret_copy = NetAddress_hostname(hostname_conv, port);
32152         uint64_t ret_ref = tag_ptr(ret_copy, true);
32153         return ret_ref;
32154 }
32155
32156 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
32157         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
32158         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
32159         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
32160         return ret_conv;
32161 }
32162
32163 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
32164         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
32165         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
32166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32168         CVec_u8Z_free(ret_var);
32169         return ret_arr;
32170 }
32171
32172 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
32173         LDKu8slice ser_ref;
32174         ser_ref.datalen = ser->arr_len;
32175         ser_ref.data = ser->elems;
32176         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
32177         *ret_conv = NetAddress_read(ser_ref);
32178         FREE(ser);
32179         return tag_ptr(ret_conv, true);
32180 }
32181
32182 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
32183         LDKUnsignedNodeAnnouncement this_obj_conv;
32184         this_obj_conv.inner = untag_ptr(this_obj);
32185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32187         UnsignedNodeAnnouncement_free(this_obj_conv);
32188 }
32189
32190 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
32191         LDKUnsignedNodeAnnouncement this_ptr_conv;
32192         this_ptr_conv.inner = untag_ptr(this_ptr);
32193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32195         this_ptr_conv.is_owned = false;
32196         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
32197         uint64_t ret_ref = 0;
32198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32200         return ret_ref;
32201 }
32202
32203 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
32204         LDKUnsignedNodeAnnouncement this_ptr_conv;
32205         this_ptr_conv.inner = untag_ptr(this_ptr);
32206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32208         this_ptr_conv.is_owned = false;
32209         LDKNodeFeatures val_conv;
32210         val_conv.inner = untag_ptr(val);
32211         val_conv.is_owned = ptr_is_owned(val);
32212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32213         val_conv = NodeFeatures_clone(&val_conv);
32214         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
32215 }
32216
32217 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
32218         LDKUnsignedNodeAnnouncement this_ptr_conv;
32219         this_ptr_conv.inner = untag_ptr(this_ptr);
32220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222         this_ptr_conv.is_owned = false;
32223         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
32224         return ret_conv;
32225 }
32226
32227 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
32228         LDKUnsignedNodeAnnouncement this_ptr_conv;
32229         this_ptr_conv.inner = untag_ptr(this_ptr);
32230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32232         this_ptr_conv.is_owned = false;
32233         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
32234 }
32235
32236 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
32237         LDKUnsignedNodeAnnouncement this_ptr_conv;
32238         this_ptr_conv.inner = untag_ptr(this_ptr);
32239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32241         this_ptr_conv.is_owned = false;
32242         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32243         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
32244         return ret_arr;
32245 }
32246
32247 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
32248         LDKUnsignedNodeAnnouncement this_ptr_conv;
32249         this_ptr_conv.inner = untag_ptr(this_ptr);
32250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32252         this_ptr_conv.is_owned = false;
32253         LDKPublicKey val_ref;
32254         CHECK(val->arr_len == 33);
32255         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32256         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
32257 }
32258
32259 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
32260         LDKUnsignedNodeAnnouncement this_ptr_conv;
32261         this_ptr_conv.inner = untag_ptr(this_ptr);
32262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32264         this_ptr_conv.is_owned = false;
32265         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
32266         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
32267         return ret_arr;
32268 }
32269
32270 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
32271         LDKUnsignedNodeAnnouncement this_ptr_conv;
32272         this_ptr_conv.inner = untag_ptr(this_ptr);
32273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32275         this_ptr_conv.is_owned = false;
32276         LDKThreeBytes val_ref;
32277         CHECK(val->arr_len == 3);
32278         memcpy(val_ref.data, val->elems, 3); FREE(val);
32279         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
32280 }
32281
32282 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
32283         LDKUnsignedNodeAnnouncement this_ptr_conv;
32284         this_ptr_conv.inner = untag_ptr(this_ptr);
32285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287         this_ptr_conv.is_owned = false;
32288         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32289         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
32290         return ret_arr;
32291 }
32292
32293 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
32294         LDKUnsignedNodeAnnouncement this_ptr_conv;
32295         this_ptr_conv.inner = untag_ptr(this_ptr);
32296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32298         this_ptr_conv.is_owned = false;
32299         LDKThirtyTwoBytes val_ref;
32300         CHECK(val->arr_len == 32);
32301         memcpy(val_ref.data, val->elems, 32); FREE(val);
32302         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
32303 }
32304
32305 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
32306         LDKUnsignedNodeAnnouncement this_ptr_conv;
32307         this_ptr_conv.inner = untag_ptr(this_ptr);
32308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32310         this_ptr_conv.is_owned = false;
32311         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
32312         uint64_tArray ret_arr = NULL;
32313         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32314         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32315         for (size_t m = 0; m < ret_var.datalen; m++) {
32316                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32317                 *ret_conv_12_copy = ret_var.data[m];
32318                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
32319                 ret_arr_ptr[m] = ret_conv_12_ref;
32320         }
32321         
32322         FREE(ret_var.data);
32323         return ret_arr;
32324 }
32325
32326 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
32327         LDKUnsignedNodeAnnouncement this_ptr_conv;
32328         this_ptr_conv.inner = untag_ptr(this_ptr);
32329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32331         this_ptr_conv.is_owned = false;
32332         LDKCVec_NetAddressZ val_constr;
32333         val_constr.datalen = val->arr_len;
32334         if (val_constr.datalen > 0)
32335                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32336         else
32337                 val_constr.data = NULL;
32338         uint64_t* val_vals = val->elems;
32339         for (size_t m = 0; m < val_constr.datalen; m++) {
32340                 uint64_t val_conv_12 = val_vals[m];
32341                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
32342                 CHECK_ACCESS(val_conv_12_ptr);
32343                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32344                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
32345                 val_constr.data[m] = val_conv_12_conv;
32346         }
32347         FREE(val);
32348         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
32349 }
32350
32351 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
32352         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
32353         uint64_t ret_ref = 0;
32354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32356         return ret_ref;
32357 }
32358 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
32359         LDKUnsignedNodeAnnouncement arg_conv;
32360         arg_conv.inner = untag_ptr(arg);
32361         arg_conv.is_owned = ptr_is_owned(arg);
32362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32363         arg_conv.is_owned = false;
32364         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
32365         return ret_conv;
32366 }
32367
32368 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
32369         LDKUnsignedNodeAnnouncement orig_conv;
32370         orig_conv.inner = untag_ptr(orig);
32371         orig_conv.is_owned = ptr_is_owned(orig);
32372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32373         orig_conv.is_owned = false;
32374         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
32375         uint64_t ret_ref = 0;
32376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32378         return ret_ref;
32379 }
32380
32381 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
32382         LDKUnsignedNodeAnnouncement a_conv;
32383         a_conv.inner = untag_ptr(a);
32384         a_conv.is_owned = ptr_is_owned(a);
32385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32386         a_conv.is_owned = false;
32387         LDKUnsignedNodeAnnouncement b_conv;
32388         b_conv.inner = untag_ptr(b);
32389         b_conv.is_owned = ptr_is_owned(b);
32390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32391         b_conv.is_owned = false;
32392         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
32393         return ret_conv;
32394 }
32395
32396 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
32397         LDKNodeAnnouncement this_obj_conv;
32398         this_obj_conv.inner = untag_ptr(this_obj);
32399         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32401         NodeAnnouncement_free(this_obj_conv);
32402 }
32403
32404 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
32405         LDKNodeAnnouncement this_ptr_conv;
32406         this_ptr_conv.inner = untag_ptr(this_ptr);
32407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32409         this_ptr_conv.is_owned = false;
32410         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32411         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
32412         return ret_arr;
32413 }
32414
32415 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
32416         LDKNodeAnnouncement this_ptr_conv;
32417         this_ptr_conv.inner = untag_ptr(this_ptr);
32418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32420         this_ptr_conv.is_owned = false;
32421         LDKSignature val_ref;
32422         CHECK(val->arr_len == 64);
32423         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32424         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
32425 }
32426
32427 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
32428         LDKNodeAnnouncement this_ptr_conv;
32429         this_ptr_conv.inner = untag_ptr(this_ptr);
32430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32432         this_ptr_conv.is_owned = false;
32433         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
32434         uint64_t ret_ref = 0;
32435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32437         return ret_ref;
32438 }
32439
32440 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32441         LDKNodeAnnouncement this_ptr_conv;
32442         this_ptr_conv.inner = untag_ptr(this_ptr);
32443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32445         this_ptr_conv.is_owned = false;
32446         LDKUnsignedNodeAnnouncement val_conv;
32447         val_conv.inner = untag_ptr(val);
32448         val_conv.is_owned = ptr_is_owned(val);
32449         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32450         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
32451         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
32452 }
32453
32454 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
32455         LDKSignature signature_arg_ref;
32456         CHECK(signature_arg->arr_len == 64);
32457         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32458         LDKUnsignedNodeAnnouncement contents_arg_conv;
32459         contents_arg_conv.inner = untag_ptr(contents_arg);
32460         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32462         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
32463         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
32464         uint64_t ret_ref = 0;
32465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32467         return ret_ref;
32468 }
32469
32470 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
32471         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
32472         uint64_t ret_ref = 0;
32473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32475         return ret_ref;
32476 }
32477 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
32478         LDKNodeAnnouncement arg_conv;
32479         arg_conv.inner = untag_ptr(arg);
32480         arg_conv.is_owned = ptr_is_owned(arg);
32481         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32482         arg_conv.is_owned = false;
32483         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
32484         return ret_conv;
32485 }
32486
32487 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
32488         LDKNodeAnnouncement orig_conv;
32489         orig_conv.inner = untag_ptr(orig);
32490         orig_conv.is_owned = ptr_is_owned(orig);
32491         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32492         orig_conv.is_owned = false;
32493         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
32494         uint64_t ret_ref = 0;
32495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32497         return ret_ref;
32498 }
32499
32500 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
32501         LDKNodeAnnouncement a_conv;
32502         a_conv.inner = untag_ptr(a);
32503         a_conv.is_owned = ptr_is_owned(a);
32504         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32505         a_conv.is_owned = false;
32506         LDKNodeAnnouncement b_conv;
32507         b_conv.inner = untag_ptr(b);
32508         b_conv.is_owned = ptr_is_owned(b);
32509         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32510         b_conv.is_owned = false;
32511         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
32512         return ret_conv;
32513 }
32514
32515 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
32516         LDKUnsignedChannelAnnouncement this_obj_conv;
32517         this_obj_conv.inner = untag_ptr(this_obj);
32518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32520         UnsignedChannelAnnouncement_free(this_obj_conv);
32521 }
32522
32523 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
32524         LDKUnsignedChannelAnnouncement this_ptr_conv;
32525         this_ptr_conv.inner = untag_ptr(this_ptr);
32526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32528         this_ptr_conv.is_owned = false;
32529         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
32530         uint64_t ret_ref = 0;
32531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32533         return ret_ref;
32534 }
32535
32536 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
32537         LDKUnsignedChannelAnnouncement this_ptr_conv;
32538         this_ptr_conv.inner = untag_ptr(this_ptr);
32539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32541         this_ptr_conv.is_owned = false;
32542         LDKChannelFeatures val_conv;
32543         val_conv.inner = untag_ptr(val);
32544         val_conv.is_owned = ptr_is_owned(val);
32545         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32546         val_conv = ChannelFeatures_clone(&val_conv);
32547         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
32548 }
32549
32550 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
32551         LDKUnsignedChannelAnnouncement this_ptr_conv;
32552         this_ptr_conv.inner = untag_ptr(this_ptr);
32553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32555         this_ptr_conv.is_owned = false;
32556         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32557         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
32558         return ret_arr;
32559 }
32560
32561 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32562         LDKUnsignedChannelAnnouncement this_ptr_conv;
32563         this_ptr_conv.inner = untag_ptr(this_ptr);
32564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32566         this_ptr_conv.is_owned = false;
32567         LDKThirtyTwoBytes val_ref;
32568         CHECK(val->arr_len == 32);
32569         memcpy(val_ref.data, val->elems, 32); FREE(val);
32570         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
32571 }
32572
32573 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
32574         LDKUnsignedChannelAnnouncement this_ptr_conv;
32575         this_ptr_conv.inner = untag_ptr(this_ptr);
32576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32578         this_ptr_conv.is_owned = false;
32579         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
32580         return ret_conv;
32581 }
32582
32583 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32584         LDKUnsignedChannelAnnouncement this_ptr_conv;
32585         this_ptr_conv.inner = untag_ptr(this_ptr);
32586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32588         this_ptr_conv.is_owned = false;
32589         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
32590 }
32591
32592 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
32593         LDKUnsignedChannelAnnouncement this_ptr_conv;
32594         this_ptr_conv.inner = untag_ptr(this_ptr);
32595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32597         this_ptr_conv.is_owned = false;
32598         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32599         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
32600         return ret_arr;
32601 }
32602
32603 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
32604         LDKUnsignedChannelAnnouncement this_ptr_conv;
32605         this_ptr_conv.inner = untag_ptr(this_ptr);
32606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32608         this_ptr_conv.is_owned = false;
32609         LDKPublicKey val_ref;
32610         CHECK(val->arr_len == 33);
32611         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32612         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
32613 }
32614
32615 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
32616         LDKUnsignedChannelAnnouncement this_ptr_conv;
32617         this_ptr_conv.inner = untag_ptr(this_ptr);
32618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32620         this_ptr_conv.is_owned = false;
32621         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32622         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
32623         return ret_arr;
32624 }
32625
32626 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
32627         LDKUnsignedChannelAnnouncement this_ptr_conv;
32628         this_ptr_conv.inner = untag_ptr(this_ptr);
32629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32631         this_ptr_conv.is_owned = false;
32632         LDKPublicKey val_ref;
32633         CHECK(val->arr_len == 33);
32634         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32635         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
32636 }
32637
32638 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
32639         LDKUnsignedChannelAnnouncement this_ptr_conv;
32640         this_ptr_conv.inner = untag_ptr(this_ptr);
32641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32643         this_ptr_conv.is_owned = false;
32644         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32645         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
32646         return ret_arr;
32647 }
32648
32649 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
32650         LDKUnsignedChannelAnnouncement this_ptr_conv;
32651         this_ptr_conv.inner = untag_ptr(this_ptr);
32652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32654         this_ptr_conv.is_owned = false;
32655         LDKPublicKey val_ref;
32656         CHECK(val->arr_len == 33);
32657         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32658         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
32659 }
32660
32661 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
32662         LDKUnsignedChannelAnnouncement this_ptr_conv;
32663         this_ptr_conv.inner = untag_ptr(this_ptr);
32664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32666         this_ptr_conv.is_owned = false;
32667         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32668         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
32669         return ret_arr;
32670 }
32671
32672 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
32673         LDKUnsignedChannelAnnouncement this_ptr_conv;
32674         this_ptr_conv.inner = untag_ptr(this_ptr);
32675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32677         this_ptr_conv.is_owned = false;
32678         LDKPublicKey val_ref;
32679         CHECK(val->arr_len == 33);
32680         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32681         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
32682 }
32683
32684 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
32685         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
32686         uint64_t ret_ref = 0;
32687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32689         return ret_ref;
32690 }
32691 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
32692         LDKUnsignedChannelAnnouncement arg_conv;
32693         arg_conv.inner = untag_ptr(arg);
32694         arg_conv.is_owned = ptr_is_owned(arg);
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32696         arg_conv.is_owned = false;
32697         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
32698         return ret_conv;
32699 }
32700
32701 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
32702         LDKUnsignedChannelAnnouncement orig_conv;
32703         orig_conv.inner = untag_ptr(orig);
32704         orig_conv.is_owned = ptr_is_owned(orig);
32705         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32706         orig_conv.is_owned = false;
32707         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
32708         uint64_t ret_ref = 0;
32709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32711         return ret_ref;
32712 }
32713
32714 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
32715         LDKUnsignedChannelAnnouncement a_conv;
32716         a_conv.inner = untag_ptr(a);
32717         a_conv.is_owned = ptr_is_owned(a);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32719         a_conv.is_owned = false;
32720         LDKUnsignedChannelAnnouncement b_conv;
32721         b_conv.inner = untag_ptr(b);
32722         b_conv.is_owned = ptr_is_owned(b);
32723         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32724         b_conv.is_owned = false;
32725         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
32726         return ret_conv;
32727 }
32728
32729 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
32730         LDKChannelAnnouncement this_obj_conv;
32731         this_obj_conv.inner = untag_ptr(this_obj);
32732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32734         ChannelAnnouncement_free(this_obj_conv);
32735 }
32736
32737 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
32738         LDKChannelAnnouncement this_ptr_conv;
32739         this_ptr_conv.inner = untag_ptr(this_ptr);
32740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32742         this_ptr_conv.is_owned = false;
32743         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32744         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
32745         return ret_arr;
32746 }
32747
32748 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
32749         LDKChannelAnnouncement this_ptr_conv;
32750         this_ptr_conv.inner = untag_ptr(this_ptr);
32751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32753         this_ptr_conv.is_owned = false;
32754         LDKSignature val_ref;
32755         CHECK(val->arr_len == 64);
32756         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32757         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
32758 }
32759
32760 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
32761         LDKChannelAnnouncement this_ptr_conv;
32762         this_ptr_conv.inner = untag_ptr(this_ptr);
32763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32765         this_ptr_conv.is_owned = false;
32766         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32767         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
32768         return ret_arr;
32769 }
32770
32771 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
32772         LDKChannelAnnouncement this_ptr_conv;
32773         this_ptr_conv.inner = untag_ptr(this_ptr);
32774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32776         this_ptr_conv.is_owned = false;
32777         LDKSignature val_ref;
32778         CHECK(val->arr_len == 64);
32779         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32780         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
32781 }
32782
32783 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
32784         LDKChannelAnnouncement this_ptr_conv;
32785         this_ptr_conv.inner = untag_ptr(this_ptr);
32786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32788         this_ptr_conv.is_owned = false;
32789         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32790         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
32791         return ret_arr;
32792 }
32793
32794 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
32795         LDKChannelAnnouncement this_ptr_conv;
32796         this_ptr_conv.inner = untag_ptr(this_ptr);
32797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32799         this_ptr_conv.is_owned = false;
32800         LDKSignature val_ref;
32801         CHECK(val->arr_len == 64);
32802         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32803         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
32804 }
32805
32806 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
32807         LDKChannelAnnouncement this_ptr_conv;
32808         this_ptr_conv.inner = untag_ptr(this_ptr);
32809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32811         this_ptr_conv.is_owned = false;
32812         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32813         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
32814         return ret_arr;
32815 }
32816
32817 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
32818         LDKChannelAnnouncement this_ptr_conv;
32819         this_ptr_conv.inner = untag_ptr(this_ptr);
32820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32822         this_ptr_conv.is_owned = false;
32823         LDKSignature val_ref;
32824         CHECK(val->arr_len == 64);
32825         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32826         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
32827 }
32828
32829 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
32830         LDKChannelAnnouncement this_ptr_conv;
32831         this_ptr_conv.inner = untag_ptr(this_ptr);
32832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32834         this_ptr_conv.is_owned = false;
32835         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
32836         uint64_t ret_ref = 0;
32837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32839         return ret_ref;
32840 }
32841
32842 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32843         LDKChannelAnnouncement this_ptr_conv;
32844         this_ptr_conv.inner = untag_ptr(this_ptr);
32845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32847         this_ptr_conv.is_owned = false;
32848         LDKUnsignedChannelAnnouncement val_conv;
32849         val_conv.inner = untag_ptr(val);
32850         val_conv.is_owned = ptr_is_owned(val);
32851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32852         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
32853         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
32854 }
32855
32856 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) {
32857         LDKSignature node_signature_1_arg_ref;
32858         CHECK(node_signature_1_arg->arr_len == 64);
32859         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
32860         LDKSignature node_signature_2_arg_ref;
32861         CHECK(node_signature_2_arg->arr_len == 64);
32862         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
32863         LDKSignature bitcoin_signature_1_arg_ref;
32864         CHECK(bitcoin_signature_1_arg->arr_len == 64);
32865         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
32866         LDKSignature bitcoin_signature_2_arg_ref;
32867         CHECK(bitcoin_signature_2_arg->arr_len == 64);
32868         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
32869         LDKUnsignedChannelAnnouncement contents_arg_conv;
32870         contents_arg_conv.inner = untag_ptr(contents_arg);
32871         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32872         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32873         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
32874         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);
32875         uint64_t ret_ref = 0;
32876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32878         return ret_ref;
32879 }
32880
32881 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
32882         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
32883         uint64_t ret_ref = 0;
32884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32886         return ret_ref;
32887 }
32888 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
32889         LDKChannelAnnouncement arg_conv;
32890         arg_conv.inner = untag_ptr(arg);
32891         arg_conv.is_owned = ptr_is_owned(arg);
32892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32893         arg_conv.is_owned = false;
32894         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
32895         return ret_conv;
32896 }
32897
32898 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
32899         LDKChannelAnnouncement orig_conv;
32900         orig_conv.inner = untag_ptr(orig);
32901         orig_conv.is_owned = ptr_is_owned(orig);
32902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32903         orig_conv.is_owned = false;
32904         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
32905         uint64_t ret_ref = 0;
32906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32908         return ret_ref;
32909 }
32910
32911 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
32912         LDKChannelAnnouncement a_conv;
32913         a_conv.inner = untag_ptr(a);
32914         a_conv.is_owned = ptr_is_owned(a);
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32916         a_conv.is_owned = false;
32917         LDKChannelAnnouncement b_conv;
32918         b_conv.inner = untag_ptr(b);
32919         b_conv.is_owned = ptr_is_owned(b);
32920         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32921         b_conv.is_owned = false;
32922         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
32923         return ret_conv;
32924 }
32925
32926 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
32927         LDKUnsignedChannelUpdate this_obj_conv;
32928         this_obj_conv.inner = untag_ptr(this_obj);
32929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32931         UnsignedChannelUpdate_free(this_obj_conv);
32932 }
32933
32934 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
32935         LDKUnsignedChannelUpdate this_ptr_conv;
32936         this_ptr_conv.inner = untag_ptr(this_ptr);
32937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32939         this_ptr_conv.is_owned = false;
32940         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32941         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
32942         return ret_arr;
32943 }
32944
32945 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32946         LDKUnsignedChannelUpdate this_ptr_conv;
32947         this_ptr_conv.inner = untag_ptr(this_ptr);
32948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32950         this_ptr_conv.is_owned = false;
32951         LDKThirtyTwoBytes val_ref;
32952         CHECK(val->arr_len == 32);
32953         memcpy(val_ref.data, val->elems, 32); FREE(val);
32954         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
32955 }
32956
32957 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
32958         LDKUnsignedChannelUpdate this_ptr_conv;
32959         this_ptr_conv.inner = untag_ptr(this_ptr);
32960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32962         this_ptr_conv.is_owned = false;
32963         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
32964         return ret_conv;
32965 }
32966
32967 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32968         LDKUnsignedChannelUpdate this_ptr_conv;
32969         this_ptr_conv.inner = untag_ptr(this_ptr);
32970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972         this_ptr_conv.is_owned = false;
32973         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
32974 }
32975
32976 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
32977         LDKUnsignedChannelUpdate this_ptr_conv;
32978         this_ptr_conv.inner = untag_ptr(this_ptr);
32979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32981         this_ptr_conv.is_owned = false;
32982         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
32983         return ret_conv;
32984 }
32985
32986 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
32987         LDKUnsignedChannelUpdate this_ptr_conv;
32988         this_ptr_conv.inner = untag_ptr(this_ptr);
32989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32991         this_ptr_conv.is_owned = false;
32992         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
32993 }
32994
32995 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
32996         LDKUnsignedChannelUpdate this_ptr_conv;
32997         this_ptr_conv.inner = untag_ptr(this_ptr);
32998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33000         this_ptr_conv.is_owned = false;
33001         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33002         return ret_conv;
33003 }
33004
33005 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
33006         LDKUnsignedChannelUpdate this_ptr_conv;
33007         this_ptr_conv.inner = untag_ptr(this_ptr);
33008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33010         this_ptr_conv.is_owned = false;
33011         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33012 }
33013
33014 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
33015         LDKUnsignedChannelUpdate this_ptr_conv;
33016         this_ptr_conv.inner = untag_ptr(this_ptr);
33017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33019         this_ptr_conv.is_owned = false;
33020         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33021         return ret_conv;
33022 }
33023
33024 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
33025         LDKUnsignedChannelUpdate this_ptr_conv;
33026         this_ptr_conv.inner = untag_ptr(this_ptr);
33027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33029         this_ptr_conv.is_owned = false;
33030         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33031 }
33032
33033 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
33034         LDKUnsignedChannelUpdate this_ptr_conv;
33035         this_ptr_conv.inner = untag_ptr(this_ptr);
33036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33038         this_ptr_conv.is_owned = false;
33039         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33040         return ret_conv;
33041 }
33042
33043 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
33044         LDKUnsignedChannelUpdate this_ptr_conv;
33045         this_ptr_conv.inner = untag_ptr(this_ptr);
33046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33048         this_ptr_conv.is_owned = false;
33049         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33050 }
33051
33052 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
33053         LDKUnsignedChannelUpdate this_ptr_conv;
33054         this_ptr_conv.inner = untag_ptr(this_ptr);
33055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33057         this_ptr_conv.is_owned = false;
33058         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
33059         return ret_conv;
33060 }
33061
33062 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
33063         LDKUnsignedChannelUpdate this_ptr_conv;
33064         this_ptr_conv.inner = untag_ptr(this_ptr);
33065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33067         this_ptr_conv.is_owned = false;
33068         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
33069 }
33070
33071 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
33072         LDKUnsignedChannelUpdate this_ptr_conv;
33073         this_ptr_conv.inner = untag_ptr(this_ptr);
33074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33076         this_ptr_conv.is_owned = false;
33077         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
33078         return ret_conv;
33079 }
33080
33081 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
33082         LDKUnsignedChannelUpdate this_ptr_conv;
33083         this_ptr_conv.inner = untag_ptr(this_ptr);
33084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33086         this_ptr_conv.is_owned = false;
33087         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
33088 }
33089
33090 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
33091         LDKUnsignedChannelUpdate this_ptr_conv;
33092         this_ptr_conv.inner = untag_ptr(this_ptr);
33093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33095         this_ptr_conv.is_owned = false;
33096         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
33097         return ret_conv;
33098 }
33099
33100 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
33101         LDKUnsignedChannelUpdate this_ptr_conv;
33102         this_ptr_conv.inner = untag_ptr(this_ptr);
33103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33105         this_ptr_conv.is_owned = false;
33106         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
33107 }
33108
33109 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
33110         LDKUnsignedChannelUpdate this_ptr_conv;
33111         this_ptr_conv.inner = untag_ptr(this_ptr);
33112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33114         this_ptr_conv.is_owned = false;
33115         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
33116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33118         CVec_u8Z_free(ret_var);
33119         return ret_arr;
33120 }
33121
33122 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
33123         LDKUnsignedChannelUpdate this_ptr_conv;
33124         this_ptr_conv.inner = untag_ptr(this_ptr);
33125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33127         this_ptr_conv.is_owned = false;
33128         LDKCVec_u8Z val_ref;
33129         val_ref.datalen = val->arr_len;
33130         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
33131         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
33132         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
33133 }
33134
33135 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) {
33136         LDKThirtyTwoBytes chain_hash_arg_ref;
33137         CHECK(chain_hash_arg->arr_len == 32);
33138         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33139         LDKCVec_u8Z excess_data_arg_ref;
33140         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
33141         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
33142         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
33143         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);
33144         uint64_t ret_ref = 0;
33145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33147         return ret_ref;
33148 }
33149
33150 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
33151         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
33152         uint64_t ret_ref = 0;
33153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33155         return ret_ref;
33156 }
33157 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
33158         LDKUnsignedChannelUpdate arg_conv;
33159         arg_conv.inner = untag_ptr(arg);
33160         arg_conv.is_owned = ptr_is_owned(arg);
33161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33162         arg_conv.is_owned = false;
33163         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
33164         return ret_conv;
33165 }
33166
33167 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
33168         LDKUnsignedChannelUpdate orig_conv;
33169         orig_conv.inner = untag_ptr(orig);
33170         orig_conv.is_owned = ptr_is_owned(orig);
33171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33172         orig_conv.is_owned = false;
33173         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
33174         uint64_t ret_ref = 0;
33175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33177         return ret_ref;
33178 }
33179
33180 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
33181         LDKUnsignedChannelUpdate a_conv;
33182         a_conv.inner = untag_ptr(a);
33183         a_conv.is_owned = ptr_is_owned(a);
33184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33185         a_conv.is_owned = false;
33186         LDKUnsignedChannelUpdate b_conv;
33187         b_conv.inner = untag_ptr(b);
33188         b_conv.is_owned = ptr_is_owned(b);
33189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33190         b_conv.is_owned = false;
33191         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
33192         return ret_conv;
33193 }
33194
33195 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
33196         LDKChannelUpdate this_obj_conv;
33197         this_obj_conv.inner = untag_ptr(this_obj);
33198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33200         ChannelUpdate_free(this_obj_conv);
33201 }
33202
33203 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
33204         LDKChannelUpdate this_ptr_conv;
33205         this_ptr_conv.inner = untag_ptr(this_ptr);
33206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33208         this_ptr_conv.is_owned = false;
33209         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33210         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
33211         return ret_arr;
33212 }
33213
33214 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
33215         LDKChannelUpdate this_ptr_conv;
33216         this_ptr_conv.inner = untag_ptr(this_ptr);
33217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33219         this_ptr_conv.is_owned = false;
33220         LDKSignature val_ref;
33221         CHECK(val->arr_len == 64);
33222         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33223         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
33224 }
33225
33226 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
33227         LDKChannelUpdate this_ptr_conv;
33228         this_ptr_conv.inner = untag_ptr(this_ptr);
33229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33231         this_ptr_conv.is_owned = false;
33232         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
33233         uint64_t ret_ref = 0;
33234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33236         return ret_ref;
33237 }
33238
33239 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
33240         LDKChannelUpdate this_ptr_conv;
33241         this_ptr_conv.inner = untag_ptr(this_ptr);
33242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33244         this_ptr_conv.is_owned = false;
33245         LDKUnsignedChannelUpdate val_conv;
33246         val_conv.inner = untag_ptr(val);
33247         val_conv.is_owned = ptr_is_owned(val);
33248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33249         val_conv = UnsignedChannelUpdate_clone(&val_conv);
33250         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
33251 }
33252
33253 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
33254         LDKSignature signature_arg_ref;
33255         CHECK(signature_arg->arr_len == 64);
33256         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33257         LDKUnsignedChannelUpdate contents_arg_conv;
33258         contents_arg_conv.inner = untag_ptr(contents_arg);
33259         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33260         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33261         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
33262         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
33263         uint64_t ret_ref = 0;
33264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33266         return ret_ref;
33267 }
33268
33269 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
33270         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
33271         uint64_t ret_ref = 0;
33272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33274         return ret_ref;
33275 }
33276 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
33277         LDKChannelUpdate arg_conv;
33278         arg_conv.inner = untag_ptr(arg);
33279         arg_conv.is_owned = ptr_is_owned(arg);
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33281         arg_conv.is_owned = false;
33282         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
33283         return ret_conv;
33284 }
33285
33286 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
33287         LDKChannelUpdate orig_conv;
33288         orig_conv.inner = untag_ptr(orig);
33289         orig_conv.is_owned = ptr_is_owned(orig);
33290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33291         orig_conv.is_owned = false;
33292         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
33293         uint64_t ret_ref = 0;
33294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33296         return ret_ref;
33297 }
33298
33299 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
33300         LDKChannelUpdate a_conv;
33301         a_conv.inner = untag_ptr(a);
33302         a_conv.is_owned = ptr_is_owned(a);
33303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33304         a_conv.is_owned = false;
33305         LDKChannelUpdate b_conv;
33306         b_conv.inner = untag_ptr(b);
33307         b_conv.is_owned = ptr_is_owned(b);
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33309         b_conv.is_owned = false;
33310         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
33311         return ret_conv;
33312 }
33313
33314 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
33315         LDKQueryChannelRange this_obj_conv;
33316         this_obj_conv.inner = untag_ptr(this_obj);
33317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33319         QueryChannelRange_free(this_obj_conv);
33320 }
33321
33322 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
33323         LDKQueryChannelRange this_ptr_conv;
33324         this_ptr_conv.inner = untag_ptr(this_ptr);
33325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33327         this_ptr_conv.is_owned = false;
33328         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33329         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
33330         return ret_arr;
33331 }
33332
33333 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33334         LDKQueryChannelRange this_ptr_conv;
33335         this_ptr_conv.inner = untag_ptr(this_ptr);
33336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33338         this_ptr_conv.is_owned = false;
33339         LDKThirtyTwoBytes val_ref;
33340         CHECK(val->arr_len == 32);
33341         memcpy(val_ref.data, val->elems, 32); FREE(val);
33342         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33343 }
33344
33345 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
33346         LDKQueryChannelRange this_ptr_conv;
33347         this_ptr_conv.inner = untag_ptr(this_ptr);
33348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33350         this_ptr_conv.is_owned = false;
33351         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
33352         return ret_conv;
33353 }
33354
33355 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
33356         LDKQueryChannelRange this_ptr_conv;
33357         this_ptr_conv.inner = untag_ptr(this_ptr);
33358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33360         this_ptr_conv.is_owned = false;
33361         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
33362 }
33363
33364 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
33365         LDKQueryChannelRange this_ptr_conv;
33366         this_ptr_conv.inner = untag_ptr(this_ptr);
33367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33369         this_ptr_conv.is_owned = false;
33370         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
33371         return ret_conv;
33372 }
33373
33374 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
33375         LDKQueryChannelRange this_ptr_conv;
33376         this_ptr_conv.inner = untag_ptr(this_ptr);
33377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33379         this_ptr_conv.is_owned = false;
33380         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33381 }
33382
33383 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) {
33384         LDKThirtyTwoBytes chain_hash_arg_ref;
33385         CHECK(chain_hash_arg->arr_len == 32);
33386         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33387         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
33388         uint64_t ret_ref = 0;
33389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33391         return ret_ref;
33392 }
33393
33394 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
33395         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
33396         uint64_t ret_ref = 0;
33397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33399         return ret_ref;
33400 }
33401 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
33402         LDKQueryChannelRange arg_conv;
33403         arg_conv.inner = untag_ptr(arg);
33404         arg_conv.is_owned = ptr_is_owned(arg);
33405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33406         arg_conv.is_owned = false;
33407         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
33408         return ret_conv;
33409 }
33410
33411 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
33412         LDKQueryChannelRange orig_conv;
33413         orig_conv.inner = untag_ptr(orig);
33414         orig_conv.is_owned = ptr_is_owned(orig);
33415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33416         orig_conv.is_owned = false;
33417         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
33418         uint64_t ret_ref = 0;
33419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33421         return ret_ref;
33422 }
33423
33424 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
33425         LDKQueryChannelRange a_conv;
33426         a_conv.inner = untag_ptr(a);
33427         a_conv.is_owned = ptr_is_owned(a);
33428         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33429         a_conv.is_owned = false;
33430         LDKQueryChannelRange b_conv;
33431         b_conv.inner = untag_ptr(b);
33432         b_conv.is_owned = ptr_is_owned(b);
33433         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33434         b_conv.is_owned = false;
33435         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
33436         return ret_conv;
33437 }
33438
33439 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
33440         LDKReplyChannelRange this_obj_conv;
33441         this_obj_conv.inner = untag_ptr(this_obj);
33442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33444         ReplyChannelRange_free(this_obj_conv);
33445 }
33446
33447 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
33448         LDKReplyChannelRange this_ptr_conv;
33449         this_ptr_conv.inner = untag_ptr(this_ptr);
33450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33452         this_ptr_conv.is_owned = false;
33453         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33454         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
33455         return ret_arr;
33456 }
33457
33458 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33459         LDKReplyChannelRange this_ptr_conv;
33460         this_ptr_conv.inner = untag_ptr(this_ptr);
33461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33463         this_ptr_conv.is_owned = false;
33464         LDKThirtyTwoBytes val_ref;
33465         CHECK(val->arr_len == 32);
33466         memcpy(val_ref.data, val->elems, 32); FREE(val);
33467         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33468 }
33469
33470 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
33471         LDKReplyChannelRange this_ptr_conv;
33472         this_ptr_conv.inner = untag_ptr(this_ptr);
33473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33475         this_ptr_conv.is_owned = false;
33476         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
33477         return ret_conv;
33478 }
33479
33480 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
33481         LDKReplyChannelRange this_ptr_conv;
33482         this_ptr_conv.inner = untag_ptr(this_ptr);
33483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33485         this_ptr_conv.is_owned = false;
33486         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
33487 }
33488
33489 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
33490         LDKReplyChannelRange this_ptr_conv;
33491         this_ptr_conv.inner = untag_ptr(this_ptr);
33492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33494         this_ptr_conv.is_owned = false;
33495         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
33496         return ret_conv;
33497 }
33498
33499 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
33500         LDKReplyChannelRange this_ptr_conv;
33501         this_ptr_conv.inner = untag_ptr(this_ptr);
33502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33504         this_ptr_conv.is_owned = false;
33505         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33506 }
33507
33508 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
33509         LDKReplyChannelRange this_ptr_conv;
33510         this_ptr_conv.inner = untag_ptr(this_ptr);
33511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33513         this_ptr_conv.is_owned = false;
33514         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
33515         return ret_conv;
33516 }
33517
33518 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
33519         LDKReplyChannelRange this_ptr_conv;
33520         this_ptr_conv.inner = untag_ptr(this_ptr);
33521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33523         this_ptr_conv.is_owned = false;
33524         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
33525 }
33526
33527 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
33528         LDKReplyChannelRange this_ptr_conv;
33529         this_ptr_conv.inner = untag_ptr(this_ptr);
33530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33532         this_ptr_conv.is_owned = false;
33533         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
33534         int64_tArray ret_arr = NULL;
33535         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
33536         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
33537         for (size_t i = 0; i < ret_var.datalen; i++) {
33538                 int64_t ret_conv_8_conv = ret_var.data[i];
33539                 ret_arr_ptr[i] = ret_conv_8_conv;
33540         }
33541         
33542         FREE(ret_var.data);
33543         return ret_arr;
33544 }
33545
33546 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
33547         LDKReplyChannelRange this_ptr_conv;
33548         this_ptr_conv.inner = untag_ptr(this_ptr);
33549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33551         this_ptr_conv.is_owned = false;
33552         LDKCVec_u64Z val_constr;
33553         val_constr.datalen = val->arr_len;
33554         if (val_constr.datalen > 0)
33555                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33556         else
33557                 val_constr.data = NULL;
33558         int64_t* val_vals = val->elems;
33559         for (size_t i = 0; i < val_constr.datalen; i++) {
33560                 int64_t val_conv_8 = val_vals[i];
33561                 val_constr.data[i] = val_conv_8;
33562         }
33563         FREE(val);
33564         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
33565 }
33566
33567 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) {
33568         LDKThirtyTwoBytes chain_hash_arg_ref;
33569         CHECK(chain_hash_arg->arr_len == 32);
33570         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33571         LDKCVec_u64Z short_channel_ids_arg_constr;
33572         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
33573         if (short_channel_ids_arg_constr.datalen > 0)
33574                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33575         else
33576                 short_channel_ids_arg_constr.data = NULL;
33577         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
33578         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
33579                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
33580                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
33581         }
33582         FREE(short_channel_ids_arg);
33583         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
33584         uint64_t ret_ref = 0;
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33587         return ret_ref;
33588 }
33589
33590 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
33591         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
33592         uint64_t ret_ref = 0;
33593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33595         return ret_ref;
33596 }
33597 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
33598         LDKReplyChannelRange arg_conv;
33599         arg_conv.inner = untag_ptr(arg);
33600         arg_conv.is_owned = ptr_is_owned(arg);
33601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33602         arg_conv.is_owned = false;
33603         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
33604         return ret_conv;
33605 }
33606
33607 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
33608         LDKReplyChannelRange orig_conv;
33609         orig_conv.inner = untag_ptr(orig);
33610         orig_conv.is_owned = ptr_is_owned(orig);
33611         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33612         orig_conv.is_owned = false;
33613         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
33614         uint64_t ret_ref = 0;
33615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33617         return ret_ref;
33618 }
33619
33620 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
33621         LDKReplyChannelRange a_conv;
33622         a_conv.inner = untag_ptr(a);
33623         a_conv.is_owned = ptr_is_owned(a);
33624         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33625         a_conv.is_owned = false;
33626         LDKReplyChannelRange b_conv;
33627         b_conv.inner = untag_ptr(b);
33628         b_conv.is_owned = ptr_is_owned(b);
33629         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33630         b_conv.is_owned = false;
33631         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
33632         return ret_conv;
33633 }
33634
33635 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
33636         LDKQueryShortChannelIds this_obj_conv;
33637         this_obj_conv.inner = untag_ptr(this_obj);
33638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33640         QueryShortChannelIds_free(this_obj_conv);
33641 }
33642
33643 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
33644         LDKQueryShortChannelIds this_ptr_conv;
33645         this_ptr_conv.inner = untag_ptr(this_ptr);
33646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33648         this_ptr_conv.is_owned = false;
33649         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33650         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
33651         return ret_arr;
33652 }
33653
33654 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33655         LDKQueryShortChannelIds this_ptr_conv;
33656         this_ptr_conv.inner = untag_ptr(this_ptr);
33657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33659         this_ptr_conv.is_owned = false;
33660         LDKThirtyTwoBytes val_ref;
33661         CHECK(val->arr_len == 32);
33662         memcpy(val_ref.data, val->elems, 32); FREE(val);
33663         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
33664 }
33665
33666 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
33667         LDKQueryShortChannelIds this_ptr_conv;
33668         this_ptr_conv.inner = untag_ptr(this_ptr);
33669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33671         this_ptr_conv.is_owned = false;
33672         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
33673         int64_tArray ret_arr = NULL;
33674         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
33675         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
33676         for (size_t i = 0; i < ret_var.datalen; i++) {
33677                 int64_t ret_conv_8_conv = ret_var.data[i];
33678                 ret_arr_ptr[i] = ret_conv_8_conv;
33679         }
33680         
33681         FREE(ret_var.data);
33682         return ret_arr;
33683 }
33684
33685 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
33686         LDKQueryShortChannelIds this_ptr_conv;
33687         this_ptr_conv.inner = untag_ptr(this_ptr);
33688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690         this_ptr_conv.is_owned = false;
33691         LDKCVec_u64Z val_constr;
33692         val_constr.datalen = val->arr_len;
33693         if (val_constr.datalen > 0)
33694                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33695         else
33696                 val_constr.data = NULL;
33697         int64_t* val_vals = val->elems;
33698         for (size_t i = 0; i < val_constr.datalen; i++) {
33699                 int64_t val_conv_8 = val_vals[i];
33700                 val_constr.data[i] = val_conv_8;
33701         }
33702         FREE(val);
33703         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
33704 }
33705
33706 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
33707         LDKThirtyTwoBytes chain_hash_arg_ref;
33708         CHECK(chain_hash_arg->arr_len == 32);
33709         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33710         LDKCVec_u64Z short_channel_ids_arg_constr;
33711         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
33712         if (short_channel_ids_arg_constr.datalen > 0)
33713                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33714         else
33715                 short_channel_ids_arg_constr.data = NULL;
33716         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
33717         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
33718                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
33719                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
33720         }
33721         FREE(short_channel_ids_arg);
33722         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
33723         uint64_t ret_ref = 0;
33724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33726         return ret_ref;
33727 }
33728
33729 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
33730         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
33731         uint64_t ret_ref = 0;
33732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33734         return ret_ref;
33735 }
33736 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
33737         LDKQueryShortChannelIds arg_conv;
33738         arg_conv.inner = untag_ptr(arg);
33739         arg_conv.is_owned = ptr_is_owned(arg);
33740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33741         arg_conv.is_owned = false;
33742         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
33743         return ret_conv;
33744 }
33745
33746 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
33747         LDKQueryShortChannelIds orig_conv;
33748         orig_conv.inner = untag_ptr(orig);
33749         orig_conv.is_owned = ptr_is_owned(orig);
33750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33751         orig_conv.is_owned = false;
33752         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
33753         uint64_t ret_ref = 0;
33754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33756         return ret_ref;
33757 }
33758
33759 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
33760         LDKQueryShortChannelIds a_conv;
33761         a_conv.inner = untag_ptr(a);
33762         a_conv.is_owned = ptr_is_owned(a);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33764         a_conv.is_owned = false;
33765         LDKQueryShortChannelIds b_conv;
33766         b_conv.inner = untag_ptr(b);
33767         b_conv.is_owned = ptr_is_owned(b);
33768         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33769         b_conv.is_owned = false;
33770         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
33771         return ret_conv;
33772 }
33773
33774 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
33775         LDKReplyShortChannelIdsEnd this_obj_conv;
33776         this_obj_conv.inner = untag_ptr(this_obj);
33777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33779         ReplyShortChannelIdsEnd_free(this_obj_conv);
33780 }
33781
33782 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
33783         LDKReplyShortChannelIdsEnd this_ptr_conv;
33784         this_ptr_conv.inner = untag_ptr(this_ptr);
33785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33787         this_ptr_conv.is_owned = false;
33788         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33789         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
33790         return ret_arr;
33791 }
33792
33793 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33794         LDKReplyShortChannelIdsEnd this_ptr_conv;
33795         this_ptr_conv.inner = untag_ptr(this_ptr);
33796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33798         this_ptr_conv.is_owned = false;
33799         LDKThirtyTwoBytes val_ref;
33800         CHECK(val->arr_len == 32);
33801         memcpy(val_ref.data, val->elems, 32); FREE(val);
33802         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
33803 }
33804
33805 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
33806         LDKReplyShortChannelIdsEnd this_ptr_conv;
33807         this_ptr_conv.inner = untag_ptr(this_ptr);
33808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33810         this_ptr_conv.is_owned = false;
33811         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
33812         return ret_conv;
33813 }
33814
33815 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
33816         LDKReplyShortChannelIdsEnd this_ptr_conv;
33817         this_ptr_conv.inner = untag_ptr(this_ptr);
33818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33820         this_ptr_conv.is_owned = false;
33821         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
33822 }
33823
33824 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
33825         LDKThirtyTwoBytes chain_hash_arg_ref;
33826         CHECK(chain_hash_arg->arr_len == 32);
33827         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33828         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
33829         uint64_t ret_ref = 0;
33830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33832         return ret_ref;
33833 }
33834
33835 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
33836         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
33837         uint64_t ret_ref = 0;
33838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33840         return ret_ref;
33841 }
33842 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
33843         LDKReplyShortChannelIdsEnd arg_conv;
33844         arg_conv.inner = untag_ptr(arg);
33845         arg_conv.is_owned = ptr_is_owned(arg);
33846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33847         arg_conv.is_owned = false;
33848         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
33849         return ret_conv;
33850 }
33851
33852 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
33853         LDKReplyShortChannelIdsEnd orig_conv;
33854         orig_conv.inner = untag_ptr(orig);
33855         orig_conv.is_owned = ptr_is_owned(orig);
33856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33857         orig_conv.is_owned = false;
33858         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33859         uint64_t ret_ref = 0;
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33862         return ret_ref;
33863 }
33864
33865 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
33866         LDKReplyShortChannelIdsEnd a_conv;
33867         a_conv.inner = untag_ptr(a);
33868         a_conv.is_owned = ptr_is_owned(a);
33869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33870         a_conv.is_owned = false;
33871         LDKReplyShortChannelIdsEnd b_conv;
33872         b_conv.inner = untag_ptr(b);
33873         b_conv.is_owned = ptr_is_owned(b);
33874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33875         b_conv.is_owned = false;
33876         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
33877         return ret_conv;
33878 }
33879
33880 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
33881         LDKGossipTimestampFilter this_obj_conv;
33882         this_obj_conv.inner = untag_ptr(this_obj);
33883         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33885         GossipTimestampFilter_free(this_obj_conv);
33886 }
33887
33888 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
33889         LDKGossipTimestampFilter this_ptr_conv;
33890         this_ptr_conv.inner = untag_ptr(this_ptr);
33891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33893         this_ptr_conv.is_owned = false;
33894         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33895         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
33896         return ret_arr;
33897 }
33898
33899 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33900         LDKGossipTimestampFilter this_ptr_conv;
33901         this_ptr_conv.inner = untag_ptr(this_ptr);
33902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33904         this_ptr_conv.is_owned = false;
33905         LDKThirtyTwoBytes val_ref;
33906         CHECK(val->arr_len == 32);
33907         memcpy(val_ref.data, val->elems, 32); FREE(val);
33908         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
33909 }
33910
33911 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
33912         LDKGossipTimestampFilter this_ptr_conv;
33913         this_ptr_conv.inner = untag_ptr(this_ptr);
33914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33916         this_ptr_conv.is_owned = false;
33917         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
33918         return ret_conv;
33919 }
33920
33921 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
33922         LDKGossipTimestampFilter this_ptr_conv;
33923         this_ptr_conv.inner = untag_ptr(this_ptr);
33924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33926         this_ptr_conv.is_owned = false;
33927         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
33928 }
33929
33930 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
33931         LDKGossipTimestampFilter this_ptr_conv;
33932         this_ptr_conv.inner = untag_ptr(this_ptr);
33933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33935         this_ptr_conv.is_owned = false;
33936         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
33937         return ret_conv;
33938 }
33939
33940 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
33941         LDKGossipTimestampFilter this_ptr_conv;
33942         this_ptr_conv.inner = untag_ptr(this_ptr);
33943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33945         this_ptr_conv.is_owned = false;
33946         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
33947 }
33948
33949 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) {
33950         LDKThirtyTwoBytes chain_hash_arg_ref;
33951         CHECK(chain_hash_arg->arr_len == 32);
33952         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33953         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
33954         uint64_t ret_ref = 0;
33955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33957         return ret_ref;
33958 }
33959
33960 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
33961         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
33962         uint64_t ret_ref = 0;
33963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33965         return ret_ref;
33966 }
33967 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
33968         LDKGossipTimestampFilter arg_conv;
33969         arg_conv.inner = untag_ptr(arg);
33970         arg_conv.is_owned = ptr_is_owned(arg);
33971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33972         arg_conv.is_owned = false;
33973         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
33974         return ret_conv;
33975 }
33976
33977 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
33978         LDKGossipTimestampFilter orig_conv;
33979         orig_conv.inner = untag_ptr(orig);
33980         orig_conv.is_owned = ptr_is_owned(orig);
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33982         orig_conv.is_owned = false;
33983         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
33984         uint64_t ret_ref = 0;
33985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33987         return ret_ref;
33988 }
33989
33990 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
33991         LDKGossipTimestampFilter a_conv;
33992         a_conv.inner = untag_ptr(a);
33993         a_conv.is_owned = ptr_is_owned(a);
33994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33995         a_conv.is_owned = false;
33996         LDKGossipTimestampFilter b_conv;
33997         b_conv.inner = untag_ptr(b);
33998         b_conv.is_owned = ptr_is_owned(b);
33999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34000         b_conv.is_owned = false;
34001         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
34002         return ret_conv;
34003 }
34004
34005 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
34006         if (!ptr_is_owned(this_ptr)) return;
34007         void* this_ptr_ptr = untag_ptr(this_ptr);
34008         CHECK_ACCESS(this_ptr_ptr);
34009         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34010         FREE(untag_ptr(this_ptr));
34011         ErrorAction_free(this_ptr_conv);
34012 }
34013
34014 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34015         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34016         *ret_copy = ErrorAction_clone(arg);
34017         uint64_t ret_ref = tag_ptr(ret_copy, true);
34018         return ret_ref;
34019 }
34020 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
34021         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
34022         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
34023         return ret_conv;
34024 }
34025
34026 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
34027         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
34028         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34029         *ret_copy = ErrorAction_clone(orig_conv);
34030         uint64_t ret_ref = tag_ptr(ret_copy, true);
34031         return ret_ref;
34032 }
34033
34034 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
34035         LDKErrorMessage msg_conv;
34036         msg_conv.inner = untag_ptr(msg);
34037         msg_conv.is_owned = ptr_is_owned(msg);
34038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34039         msg_conv = ErrorMessage_clone(&msg_conv);
34040         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34041         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34042         uint64_t ret_ref = tag_ptr(ret_copy, true);
34043         return ret_ref;
34044 }
34045
34046 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
34047         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34048         *ret_copy = ErrorAction_ignore_error();
34049         uint64_t ret_ref = tag_ptr(ret_copy, true);
34050         return ret_ref;
34051 }
34052
34053 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
34054         LDKLevel a_conv = LDKLevel_from_js(a);
34055         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34056         *ret_copy = ErrorAction_ignore_and_log(a_conv);
34057         uint64_t ret_ref = tag_ptr(ret_copy, true);
34058         return ret_ref;
34059 }
34060
34061 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
34062         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34063         *ret_copy = ErrorAction_ignore_duplicate_gossip();
34064         uint64_t ret_ref = tag_ptr(ret_copy, true);
34065         return ret_ref;
34066 }
34067
34068 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
34069         LDKErrorMessage msg_conv;
34070         msg_conv.inner = untag_ptr(msg);
34071         msg_conv.is_owned = ptr_is_owned(msg);
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34073         msg_conv = ErrorMessage_clone(&msg_conv);
34074         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34075         *ret_copy = ErrorAction_send_error_message(msg_conv);
34076         uint64_t ret_ref = tag_ptr(ret_copy, true);
34077         return ret_ref;
34078 }
34079
34080 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
34081         LDKWarningMessage msg_conv;
34082         msg_conv.inner = untag_ptr(msg);
34083         msg_conv.is_owned = ptr_is_owned(msg);
34084         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34085         msg_conv = WarningMessage_clone(&msg_conv);
34086         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
34087         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34088         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34089         uint64_t ret_ref = tag_ptr(ret_copy, true);
34090         return ret_ref;
34091 }
34092
34093 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
34094         LDKLightningError this_obj_conv;
34095         this_obj_conv.inner = untag_ptr(this_obj);
34096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34098         LightningError_free(this_obj_conv);
34099 }
34100
34101 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
34102         LDKLightningError this_ptr_conv;
34103         this_ptr_conv.inner = untag_ptr(this_ptr);
34104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34106         this_ptr_conv.is_owned = false;
34107         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34108         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34109         Str_free(ret_str);
34110         return ret_conv;
34111 }
34112
34113 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
34114         LDKLightningError this_ptr_conv;
34115         this_ptr_conv.inner = untag_ptr(this_ptr);
34116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34118         this_ptr_conv.is_owned = false;
34119         LDKStr val_conv = str_ref_to_owned_c(val);
34120         LightningError_set_err(&this_ptr_conv, val_conv);
34121 }
34122
34123 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
34124         LDKLightningError this_ptr_conv;
34125         this_ptr_conv.inner = untag_ptr(this_ptr);
34126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34128         this_ptr_conv.is_owned = false;
34129         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34130         *ret_copy = LightningError_get_action(&this_ptr_conv);
34131         uint64_t ret_ref = tag_ptr(ret_copy, true);
34132         return ret_ref;
34133 }
34134
34135 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
34136         LDKLightningError this_ptr_conv;
34137         this_ptr_conv.inner = untag_ptr(this_ptr);
34138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34140         this_ptr_conv.is_owned = false;
34141         void* val_ptr = untag_ptr(val);
34142         CHECK_ACCESS(val_ptr);
34143         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34144         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
34145         LightningError_set_action(&this_ptr_conv, val_conv);
34146 }
34147
34148 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
34149         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
34150         void* action_arg_ptr = untag_ptr(action_arg);
34151         CHECK_ACCESS(action_arg_ptr);
34152         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34153         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
34154         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34155         uint64_t ret_ref = 0;
34156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34158         return ret_ref;
34159 }
34160
34161 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34162         LDKLightningError ret_var = LightningError_clone(arg);
34163         uint64_t ret_ref = 0;
34164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34166         return ret_ref;
34167 }
34168 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
34169         LDKLightningError arg_conv;
34170         arg_conv.inner = untag_ptr(arg);
34171         arg_conv.is_owned = ptr_is_owned(arg);
34172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34173         arg_conv.is_owned = false;
34174         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
34175         return ret_conv;
34176 }
34177
34178 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
34179         LDKLightningError orig_conv;
34180         orig_conv.inner = untag_ptr(orig);
34181         orig_conv.is_owned = ptr_is_owned(orig);
34182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34183         orig_conv.is_owned = false;
34184         LDKLightningError ret_var = LightningError_clone(&orig_conv);
34185         uint64_t ret_ref = 0;
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34188         return ret_ref;
34189 }
34190
34191 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
34192         LDKCommitmentUpdate this_obj_conv;
34193         this_obj_conv.inner = untag_ptr(this_obj);
34194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34196         CommitmentUpdate_free(this_obj_conv);
34197 }
34198
34199 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
34200         LDKCommitmentUpdate this_ptr_conv;
34201         this_ptr_conv.inner = untag_ptr(this_ptr);
34202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34204         this_ptr_conv.is_owned = false;
34205         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
34206         uint64_tArray ret_arr = NULL;
34207         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34208         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34209         for (size_t p = 0; p < ret_var.datalen; p++) {
34210                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
34211                 uint64_t ret_conv_15_ref = 0;
34212                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
34213                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
34214                 ret_arr_ptr[p] = ret_conv_15_ref;
34215         }
34216         
34217         FREE(ret_var.data);
34218         return ret_arr;
34219 }
34220
34221 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
34222         LDKCommitmentUpdate this_ptr_conv;
34223         this_ptr_conv.inner = untag_ptr(this_ptr);
34224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34226         this_ptr_conv.is_owned = false;
34227         LDKCVec_UpdateAddHTLCZ val_constr;
34228         val_constr.datalen = val->arr_len;
34229         if (val_constr.datalen > 0)
34230                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34231         else
34232                 val_constr.data = NULL;
34233         uint64_t* val_vals = val->elems;
34234         for (size_t p = 0; p < val_constr.datalen; p++) {
34235                 uint64_t val_conv_15 = val_vals[p];
34236                 LDKUpdateAddHTLC val_conv_15_conv;
34237                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
34238                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
34239                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
34240                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
34241                 val_constr.data[p] = val_conv_15_conv;
34242         }
34243         FREE(val);
34244         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
34245 }
34246
34247 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
34248         LDKCommitmentUpdate this_ptr_conv;
34249         this_ptr_conv.inner = untag_ptr(this_ptr);
34250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34252         this_ptr_conv.is_owned = false;
34253         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
34254         uint64_tArray ret_arr = NULL;
34255         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34256         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34257         for (size_t t = 0; t < ret_var.datalen; t++) {
34258                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
34259                 uint64_t ret_conv_19_ref = 0;
34260                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
34261                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
34262                 ret_arr_ptr[t] = ret_conv_19_ref;
34263         }
34264         
34265         FREE(ret_var.data);
34266         return ret_arr;
34267 }
34268
34269 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
34270         LDKCommitmentUpdate this_ptr_conv;
34271         this_ptr_conv.inner = untag_ptr(this_ptr);
34272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34274         this_ptr_conv.is_owned = false;
34275         LDKCVec_UpdateFulfillHTLCZ val_constr;
34276         val_constr.datalen = val->arr_len;
34277         if (val_constr.datalen > 0)
34278                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34279         else
34280                 val_constr.data = NULL;
34281         uint64_t* val_vals = val->elems;
34282         for (size_t t = 0; t < val_constr.datalen; t++) {
34283                 uint64_t val_conv_19 = val_vals[t];
34284                 LDKUpdateFulfillHTLC val_conv_19_conv;
34285                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
34286                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
34287                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
34288                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
34289                 val_constr.data[t] = val_conv_19_conv;
34290         }
34291         FREE(val);
34292         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
34293 }
34294
34295 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
34296         LDKCommitmentUpdate this_ptr_conv;
34297         this_ptr_conv.inner = untag_ptr(this_ptr);
34298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34300         this_ptr_conv.is_owned = false;
34301         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
34302         uint64_tArray ret_arr = NULL;
34303         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34304         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34305         for (size_t q = 0; q < ret_var.datalen; q++) {
34306                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
34307                 uint64_t ret_conv_16_ref = 0;
34308                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34309                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
34310                 ret_arr_ptr[q] = ret_conv_16_ref;
34311         }
34312         
34313         FREE(ret_var.data);
34314         return ret_arr;
34315 }
34316
34317 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
34318         LDKCommitmentUpdate this_ptr_conv;
34319         this_ptr_conv.inner = untag_ptr(this_ptr);
34320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34322         this_ptr_conv.is_owned = false;
34323         LDKCVec_UpdateFailHTLCZ val_constr;
34324         val_constr.datalen = val->arr_len;
34325         if (val_constr.datalen > 0)
34326                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34327         else
34328                 val_constr.data = NULL;
34329         uint64_t* val_vals = val->elems;
34330         for (size_t q = 0; q < val_constr.datalen; q++) {
34331                 uint64_t val_conv_16 = val_vals[q];
34332                 LDKUpdateFailHTLC val_conv_16_conv;
34333                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
34334                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
34335                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34336                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
34337                 val_constr.data[q] = val_conv_16_conv;
34338         }
34339         FREE(val);
34340         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
34341 }
34342
34343 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
34344         LDKCommitmentUpdate this_ptr_conv;
34345         this_ptr_conv.inner = untag_ptr(this_ptr);
34346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34348         this_ptr_conv.is_owned = false;
34349         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
34350         uint64_tArray ret_arr = NULL;
34351         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
34352         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
34353         for (size_t z = 0; z < ret_var.datalen; z++) {
34354                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
34355                 uint64_t ret_conv_25_ref = 0;
34356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
34357                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
34358                 ret_arr_ptr[z] = ret_conv_25_ref;
34359         }
34360         
34361         FREE(ret_var.data);
34362         return ret_arr;
34363 }
34364
34365 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) {
34366         LDKCommitmentUpdate this_ptr_conv;
34367         this_ptr_conv.inner = untag_ptr(this_ptr);
34368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34370         this_ptr_conv.is_owned = false;
34371         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
34372         val_constr.datalen = val->arr_len;
34373         if (val_constr.datalen > 0)
34374                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34375         else
34376                 val_constr.data = NULL;
34377         uint64_t* val_vals = val->elems;
34378         for (size_t z = 0; z < val_constr.datalen; z++) {
34379                 uint64_t val_conv_25 = val_vals[z];
34380                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
34381                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
34382                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
34383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
34384                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
34385                 val_constr.data[z] = val_conv_25_conv;
34386         }
34387         FREE(val);
34388         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
34389 }
34390
34391 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
34392         LDKCommitmentUpdate this_ptr_conv;
34393         this_ptr_conv.inner = untag_ptr(this_ptr);
34394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34396         this_ptr_conv.is_owned = false;
34397         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
34398         uint64_t ret_ref = 0;
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34401         return ret_ref;
34402 }
34403
34404 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
34405         LDKCommitmentUpdate this_ptr_conv;
34406         this_ptr_conv.inner = untag_ptr(this_ptr);
34407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34409         this_ptr_conv.is_owned = false;
34410         LDKUpdateFee val_conv;
34411         val_conv.inner = untag_ptr(val);
34412         val_conv.is_owned = ptr_is_owned(val);
34413         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34414         val_conv = UpdateFee_clone(&val_conv);
34415         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
34416 }
34417
34418 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
34419         LDKCommitmentUpdate this_ptr_conv;
34420         this_ptr_conv.inner = untag_ptr(this_ptr);
34421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34423         this_ptr_conv.is_owned = false;
34424         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
34425         uint64_t ret_ref = 0;
34426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34428         return ret_ref;
34429 }
34430
34431 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
34432         LDKCommitmentUpdate this_ptr_conv;
34433         this_ptr_conv.inner = untag_ptr(this_ptr);
34434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34436         this_ptr_conv.is_owned = false;
34437         LDKCommitmentSigned val_conv;
34438         val_conv.inner = untag_ptr(val);
34439         val_conv.is_owned = ptr_is_owned(val);
34440         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34441         val_conv = CommitmentSigned_clone(&val_conv);
34442         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
34443 }
34444
34445 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) {
34446         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
34447         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
34448         if (update_add_htlcs_arg_constr.datalen > 0)
34449                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34450         else
34451                 update_add_htlcs_arg_constr.data = NULL;
34452         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
34453         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
34454                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
34455                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
34456                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
34457                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
34458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
34459                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
34460                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
34461         }
34462         FREE(update_add_htlcs_arg);
34463         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
34464         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
34465         if (update_fulfill_htlcs_arg_constr.datalen > 0)
34466                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34467         else
34468                 update_fulfill_htlcs_arg_constr.data = NULL;
34469         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
34470         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
34471                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
34472                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
34473                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
34474                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
34475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
34476                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
34477                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
34478         }
34479         FREE(update_fulfill_htlcs_arg);
34480         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
34481         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
34482         if (update_fail_htlcs_arg_constr.datalen > 0)
34483                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34484         else
34485                 update_fail_htlcs_arg_constr.data = NULL;
34486         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
34487         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
34488                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
34489                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
34490                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
34491                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
34492                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
34493                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
34494                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
34495         }
34496         FREE(update_fail_htlcs_arg);
34497         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
34498         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
34499         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
34500                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34501         else
34502                 update_fail_malformed_htlcs_arg_constr.data = NULL;
34503         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
34504         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
34505                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
34506                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
34507                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
34508                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
34509                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
34510                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
34511                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
34512         }
34513         FREE(update_fail_malformed_htlcs_arg);
34514         LDKUpdateFee update_fee_arg_conv;
34515         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
34516         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
34517         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
34518         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
34519         LDKCommitmentSigned commitment_signed_arg_conv;
34520         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
34521         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
34522         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
34523         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
34524         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);
34525         uint64_t ret_ref = 0;
34526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34528         return ret_ref;
34529 }
34530
34531 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
34532         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
34533         uint64_t ret_ref = 0;
34534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34536         return ret_ref;
34537 }
34538 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
34539         LDKCommitmentUpdate arg_conv;
34540         arg_conv.inner = untag_ptr(arg);
34541         arg_conv.is_owned = ptr_is_owned(arg);
34542         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34543         arg_conv.is_owned = false;
34544         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
34545         return ret_conv;
34546 }
34547
34548 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
34549         LDKCommitmentUpdate orig_conv;
34550         orig_conv.inner = untag_ptr(orig);
34551         orig_conv.is_owned = ptr_is_owned(orig);
34552         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34553         orig_conv.is_owned = false;
34554         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
34555         uint64_t ret_ref = 0;
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34558         return ret_ref;
34559 }
34560
34561 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
34562         LDKCommitmentUpdate a_conv;
34563         a_conv.inner = untag_ptr(a);
34564         a_conv.is_owned = ptr_is_owned(a);
34565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34566         a_conv.is_owned = false;
34567         LDKCommitmentUpdate b_conv;
34568         b_conv.inner = untag_ptr(b);
34569         b_conv.is_owned = ptr_is_owned(b);
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34571         b_conv.is_owned = false;
34572         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
34573         return ret_conv;
34574 }
34575
34576 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
34577         if (!ptr_is_owned(this_ptr)) return;
34578         void* this_ptr_ptr = untag_ptr(this_ptr);
34579         CHECK_ACCESS(this_ptr_ptr);
34580         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
34581         FREE(untag_ptr(this_ptr));
34582         ChannelMessageHandler_free(this_ptr_conv);
34583 }
34584
34585 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
34586         if (!ptr_is_owned(this_ptr)) return;
34587         void* this_ptr_ptr = untag_ptr(this_ptr);
34588         CHECK_ACCESS(this_ptr_ptr);
34589         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
34590         FREE(untag_ptr(this_ptr));
34591         RoutingMessageHandler_free(this_ptr_conv);
34592 }
34593
34594 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
34595         if (!ptr_is_owned(this_ptr)) return;
34596         void* this_ptr_ptr = untag_ptr(this_ptr);
34597         CHECK_ACCESS(this_ptr_ptr);
34598         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
34599         FREE(untag_ptr(this_ptr));
34600         OnionMessageHandler_free(this_ptr_conv);
34601 }
34602
34603 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
34604         LDKAcceptChannel obj_conv;
34605         obj_conv.inner = untag_ptr(obj);
34606         obj_conv.is_owned = ptr_is_owned(obj);
34607         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34608         obj_conv.is_owned = false;
34609         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
34610         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34611         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34612         CVec_u8Z_free(ret_var);
34613         return ret_arr;
34614 }
34615
34616 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
34617         LDKu8slice ser_ref;
34618         ser_ref.datalen = ser->arr_len;
34619         ser_ref.data = ser->elems;
34620         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
34621         *ret_conv = AcceptChannel_read(ser_ref);
34622         FREE(ser);
34623         return tag_ptr(ret_conv, true);
34624 }
34625
34626 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
34627         LDKAnnouncementSignatures obj_conv;
34628         obj_conv.inner = untag_ptr(obj);
34629         obj_conv.is_owned = ptr_is_owned(obj);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34631         obj_conv.is_owned = false;
34632         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
34633         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34634         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34635         CVec_u8Z_free(ret_var);
34636         return ret_arr;
34637 }
34638
34639 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
34640         LDKu8slice ser_ref;
34641         ser_ref.datalen = ser->arr_len;
34642         ser_ref.data = ser->elems;
34643         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34644         *ret_conv = AnnouncementSignatures_read(ser_ref);
34645         FREE(ser);
34646         return tag_ptr(ret_conv, true);
34647 }
34648
34649 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
34650         LDKChannelReestablish obj_conv;
34651         obj_conv.inner = untag_ptr(obj);
34652         obj_conv.is_owned = ptr_is_owned(obj);
34653         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34654         obj_conv.is_owned = false;
34655         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
34656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34658         CVec_u8Z_free(ret_var);
34659         return ret_arr;
34660 }
34661
34662 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
34663         LDKu8slice ser_ref;
34664         ser_ref.datalen = ser->arr_len;
34665         ser_ref.data = ser->elems;
34666         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34667         *ret_conv = ChannelReestablish_read(ser_ref);
34668         FREE(ser);
34669         return tag_ptr(ret_conv, true);
34670 }
34671
34672 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
34673         LDKClosingSigned obj_conv;
34674         obj_conv.inner = untag_ptr(obj);
34675         obj_conv.is_owned = ptr_is_owned(obj);
34676         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34677         obj_conv.is_owned = false;
34678         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
34679         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34680         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34681         CVec_u8Z_free(ret_var);
34682         return ret_arr;
34683 }
34684
34685 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
34686         LDKu8slice ser_ref;
34687         ser_ref.datalen = ser->arr_len;
34688         ser_ref.data = ser->elems;
34689         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34690         *ret_conv = ClosingSigned_read(ser_ref);
34691         FREE(ser);
34692         return tag_ptr(ret_conv, true);
34693 }
34694
34695 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
34696         LDKClosingSignedFeeRange obj_conv;
34697         obj_conv.inner = untag_ptr(obj);
34698         obj_conv.is_owned = ptr_is_owned(obj);
34699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34700         obj_conv.is_owned = false;
34701         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
34702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34704         CVec_u8Z_free(ret_var);
34705         return ret_arr;
34706 }
34707
34708 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
34709         LDKu8slice ser_ref;
34710         ser_ref.datalen = ser->arr_len;
34711         ser_ref.data = ser->elems;
34712         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34713         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
34714         FREE(ser);
34715         return tag_ptr(ret_conv, true);
34716 }
34717
34718 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
34719         LDKCommitmentSigned obj_conv;
34720         obj_conv.inner = untag_ptr(obj);
34721         obj_conv.is_owned = ptr_is_owned(obj);
34722         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34723         obj_conv.is_owned = false;
34724         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
34725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34727         CVec_u8Z_free(ret_var);
34728         return ret_arr;
34729 }
34730
34731 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
34732         LDKu8slice ser_ref;
34733         ser_ref.datalen = ser->arr_len;
34734         ser_ref.data = ser->elems;
34735         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34736         *ret_conv = CommitmentSigned_read(ser_ref);
34737         FREE(ser);
34738         return tag_ptr(ret_conv, true);
34739 }
34740
34741 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
34742         LDKFundingCreated obj_conv;
34743         obj_conv.inner = untag_ptr(obj);
34744         obj_conv.is_owned = ptr_is_owned(obj);
34745         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34746         obj_conv.is_owned = false;
34747         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
34748         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34749         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34750         CVec_u8Z_free(ret_var);
34751         return ret_arr;
34752 }
34753
34754 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
34755         LDKu8slice ser_ref;
34756         ser_ref.datalen = ser->arr_len;
34757         ser_ref.data = ser->elems;
34758         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34759         *ret_conv = FundingCreated_read(ser_ref);
34760         FREE(ser);
34761         return tag_ptr(ret_conv, true);
34762 }
34763
34764 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
34765         LDKFundingSigned obj_conv;
34766         obj_conv.inner = untag_ptr(obj);
34767         obj_conv.is_owned = ptr_is_owned(obj);
34768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34769         obj_conv.is_owned = false;
34770         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
34771         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34772         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34773         CVec_u8Z_free(ret_var);
34774         return ret_arr;
34775 }
34776
34777 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
34778         LDKu8slice ser_ref;
34779         ser_ref.datalen = ser->arr_len;
34780         ser_ref.data = ser->elems;
34781         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34782         *ret_conv = FundingSigned_read(ser_ref);
34783         FREE(ser);
34784         return tag_ptr(ret_conv, true);
34785 }
34786
34787 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
34788         LDKChannelReady obj_conv;
34789         obj_conv.inner = untag_ptr(obj);
34790         obj_conv.is_owned = ptr_is_owned(obj);
34791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34792         obj_conv.is_owned = false;
34793         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
34794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34796         CVec_u8Z_free(ret_var);
34797         return ret_arr;
34798 }
34799
34800 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
34801         LDKu8slice ser_ref;
34802         ser_ref.datalen = ser->arr_len;
34803         ser_ref.data = ser->elems;
34804         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34805         *ret_conv = ChannelReady_read(ser_ref);
34806         FREE(ser);
34807         return tag_ptr(ret_conv, true);
34808 }
34809
34810 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
34811         LDKInit obj_conv;
34812         obj_conv.inner = untag_ptr(obj);
34813         obj_conv.is_owned = ptr_is_owned(obj);
34814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34815         obj_conv.is_owned = false;
34816         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
34817         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34818         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34819         CVec_u8Z_free(ret_var);
34820         return ret_arr;
34821 }
34822
34823 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
34824         LDKu8slice ser_ref;
34825         ser_ref.datalen = ser->arr_len;
34826         ser_ref.data = ser->elems;
34827         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34828         *ret_conv = Init_read(ser_ref);
34829         FREE(ser);
34830         return tag_ptr(ret_conv, true);
34831 }
34832
34833 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
34834         LDKOpenChannel obj_conv;
34835         obj_conv.inner = untag_ptr(obj);
34836         obj_conv.is_owned = ptr_is_owned(obj);
34837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34838         obj_conv.is_owned = false;
34839         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
34840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34842         CVec_u8Z_free(ret_var);
34843         return ret_arr;
34844 }
34845
34846 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
34847         LDKu8slice ser_ref;
34848         ser_ref.datalen = ser->arr_len;
34849         ser_ref.data = ser->elems;
34850         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34851         *ret_conv = OpenChannel_read(ser_ref);
34852         FREE(ser);
34853         return tag_ptr(ret_conv, true);
34854 }
34855
34856 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
34857         LDKRevokeAndACK obj_conv;
34858         obj_conv.inner = untag_ptr(obj);
34859         obj_conv.is_owned = ptr_is_owned(obj);
34860         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34861         obj_conv.is_owned = false;
34862         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
34863         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34864         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34865         CVec_u8Z_free(ret_var);
34866         return ret_arr;
34867 }
34868
34869 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
34870         LDKu8slice ser_ref;
34871         ser_ref.datalen = ser->arr_len;
34872         ser_ref.data = ser->elems;
34873         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34874         *ret_conv = RevokeAndACK_read(ser_ref);
34875         FREE(ser);
34876         return tag_ptr(ret_conv, true);
34877 }
34878
34879 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
34880         LDKShutdown obj_conv;
34881         obj_conv.inner = untag_ptr(obj);
34882         obj_conv.is_owned = ptr_is_owned(obj);
34883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34884         obj_conv.is_owned = false;
34885         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34886         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34887         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34888         CVec_u8Z_free(ret_var);
34889         return ret_arr;
34890 }
34891
34892 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
34893         LDKu8slice ser_ref;
34894         ser_ref.datalen = ser->arr_len;
34895         ser_ref.data = ser->elems;
34896         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34897         *ret_conv = Shutdown_read(ser_ref);
34898         FREE(ser);
34899         return tag_ptr(ret_conv, true);
34900 }
34901
34902 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
34903         LDKUpdateFailHTLC obj_conv;
34904         obj_conv.inner = untag_ptr(obj);
34905         obj_conv.is_owned = ptr_is_owned(obj);
34906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34907         obj_conv.is_owned = false;
34908         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
34909         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34910         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34911         CVec_u8Z_free(ret_var);
34912         return ret_arr;
34913 }
34914
34915 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
34916         LDKu8slice ser_ref;
34917         ser_ref.datalen = ser->arr_len;
34918         ser_ref.data = ser->elems;
34919         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
34920         *ret_conv = UpdateFailHTLC_read(ser_ref);
34921         FREE(ser);
34922         return tag_ptr(ret_conv, true);
34923 }
34924
34925 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
34926         LDKUpdateFailMalformedHTLC obj_conv;
34927         obj_conv.inner = untag_ptr(obj);
34928         obj_conv.is_owned = ptr_is_owned(obj);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34930         obj_conv.is_owned = false;
34931         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
34932         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34933         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34934         CVec_u8Z_free(ret_var);
34935         return ret_arr;
34936 }
34937
34938 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
34939         LDKu8slice ser_ref;
34940         ser_ref.datalen = ser->arr_len;
34941         ser_ref.data = ser->elems;
34942         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
34943         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
34944         FREE(ser);
34945         return tag_ptr(ret_conv, true);
34946 }
34947
34948 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
34949         LDKUpdateFee obj_conv;
34950         obj_conv.inner = untag_ptr(obj);
34951         obj_conv.is_owned = ptr_is_owned(obj);
34952         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34953         obj_conv.is_owned = false;
34954         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
34955         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34956         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34957         CVec_u8Z_free(ret_var);
34958         return ret_arr;
34959 }
34960
34961 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
34962         LDKu8slice ser_ref;
34963         ser_ref.datalen = ser->arr_len;
34964         ser_ref.data = ser->elems;
34965         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
34966         *ret_conv = UpdateFee_read(ser_ref);
34967         FREE(ser);
34968         return tag_ptr(ret_conv, true);
34969 }
34970
34971 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
34972         LDKUpdateFulfillHTLC obj_conv;
34973         obj_conv.inner = untag_ptr(obj);
34974         obj_conv.is_owned = ptr_is_owned(obj);
34975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34976         obj_conv.is_owned = false;
34977         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
34978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34980         CVec_u8Z_free(ret_var);
34981         return ret_arr;
34982 }
34983
34984 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
34985         LDKu8slice ser_ref;
34986         ser_ref.datalen = ser->arr_len;
34987         ser_ref.data = ser->elems;
34988         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
34989         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
34990         FREE(ser);
34991         return tag_ptr(ret_conv, true);
34992 }
34993
34994 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
34995         LDKUpdateAddHTLC obj_conv;
34996         obj_conv.inner = untag_ptr(obj);
34997         obj_conv.is_owned = ptr_is_owned(obj);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34999         obj_conv.is_owned = false;
35000         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
35001         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35002         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35003         CVec_u8Z_free(ret_var);
35004         return ret_arr;
35005 }
35006
35007 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
35008         LDKu8slice ser_ref;
35009         ser_ref.datalen = ser->arr_len;
35010         ser_ref.data = ser->elems;
35011         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35012         *ret_conv = UpdateAddHTLC_read(ser_ref);
35013         FREE(ser);
35014         return tag_ptr(ret_conv, true);
35015 }
35016
35017 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
35018         LDKu8slice ser_ref;
35019         ser_ref.datalen = ser->arr_len;
35020         ser_ref.data = ser->elems;
35021         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35022         *ret_conv = OnionMessage_read(ser_ref);
35023         FREE(ser);
35024         return tag_ptr(ret_conv, true);
35025 }
35026
35027 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
35028         LDKOnionMessage obj_conv;
35029         obj_conv.inner = untag_ptr(obj);
35030         obj_conv.is_owned = ptr_is_owned(obj);
35031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35032         obj_conv.is_owned = false;
35033         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
35034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35036         CVec_u8Z_free(ret_var);
35037         return ret_arr;
35038 }
35039
35040 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
35041         LDKPing obj_conv;
35042         obj_conv.inner = untag_ptr(obj);
35043         obj_conv.is_owned = ptr_is_owned(obj);
35044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35045         obj_conv.is_owned = false;
35046         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35049         CVec_u8Z_free(ret_var);
35050         return ret_arr;
35051 }
35052
35053 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
35054         LDKu8slice ser_ref;
35055         ser_ref.datalen = ser->arr_len;
35056         ser_ref.data = ser->elems;
35057         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35058         *ret_conv = Ping_read(ser_ref);
35059         FREE(ser);
35060         return tag_ptr(ret_conv, true);
35061 }
35062
35063 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
35064         LDKPong obj_conv;
35065         obj_conv.inner = untag_ptr(obj);
35066         obj_conv.is_owned = ptr_is_owned(obj);
35067         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35068         obj_conv.is_owned = false;
35069         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35070         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35071         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35072         CVec_u8Z_free(ret_var);
35073         return ret_arr;
35074 }
35075
35076 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
35077         LDKu8slice ser_ref;
35078         ser_ref.datalen = ser->arr_len;
35079         ser_ref.data = ser->elems;
35080         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35081         *ret_conv = Pong_read(ser_ref);
35082         FREE(ser);
35083         return tag_ptr(ret_conv, true);
35084 }
35085
35086 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
35087         LDKUnsignedChannelAnnouncement obj_conv;
35088         obj_conv.inner = untag_ptr(obj);
35089         obj_conv.is_owned = ptr_is_owned(obj);
35090         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35091         obj_conv.is_owned = false;
35092         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35093         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35094         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35095         CVec_u8Z_free(ret_var);
35096         return ret_arr;
35097 }
35098
35099 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
35100         LDKu8slice ser_ref;
35101         ser_ref.datalen = ser->arr_len;
35102         ser_ref.data = ser->elems;
35103         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35104         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35105         FREE(ser);
35106         return tag_ptr(ret_conv, true);
35107 }
35108
35109 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
35110         LDKChannelAnnouncement obj_conv;
35111         obj_conv.inner = untag_ptr(obj);
35112         obj_conv.is_owned = ptr_is_owned(obj);
35113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35114         obj_conv.is_owned = false;
35115         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35118         CVec_u8Z_free(ret_var);
35119         return ret_arr;
35120 }
35121
35122 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
35123         LDKu8slice ser_ref;
35124         ser_ref.datalen = ser->arr_len;
35125         ser_ref.data = ser->elems;
35126         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35127         *ret_conv = ChannelAnnouncement_read(ser_ref);
35128         FREE(ser);
35129         return tag_ptr(ret_conv, true);
35130 }
35131
35132 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
35133         LDKUnsignedChannelUpdate obj_conv;
35134         obj_conv.inner = untag_ptr(obj);
35135         obj_conv.is_owned = ptr_is_owned(obj);
35136         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35137         obj_conv.is_owned = false;
35138         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35139         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35140         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35141         CVec_u8Z_free(ret_var);
35142         return ret_arr;
35143 }
35144
35145 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
35146         LDKu8slice ser_ref;
35147         ser_ref.datalen = ser->arr_len;
35148         ser_ref.data = ser->elems;
35149         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35150         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35151         FREE(ser);
35152         return tag_ptr(ret_conv, true);
35153 }
35154
35155 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
35156         LDKChannelUpdate obj_conv;
35157         obj_conv.inner = untag_ptr(obj);
35158         obj_conv.is_owned = ptr_is_owned(obj);
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35160         obj_conv.is_owned = false;
35161         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35162         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35163         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35164         CVec_u8Z_free(ret_var);
35165         return ret_arr;
35166 }
35167
35168 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
35169         LDKu8slice ser_ref;
35170         ser_ref.datalen = ser->arr_len;
35171         ser_ref.data = ser->elems;
35172         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35173         *ret_conv = ChannelUpdate_read(ser_ref);
35174         FREE(ser);
35175         return tag_ptr(ret_conv, true);
35176 }
35177
35178 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
35179         LDKErrorMessage obj_conv;
35180         obj_conv.inner = untag_ptr(obj);
35181         obj_conv.is_owned = ptr_is_owned(obj);
35182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35183         obj_conv.is_owned = false;
35184         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35187         CVec_u8Z_free(ret_var);
35188         return ret_arr;
35189 }
35190
35191 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
35192         LDKu8slice ser_ref;
35193         ser_ref.datalen = ser->arr_len;
35194         ser_ref.data = ser->elems;
35195         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35196         *ret_conv = ErrorMessage_read(ser_ref);
35197         FREE(ser);
35198         return tag_ptr(ret_conv, true);
35199 }
35200
35201 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
35202         LDKWarningMessage obj_conv;
35203         obj_conv.inner = untag_ptr(obj);
35204         obj_conv.is_owned = ptr_is_owned(obj);
35205         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35206         obj_conv.is_owned = false;
35207         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35208         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35209         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35210         CVec_u8Z_free(ret_var);
35211         return ret_arr;
35212 }
35213
35214 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
35215         LDKu8slice ser_ref;
35216         ser_ref.datalen = ser->arr_len;
35217         ser_ref.data = ser->elems;
35218         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35219         *ret_conv = WarningMessage_read(ser_ref);
35220         FREE(ser);
35221         return tag_ptr(ret_conv, true);
35222 }
35223
35224 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
35225         LDKUnsignedNodeAnnouncement obj_conv;
35226         obj_conv.inner = untag_ptr(obj);
35227         obj_conv.is_owned = ptr_is_owned(obj);
35228         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35229         obj_conv.is_owned = false;
35230         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35231         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35232         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35233         CVec_u8Z_free(ret_var);
35234         return ret_arr;
35235 }
35236
35237 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
35238         LDKu8slice ser_ref;
35239         ser_ref.datalen = ser->arr_len;
35240         ser_ref.data = ser->elems;
35241         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35242         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
35243         FREE(ser);
35244         return tag_ptr(ret_conv, true);
35245 }
35246
35247 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
35248         LDKNodeAnnouncement obj_conv;
35249         obj_conv.inner = untag_ptr(obj);
35250         obj_conv.is_owned = ptr_is_owned(obj);
35251         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35252         obj_conv.is_owned = false;
35253         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
35254         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35255         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35256         CVec_u8Z_free(ret_var);
35257         return ret_arr;
35258 }
35259
35260 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
35261         LDKu8slice ser_ref;
35262         ser_ref.datalen = ser->arr_len;
35263         ser_ref.data = ser->elems;
35264         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35265         *ret_conv = NodeAnnouncement_read(ser_ref);
35266         FREE(ser);
35267         return tag_ptr(ret_conv, true);
35268 }
35269
35270 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
35271         LDKu8slice ser_ref;
35272         ser_ref.datalen = ser->arr_len;
35273         ser_ref.data = ser->elems;
35274         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
35275         *ret_conv = QueryShortChannelIds_read(ser_ref);
35276         FREE(ser);
35277         return tag_ptr(ret_conv, true);
35278 }
35279
35280 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
35281         LDKQueryShortChannelIds obj_conv;
35282         obj_conv.inner = untag_ptr(obj);
35283         obj_conv.is_owned = ptr_is_owned(obj);
35284         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35285         obj_conv.is_owned = false;
35286         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
35287         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35288         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35289         CVec_u8Z_free(ret_var);
35290         return ret_arr;
35291 }
35292
35293 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
35294         LDKReplyShortChannelIdsEnd obj_conv;
35295         obj_conv.inner = untag_ptr(obj);
35296         obj_conv.is_owned = ptr_is_owned(obj);
35297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35298         obj_conv.is_owned = false;
35299         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
35300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35302         CVec_u8Z_free(ret_var);
35303         return ret_arr;
35304 }
35305
35306 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
35307         LDKu8slice ser_ref;
35308         ser_ref.datalen = ser->arr_len;
35309         ser_ref.data = ser->elems;
35310         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
35311         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
35312         FREE(ser);
35313         return tag_ptr(ret_conv, true);
35314 }
35315
35316 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
35317         LDKQueryChannelRange this_arg_conv;
35318         this_arg_conv.inner = untag_ptr(this_arg);
35319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35321         this_arg_conv.is_owned = false;
35322         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
35323         return ret_conv;
35324 }
35325
35326 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
35327         LDKQueryChannelRange obj_conv;
35328         obj_conv.inner = untag_ptr(obj);
35329         obj_conv.is_owned = ptr_is_owned(obj);
35330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35331         obj_conv.is_owned = false;
35332         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
35333         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35334         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35335         CVec_u8Z_free(ret_var);
35336         return ret_arr;
35337 }
35338
35339 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
35340         LDKu8slice ser_ref;
35341         ser_ref.datalen = ser->arr_len;
35342         ser_ref.data = ser->elems;
35343         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
35344         *ret_conv = QueryChannelRange_read(ser_ref);
35345         FREE(ser);
35346         return tag_ptr(ret_conv, true);
35347 }
35348
35349 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
35350         LDKu8slice ser_ref;
35351         ser_ref.datalen = ser->arr_len;
35352         ser_ref.data = ser->elems;
35353         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
35354         *ret_conv = ReplyChannelRange_read(ser_ref);
35355         FREE(ser);
35356         return tag_ptr(ret_conv, true);
35357 }
35358
35359 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
35360         LDKReplyChannelRange obj_conv;
35361         obj_conv.inner = untag_ptr(obj);
35362         obj_conv.is_owned = ptr_is_owned(obj);
35363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35364         obj_conv.is_owned = false;
35365         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
35366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35368         CVec_u8Z_free(ret_var);
35369         return ret_arr;
35370 }
35371
35372 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
35373         LDKGossipTimestampFilter obj_conv;
35374         obj_conv.inner = untag_ptr(obj);
35375         obj_conv.is_owned = ptr_is_owned(obj);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35377         obj_conv.is_owned = false;
35378         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
35379         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35380         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35381         CVec_u8Z_free(ret_var);
35382         return ret_arr;
35383 }
35384
35385 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
35386         LDKu8slice ser_ref;
35387         ser_ref.datalen = ser->arr_len;
35388         ser_ref.data = ser->elems;
35389         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
35390         *ret_conv = GossipTimestampFilter_read(ser_ref);
35391         FREE(ser);
35392         return tag_ptr(ret_conv, true);
35393 }
35394
35395 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
35396         if (!ptr_is_owned(this_ptr)) return;
35397         void* this_ptr_ptr = untag_ptr(this_ptr);
35398         CHECK_ACCESS(this_ptr_ptr);
35399         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
35400         FREE(untag_ptr(this_ptr));
35401         CustomMessageHandler_free(this_ptr_conv);
35402 }
35403
35404 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
35405         LDKIgnoringMessageHandler this_obj_conv;
35406         this_obj_conv.inner = untag_ptr(this_obj);
35407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35409         IgnoringMessageHandler_free(this_obj_conv);
35410 }
35411
35412 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
35413         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
35414         uint64_t ret_ref = 0;
35415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35417         return ret_ref;
35418 }
35419
35420 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
35421         LDKIgnoringMessageHandler this_arg_conv;
35422         this_arg_conv.inner = untag_ptr(this_arg);
35423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35425         this_arg_conv.is_owned = false;
35426         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35427         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35428         return tag_ptr(ret_ret, true);
35429 }
35430
35431 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
35432         LDKIgnoringMessageHandler this_arg_conv;
35433         this_arg_conv.inner = untag_ptr(this_arg);
35434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35436         this_arg_conv.is_owned = false;
35437         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35438         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
35439         return tag_ptr(ret_ret, true);
35440 }
35441
35442 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
35443         LDKIgnoringMessageHandler this_arg_conv;
35444         this_arg_conv.inner = untag_ptr(this_arg);
35445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35447         this_arg_conv.is_owned = false;
35448         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
35449         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
35450         return tag_ptr(ret_ret, true);
35451 }
35452
35453 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
35454         LDKIgnoringMessageHandler this_arg_conv;
35455         this_arg_conv.inner = untag_ptr(this_arg);
35456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35458         this_arg_conv.is_owned = false;
35459         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
35460         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
35461         return tag_ptr(ret_ret, true);
35462 }
35463
35464 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
35465         LDKIgnoringMessageHandler this_arg_conv;
35466         this_arg_conv.inner = untag_ptr(this_arg);
35467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35469         this_arg_conv.is_owned = false;
35470         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
35471         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
35472         return tag_ptr(ret_ret, true);
35473 }
35474
35475 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
35476         LDKIgnoringMessageHandler this_arg_conv;
35477         this_arg_conv.inner = untag_ptr(this_arg);
35478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35480         this_arg_conv.is_owned = false;
35481         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
35482         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
35483         return tag_ptr(ret_ret, true);
35484 }
35485
35486 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
35487         LDKIgnoringMessageHandler this_arg_conv;
35488         this_arg_conv.inner = untag_ptr(this_arg);
35489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35491         this_arg_conv.is_owned = false;
35492         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
35493         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
35494         return tag_ptr(ret_ret, true);
35495 }
35496
35497 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
35498         LDKErroringMessageHandler this_obj_conv;
35499         this_obj_conv.inner = untag_ptr(this_obj);
35500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35502         ErroringMessageHandler_free(this_obj_conv);
35503 }
35504
35505 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
35506         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
35507         uint64_t ret_ref = 0;
35508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35510         return ret_ref;
35511 }
35512
35513 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
35514         LDKErroringMessageHandler this_arg_conv;
35515         this_arg_conv.inner = untag_ptr(this_arg);
35516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35518         this_arg_conv.is_owned = false;
35519         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35520         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35521         return tag_ptr(ret_ret, true);
35522 }
35523
35524 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
35525         LDKErroringMessageHandler this_arg_conv;
35526         this_arg_conv.inner = untag_ptr(this_arg);
35527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35529         this_arg_conv.is_owned = false;
35530         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35531         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
35532         return tag_ptr(ret_ret, true);
35533 }
35534
35535 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
35536         LDKMessageHandler this_obj_conv;
35537         this_obj_conv.inner = untag_ptr(this_obj);
35538         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35540         MessageHandler_free(this_obj_conv);
35541 }
35542
35543 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
35544         LDKMessageHandler this_ptr_conv;
35545         this_ptr_conv.inner = untag_ptr(this_ptr);
35546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35548         this_ptr_conv.is_owned = false;
35549         // WARNING: This object doesn't live past this scope, needs clone!
35550         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
35551         return ret_ret;
35552 }
35553
35554 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
35555         LDKMessageHandler this_ptr_conv;
35556         this_ptr_conv.inner = untag_ptr(this_ptr);
35557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35559         this_ptr_conv.is_owned = false;
35560         void* val_ptr = untag_ptr(val);
35561         CHECK_ACCESS(val_ptr);
35562         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
35563         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
35564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35565                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
35566         }
35567         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
35568 }
35569
35570 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
35571         LDKMessageHandler this_ptr_conv;
35572         this_ptr_conv.inner = untag_ptr(this_ptr);
35573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575         this_ptr_conv.is_owned = false;
35576         // WARNING: This object doesn't live past this scope, needs clone!
35577         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
35578         return ret_ret;
35579 }
35580
35581 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
35582         LDKMessageHandler this_ptr_conv;
35583         this_ptr_conv.inner = untag_ptr(this_ptr);
35584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35586         this_ptr_conv.is_owned = false;
35587         void* val_ptr = untag_ptr(val);
35588         CHECK_ACCESS(val_ptr);
35589         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
35590         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35592                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
35593         }
35594         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
35595 }
35596
35597 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
35598         LDKMessageHandler this_ptr_conv;
35599         this_ptr_conv.inner = untag_ptr(this_ptr);
35600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35602         this_ptr_conv.is_owned = false;
35603         // WARNING: This object doesn't live past this scope, needs clone!
35604         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
35605         return ret_ret;
35606 }
35607
35608 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
35609         LDKMessageHandler this_ptr_conv;
35610         this_ptr_conv.inner = untag_ptr(this_ptr);
35611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35613         this_ptr_conv.is_owned = false;
35614         void* val_ptr = untag_ptr(val);
35615         CHECK_ACCESS(val_ptr);
35616         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
35617         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
35618                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35619                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
35620         }
35621         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
35622 }
35623
35624 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) {
35625         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
35626         CHECK_ACCESS(chan_handler_arg_ptr);
35627         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
35628         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
35629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35630                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
35631         }
35632         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
35633         CHECK_ACCESS(route_handler_arg_ptr);
35634         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
35635         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35637                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
35638         }
35639         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
35640         CHECK_ACCESS(onion_message_handler_arg_ptr);
35641         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
35642         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
35643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35644                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
35645         }
35646         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
35647         uint64_t ret_ref = 0;
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35650         return ret_ref;
35651 }
35652
35653 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
35654         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35655         *ret_ret = SocketDescriptor_clone(arg);
35656         return tag_ptr(ret_ret, true);
35657 }
35658 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
35659         void* arg_ptr = untag_ptr(arg);
35660         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
35661         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
35662         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
35663         return ret_conv;
35664 }
35665
35666 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
35667         void* orig_ptr = untag_ptr(orig);
35668         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
35669         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
35670         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35671         *ret_ret = SocketDescriptor_clone(orig_conv);
35672         return tag_ptr(ret_ret, true);
35673 }
35674
35675 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
35676         if (!ptr_is_owned(this_ptr)) return;
35677         void* this_ptr_ptr = untag_ptr(this_ptr);
35678         CHECK_ACCESS(this_ptr_ptr);
35679         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
35680         FREE(untag_ptr(this_ptr));
35681         SocketDescriptor_free(this_ptr_conv);
35682 }
35683
35684 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
35685         LDKPeerHandleError this_obj_conv;
35686         this_obj_conv.inner = untag_ptr(this_obj);
35687         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35689         PeerHandleError_free(this_obj_conv);
35690 }
35691
35692 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
35693         LDKPeerHandleError this_ptr_conv;
35694         this_ptr_conv.inner = untag_ptr(this_ptr);
35695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35697         this_ptr_conv.is_owned = false;
35698         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
35699         return ret_conv;
35700 }
35701
35702 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
35703         LDKPeerHandleError this_ptr_conv;
35704         this_ptr_conv.inner = untag_ptr(this_ptr);
35705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35707         this_ptr_conv.is_owned = false;
35708         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
35709 }
35710
35711 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
35712         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
35713         uint64_t ret_ref = 0;
35714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35716         return ret_ref;
35717 }
35718
35719 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
35720         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
35721         uint64_t ret_ref = 0;
35722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35724         return ret_ref;
35725 }
35726 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
35727         LDKPeerHandleError arg_conv;
35728         arg_conv.inner = untag_ptr(arg);
35729         arg_conv.is_owned = ptr_is_owned(arg);
35730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35731         arg_conv.is_owned = false;
35732         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
35733         return ret_conv;
35734 }
35735
35736 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
35737         LDKPeerHandleError orig_conv;
35738         orig_conv.inner = untag_ptr(orig);
35739         orig_conv.is_owned = ptr_is_owned(orig);
35740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35741         orig_conv.is_owned = false;
35742         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
35743         uint64_t ret_ref = 0;
35744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35746         return ret_ref;
35747 }
35748
35749 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
35750         LDKPeerManager this_obj_conv;
35751         this_obj_conv.inner = untag_ptr(this_obj);
35752         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35754         PeerManager_free(this_obj_conv);
35755 }
35756
35757 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) {
35758         LDKMessageHandler message_handler_conv;
35759         message_handler_conv.inner = untag_ptr(message_handler);
35760         message_handler_conv.is_owned = ptr_is_owned(message_handler);
35761         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
35762         // WARNING: we need a move here but no clone is available for LDKMessageHandler
35763         
35764         LDKSecretKey our_node_secret_ref;
35765         CHECK(our_node_secret->arr_len == 32);
35766         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
35767         unsigned char ephemeral_random_data_arr[32];
35768         CHECK(ephemeral_random_data->arr_len == 32);
35769         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
35770         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
35771         void* logger_ptr = untag_ptr(logger);
35772         CHECK_ACCESS(logger_ptr);
35773         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35774         if (logger_conv.free == LDKLogger_JCalls_free) {
35775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35776                 LDKLogger_JCalls_cloned(&logger_conv);
35777         }
35778         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
35779         CHECK_ACCESS(custom_message_handler_ptr);
35780         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
35781         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
35782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35783                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
35784         }
35785         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
35786         uint64_t ret_ref = 0;
35787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35789         return ret_ref;
35790 }
35791
35792 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
35793         LDKPeerManager this_arg_conv;
35794         this_arg_conv.inner = untag_ptr(this_arg);
35795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35797         this_arg_conv.is_owned = false;
35798         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
35799         ptrArray ret_arr = NULL;
35800         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35801         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35802         for (size_t m = 0; m < ret_var.datalen; m++) {
35803                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
35804                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
35805                 ret_arr_ptr[m] = ret_conv_12_arr;
35806         }
35807         
35808         FREE(ret_var.data);
35809         return ret_arr;
35810 }
35811
35812 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) {
35813         LDKPeerManager this_arg_conv;
35814         this_arg_conv.inner = untag_ptr(this_arg);
35815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35817         this_arg_conv.is_owned = false;
35818         LDKPublicKey their_node_id_ref;
35819         CHECK(their_node_id->arr_len == 33);
35820         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
35821         void* descriptor_ptr = untag_ptr(descriptor);
35822         CHECK_ACCESS(descriptor_ptr);
35823         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35824         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35826                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35827         }
35828         void* remote_network_address_ptr = untag_ptr(remote_network_address);
35829         CHECK_ACCESS(remote_network_address_ptr);
35830         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
35831         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
35832         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
35833         return tag_ptr(ret_conv, true);
35834 }
35835
35836 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) {
35837         LDKPeerManager this_arg_conv;
35838         this_arg_conv.inner = untag_ptr(this_arg);
35839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35841         this_arg_conv.is_owned = false;
35842         void* descriptor_ptr = untag_ptr(descriptor);
35843         CHECK_ACCESS(descriptor_ptr);
35844         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35845         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35846                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35847                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35848         }
35849         void* remote_network_address_ptr = untag_ptr(remote_network_address);
35850         CHECK_ACCESS(remote_network_address_ptr);
35851         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
35852         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35853         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
35854         return tag_ptr(ret_conv, true);
35855 }
35856
35857 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
35858         LDKPeerManager this_arg_conv;
35859         this_arg_conv.inner = untag_ptr(this_arg);
35860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35862         this_arg_conv.is_owned = false;
35863         void* descriptor_ptr = untag_ptr(descriptor);
35864         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35865         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35866         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35867         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
35868         return tag_ptr(ret_conv, true);
35869 }
35870
35871 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
35872         LDKPeerManager this_arg_conv;
35873         this_arg_conv.inner = untag_ptr(this_arg);
35874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35876         this_arg_conv.is_owned = false;
35877         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
35878         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
35879         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
35880         LDKu8slice data_ref;
35881         data_ref.datalen = data->arr_len;
35882         data_ref.data = data->elems;
35883         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
35884         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
35885         FREE(data);
35886         return tag_ptr(ret_conv, true);
35887 }
35888
35889 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
35890         LDKPeerManager this_arg_conv;
35891         this_arg_conv.inner = untag_ptr(this_arg);
35892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35894         this_arg_conv.is_owned = false;
35895         PeerManager_process_events(&this_arg_conv);
35896 }
35897
35898 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
35899         LDKPeerManager this_arg_conv;
35900         this_arg_conv.inner = untag_ptr(this_arg);
35901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35903         this_arg_conv.is_owned = false;
35904         void* descriptor_ptr = untag_ptr(descriptor);
35905         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35906         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35907         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
35908 }
35909
35910 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) {
35911         LDKPeerManager this_arg_conv;
35912         this_arg_conv.inner = untag_ptr(this_arg);
35913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35915         this_arg_conv.is_owned = false;
35916         LDKPublicKey node_id_ref;
35917         CHECK(node_id->arr_len == 33);
35918         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35919         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
35920 }
35921
35922 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
35923         LDKPeerManager this_arg_conv;
35924         this_arg_conv.inner = untag_ptr(this_arg);
35925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35927         this_arg_conv.is_owned = false;
35928         PeerManager_disconnect_all_peers(&this_arg_conv);
35929 }
35930
35931 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
35932         LDKPeerManager this_arg_conv;
35933         this_arg_conv.inner = untag_ptr(this_arg);
35934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35936         this_arg_conv.is_owned = false;
35937         PeerManager_timer_tick_occurred(&this_arg_conv);
35938 }
35939
35940 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) {
35941         LDKPeerManager this_arg_conv;
35942         this_arg_conv.inner = untag_ptr(this_arg);
35943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35945         this_arg_conv.is_owned = false;
35946         LDKThreeBytes rgb_ref;
35947         CHECK(rgb->arr_len == 3);
35948         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
35949         LDKThirtyTwoBytes alias_ref;
35950         CHECK(alias->arr_len == 32);
35951         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
35952         LDKCVec_NetAddressZ addresses_constr;
35953         addresses_constr.datalen = addresses->arr_len;
35954         if (addresses_constr.datalen > 0)
35955                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35956         else
35957                 addresses_constr.data = NULL;
35958         uint64_t* addresses_vals = addresses->elems;
35959         for (size_t m = 0; m < addresses_constr.datalen; m++) {
35960                 uint64_t addresses_conv_12 = addresses_vals[m];
35961                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
35962                 CHECK_ACCESS(addresses_conv_12_ptr);
35963                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
35964                 addresses_constr.data[m] = addresses_conv_12_conv;
35965         }
35966         FREE(addresses);
35967         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
35968 }
35969
35970 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
35971         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
35972         return ret_conv;
35973 }
35974
35975 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
35976         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
35977         return ret_conv;
35978 }
35979
35980 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
35981         unsigned char commitment_seed_arr[32];
35982         CHECK(commitment_seed->arr_len == 32);
35983         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
35984         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
35985         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35986         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
35987         return ret_arr;
35988 }
35989
35990 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) {
35991         LDKCVec_u8Z to_holder_script_ref;
35992         to_holder_script_ref.datalen = to_holder_script->arr_len;
35993         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35994         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35995         LDKCVec_u8Z to_counterparty_script_ref;
35996         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35997         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35998         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35999         LDKOutPoint funding_outpoint_conv;
36000         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
36001         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36002         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36003         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36004         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);
36005         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36006         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36007         Transaction_free(ret_var);
36008         return ret_arr;
36009 }
36010
36011 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
36012         LDKCounterpartyCommitmentSecrets this_obj_conv;
36013         this_obj_conv.inner = untag_ptr(this_obj);
36014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36016         CounterpartyCommitmentSecrets_free(this_obj_conv);
36017 }
36018
36019 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
36020         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
36021         uint64_t ret_ref = 0;
36022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36024         return ret_ref;
36025 }
36026 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
36027         LDKCounterpartyCommitmentSecrets arg_conv;
36028         arg_conv.inner = untag_ptr(arg);
36029         arg_conv.is_owned = ptr_is_owned(arg);
36030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36031         arg_conv.is_owned = false;
36032         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
36033         return ret_conv;
36034 }
36035
36036 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
36037         LDKCounterpartyCommitmentSecrets orig_conv;
36038         orig_conv.inner = untag_ptr(orig);
36039         orig_conv.is_owned = ptr_is_owned(orig);
36040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36041         orig_conv.is_owned = false;
36042         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36043         uint64_t ret_ref = 0;
36044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36046         return ret_ref;
36047 }
36048
36049 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
36050         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36051         uint64_t ret_ref = 0;
36052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36054         return ret_ref;
36055 }
36056
36057 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
36058         LDKCounterpartyCommitmentSecrets this_arg_conv;
36059         this_arg_conv.inner = untag_ptr(this_arg);
36060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36062         this_arg_conv.is_owned = false;
36063         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36064         return ret_conv;
36065 }
36066
36067 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
36068         LDKCounterpartyCommitmentSecrets this_arg_conv;
36069         this_arg_conv.inner = untag_ptr(this_arg);
36070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36072         this_arg_conv.is_owned = false;
36073         LDKThirtyTwoBytes secret_ref;
36074         CHECK(secret->arr_len == 32);
36075         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
36076         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36077         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36078         return tag_ptr(ret_conv, true);
36079 }
36080
36081 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
36082         LDKCounterpartyCommitmentSecrets this_arg_conv;
36083         this_arg_conv.inner = untag_ptr(this_arg);
36084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36086         this_arg_conv.is_owned = false;
36087         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36088         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
36089         return ret_arr;
36090 }
36091
36092 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
36093         LDKCounterpartyCommitmentSecrets obj_conv;
36094         obj_conv.inner = untag_ptr(obj);
36095         obj_conv.is_owned = ptr_is_owned(obj);
36096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36097         obj_conv.is_owned = false;
36098         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36101         CVec_u8Z_free(ret_var);
36102         return ret_arr;
36103 }
36104
36105 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
36106         LDKu8slice ser_ref;
36107         ser_ref.datalen = ser->arr_len;
36108         ser_ref.data = ser->elems;
36109         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36110         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36111         FREE(ser);
36112         return tag_ptr(ret_conv, true);
36113 }
36114
36115 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
36116         LDKPublicKey per_commitment_point_ref;
36117         CHECK(per_commitment_point->arr_len == 33);
36118         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36119         unsigned char base_secret_arr[32];
36120         CHECK(base_secret->arr_len == 32);
36121         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
36122         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36123         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36124         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36125         return tag_ptr(ret_conv, true);
36126 }
36127
36128 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
36129         LDKPublicKey per_commitment_point_ref;
36130         CHECK(per_commitment_point->arr_len == 33);
36131         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36132         LDKPublicKey base_point_ref;
36133         CHECK(base_point->arr_len == 33);
36134         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
36135         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36136         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36137         return tag_ptr(ret_conv, true);
36138 }
36139
36140 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) {
36141         unsigned char per_commitment_secret_arr[32];
36142         CHECK(per_commitment_secret->arr_len == 32);
36143         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
36144         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36145         unsigned char countersignatory_revocation_base_secret_arr[32];
36146         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
36147         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
36148         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36149         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36150         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36151         return tag_ptr(ret_conv, true);
36152 }
36153
36154 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) {
36155         LDKPublicKey per_commitment_point_ref;
36156         CHECK(per_commitment_point->arr_len == 33);
36157         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36158         LDKPublicKey countersignatory_revocation_base_point_ref;
36159         CHECK(countersignatory_revocation_base_point->arr_len == 33);
36160         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
36161         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36162         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36163         return tag_ptr(ret_conv, true);
36164 }
36165
36166 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
36167         LDKTxCreationKeys this_obj_conv;
36168         this_obj_conv.inner = untag_ptr(this_obj);
36169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36171         TxCreationKeys_free(this_obj_conv);
36172 }
36173
36174 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
36175         LDKTxCreationKeys this_ptr_conv;
36176         this_ptr_conv.inner = untag_ptr(this_ptr);
36177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36179         this_ptr_conv.is_owned = false;
36180         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36181         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36182         return ret_arr;
36183 }
36184
36185 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
36186         LDKTxCreationKeys this_ptr_conv;
36187         this_ptr_conv.inner = untag_ptr(this_ptr);
36188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36190         this_ptr_conv.is_owned = false;
36191         LDKPublicKey val_ref;
36192         CHECK(val->arr_len == 33);
36193         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36194         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36195 }
36196
36197 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
36198         LDKTxCreationKeys this_ptr_conv;
36199         this_ptr_conv.inner = untag_ptr(this_ptr);
36200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36202         this_ptr_conv.is_owned = false;
36203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36204         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
36205         return ret_arr;
36206 }
36207
36208 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
36209         LDKTxCreationKeys this_ptr_conv;
36210         this_ptr_conv.inner = untag_ptr(this_ptr);
36211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36213         this_ptr_conv.is_owned = false;
36214         LDKPublicKey val_ref;
36215         CHECK(val->arr_len == 33);
36216         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36217         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36218 }
36219
36220 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
36221         LDKTxCreationKeys this_ptr_conv;
36222         this_ptr_conv.inner = untag_ptr(this_ptr);
36223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36225         this_ptr_conv.is_owned = false;
36226         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36227         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
36228         return ret_arr;
36229 }
36230
36231 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
36232         LDKTxCreationKeys this_ptr_conv;
36233         this_ptr_conv.inner = untag_ptr(this_ptr);
36234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36236         this_ptr_conv.is_owned = false;
36237         LDKPublicKey val_ref;
36238         CHECK(val->arr_len == 33);
36239         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36240         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36241 }
36242
36243 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
36244         LDKTxCreationKeys this_ptr_conv;
36245         this_ptr_conv.inner = untag_ptr(this_ptr);
36246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36248         this_ptr_conv.is_owned = false;
36249         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36250         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
36251         return ret_arr;
36252 }
36253
36254 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
36255         LDKTxCreationKeys this_ptr_conv;
36256         this_ptr_conv.inner = untag_ptr(this_ptr);
36257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36259         this_ptr_conv.is_owned = false;
36260         LDKPublicKey val_ref;
36261         CHECK(val->arr_len == 33);
36262         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36263         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36264 }
36265
36266 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
36267         LDKTxCreationKeys this_ptr_conv;
36268         this_ptr_conv.inner = untag_ptr(this_ptr);
36269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36271         this_ptr_conv.is_owned = false;
36272         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36273         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
36274         return ret_arr;
36275 }
36276
36277 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) {
36278         LDKTxCreationKeys this_ptr_conv;
36279         this_ptr_conv.inner = untag_ptr(this_ptr);
36280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36282         this_ptr_conv.is_owned = false;
36283         LDKPublicKey val_ref;
36284         CHECK(val->arr_len == 33);
36285         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36286         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36287 }
36288
36289 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) {
36290         LDKPublicKey per_commitment_point_arg_ref;
36291         CHECK(per_commitment_point_arg->arr_len == 33);
36292         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
36293         LDKPublicKey revocation_key_arg_ref;
36294         CHECK(revocation_key_arg->arr_len == 33);
36295         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
36296         LDKPublicKey broadcaster_htlc_key_arg_ref;
36297         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
36298         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
36299         LDKPublicKey countersignatory_htlc_key_arg_ref;
36300         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
36301         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
36302         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36303         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
36304         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
36305         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);
36306         uint64_t ret_ref = 0;
36307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36309         return ret_ref;
36310 }
36311
36312 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
36313         LDKTxCreationKeys a_conv;
36314         a_conv.inner = untag_ptr(a);
36315         a_conv.is_owned = ptr_is_owned(a);
36316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36317         a_conv.is_owned = false;
36318         LDKTxCreationKeys b_conv;
36319         b_conv.inner = untag_ptr(b);
36320         b_conv.is_owned = ptr_is_owned(b);
36321         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36322         b_conv.is_owned = false;
36323         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
36324         return ret_conv;
36325 }
36326
36327 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36328         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
36329         uint64_t ret_ref = 0;
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36332         return ret_ref;
36333 }
36334 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
36335         LDKTxCreationKeys arg_conv;
36336         arg_conv.inner = untag_ptr(arg);
36337         arg_conv.is_owned = ptr_is_owned(arg);
36338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36339         arg_conv.is_owned = false;
36340         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
36341         return ret_conv;
36342 }
36343
36344 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
36345         LDKTxCreationKeys orig_conv;
36346         orig_conv.inner = untag_ptr(orig);
36347         orig_conv.is_owned = ptr_is_owned(orig);
36348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36349         orig_conv.is_owned = false;
36350         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
36351         uint64_t ret_ref = 0;
36352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36354         return ret_ref;
36355 }
36356
36357 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
36358         LDKTxCreationKeys obj_conv;
36359         obj_conv.inner = untag_ptr(obj);
36360         obj_conv.is_owned = ptr_is_owned(obj);
36361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36362         obj_conv.is_owned = false;
36363         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
36364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36366         CVec_u8Z_free(ret_var);
36367         return ret_arr;
36368 }
36369
36370 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
36371         LDKu8slice ser_ref;
36372         ser_ref.datalen = ser->arr_len;
36373         ser_ref.data = ser->elems;
36374         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36375         *ret_conv = TxCreationKeys_read(ser_ref);
36376         FREE(ser);
36377         return tag_ptr(ret_conv, true);
36378 }
36379
36380 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
36381         LDKChannelPublicKeys this_obj_conv;
36382         this_obj_conv.inner = untag_ptr(this_obj);
36383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36385         ChannelPublicKeys_free(this_obj_conv);
36386 }
36387
36388 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
36389         LDKChannelPublicKeys this_ptr_conv;
36390         this_ptr_conv.inner = untag_ptr(this_ptr);
36391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36393         this_ptr_conv.is_owned = false;
36394         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36395         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36396         return ret_arr;
36397 }
36398
36399 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36400         LDKChannelPublicKeys this_ptr_conv;
36401         this_ptr_conv.inner = untag_ptr(this_ptr);
36402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36404         this_ptr_conv.is_owned = false;
36405         LDKPublicKey val_ref;
36406         CHECK(val->arr_len == 33);
36407         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36408         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
36409 }
36410
36411 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
36412         LDKChannelPublicKeys this_ptr_conv;
36413         this_ptr_conv.inner = untag_ptr(this_ptr);
36414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36416         this_ptr_conv.is_owned = false;
36417         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36418         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36419         return ret_arr;
36420 }
36421
36422 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36423         LDKChannelPublicKeys this_ptr_conv;
36424         this_ptr_conv.inner = untag_ptr(this_ptr);
36425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36427         this_ptr_conv.is_owned = false;
36428         LDKPublicKey val_ref;
36429         CHECK(val->arr_len == 33);
36430         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36431         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
36432 }
36433
36434 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
36435         LDKChannelPublicKeys this_ptr_conv;
36436         this_ptr_conv.inner = untag_ptr(this_ptr);
36437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36439         this_ptr_conv.is_owned = false;
36440         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36441         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
36442         return ret_arr;
36443 }
36444
36445 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
36446         LDKChannelPublicKeys this_ptr_conv;
36447         this_ptr_conv.inner = untag_ptr(this_ptr);
36448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36450         this_ptr_conv.is_owned = false;
36451         LDKPublicKey val_ref;
36452         CHECK(val->arr_len == 33);
36453         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36454         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
36455 }
36456
36457 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
36458         LDKChannelPublicKeys this_ptr_conv;
36459         this_ptr_conv.inner = untag_ptr(this_ptr);
36460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36462         this_ptr_conv.is_owned = false;
36463         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36464         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36465         return ret_arr;
36466 }
36467
36468 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36469         LDKChannelPublicKeys this_ptr_conv;
36470         this_ptr_conv.inner = untag_ptr(this_ptr);
36471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36473         this_ptr_conv.is_owned = false;
36474         LDKPublicKey val_ref;
36475         CHECK(val->arr_len == 33);
36476         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36477         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36478 }
36479
36480 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
36481         LDKChannelPublicKeys this_ptr_conv;
36482         this_ptr_conv.inner = untag_ptr(this_ptr);
36483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36485         this_ptr_conv.is_owned = false;
36486         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36487         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36488         return ret_arr;
36489 }
36490
36491 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36492         LDKChannelPublicKeys this_ptr_conv;
36493         this_ptr_conv.inner = untag_ptr(this_ptr);
36494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36496         this_ptr_conv.is_owned = false;
36497         LDKPublicKey val_ref;
36498         CHECK(val->arr_len == 33);
36499         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36500         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
36501 }
36502
36503 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) {
36504         LDKPublicKey funding_pubkey_arg_ref;
36505         CHECK(funding_pubkey_arg->arr_len == 33);
36506         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36507         LDKPublicKey revocation_basepoint_arg_ref;
36508         CHECK(revocation_basepoint_arg->arr_len == 33);
36509         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36510         LDKPublicKey payment_point_arg_ref;
36511         CHECK(payment_point_arg->arr_len == 33);
36512         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
36513         LDKPublicKey delayed_payment_basepoint_arg_ref;
36514         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36515         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36516         LDKPublicKey htlc_basepoint_arg_ref;
36517         CHECK(htlc_basepoint_arg->arr_len == 33);
36518         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36519         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);
36520         uint64_t ret_ref = 0;
36521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36523         return ret_ref;
36524 }
36525
36526 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
36527         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
36528         uint64_t ret_ref = 0;
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36531         return ret_ref;
36532 }
36533 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
36534         LDKChannelPublicKeys arg_conv;
36535         arg_conv.inner = untag_ptr(arg);
36536         arg_conv.is_owned = ptr_is_owned(arg);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36538         arg_conv.is_owned = false;
36539         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
36540         return ret_conv;
36541 }
36542
36543 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
36544         LDKChannelPublicKeys orig_conv;
36545         orig_conv.inner = untag_ptr(orig);
36546         orig_conv.is_owned = ptr_is_owned(orig);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36548         orig_conv.is_owned = false;
36549         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
36550         uint64_t ret_ref = 0;
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36553         return ret_ref;
36554 }
36555
36556 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
36557         LDKChannelPublicKeys a_conv;
36558         a_conv.inner = untag_ptr(a);
36559         a_conv.is_owned = ptr_is_owned(a);
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36561         a_conv.is_owned = false;
36562         LDKChannelPublicKeys b_conv;
36563         b_conv.inner = untag_ptr(b);
36564         b_conv.is_owned = ptr_is_owned(b);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36566         b_conv.is_owned = false;
36567         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
36568         return ret_conv;
36569 }
36570
36571 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
36572         LDKChannelPublicKeys obj_conv;
36573         obj_conv.inner = untag_ptr(obj);
36574         obj_conv.is_owned = ptr_is_owned(obj);
36575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36576         obj_conv.is_owned = false;
36577         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
36578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36580         CVec_u8Z_free(ret_var);
36581         return ret_arr;
36582 }
36583
36584 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
36585         LDKu8slice ser_ref;
36586         ser_ref.datalen = ser->arr_len;
36587         ser_ref.data = ser->elems;
36588         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36589         *ret_conv = ChannelPublicKeys_read(ser_ref);
36590         FREE(ser);
36591         return tag_ptr(ret_conv, true);
36592 }
36593
36594 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) {
36595         LDKPublicKey per_commitment_point_ref;
36596         CHECK(per_commitment_point->arr_len == 33);
36597         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36598         LDKPublicKey broadcaster_delayed_payment_base_ref;
36599         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
36600         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
36601         LDKPublicKey broadcaster_htlc_base_ref;
36602         CHECK(broadcaster_htlc_base->arr_len == 33);
36603         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
36604         LDKPublicKey countersignatory_revocation_base_ref;
36605         CHECK(countersignatory_revocation_base->arr_len == 33);
36606         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
36607         LDKPublicKey countersignatory_htlc_base_ref;
36608         CHECK(countersignatory_htlc_base->arr_len == 33);
36609         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
36610         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36611         *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);
36612         return tag_ptr(ret_conv, true);
36613 }
36614
36615 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) {
36616         LDKPublicKey per_commitment_point_ref;
36617         CHECK(per_commitment_point->arr_len == 33);
36618         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
36619         LDKChannelPublicKeys broadcaster_keys_conv;
36620         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
36621         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
36622         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
36623         broadcaster_keys_conv.is_owned = false;
36624         LDKChannelPublicKeys countersignatory_keys_conv;
36625         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
36626         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
36628         countersignatory_keys_conv.is_owned = false;
36629         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36630         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
36631         return tag_ptr(ret_conv, true);
36632 }
36633
36634 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) {
36635         LDKPublicKey revocation_key_ref;
36636         CHECK(revocation_key->arr_len == 33);
36637         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
36638         LDKPublicKey broadcaster_delayed_payment_key_ref;
36639         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
36640         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
36641         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
36642         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36643         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36644         CVec_u8Z_free(ret_var);
36645         return ret_arr;
36646 }
36647
36648 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
36649         LDKHTLCOutputInCommitment this_obj_conv;
36650         this_obj_conv.inner = untag_ptr(this_obj);
36651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36653         HTLCOutputInCommitment_free(this_obj_conv);
36654 }
36655
36656 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
36657         LDKHTLCOutputInCommitment this_ptr_conv;
36658         this_ptr_conv.inner = untag_ptr(this_ptr);
36659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36661         this_ptr_conv.is_owned = false;
36662         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
36663         return ret_conv;
36664 }
36665
36666 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
36667         LDKHTLCOutputInCommitment this_ptr_conv;
36668         this_ptr_conv.inner = untag_ptr(this_ptr);
36669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36671         this_ptr_conv.is_owned = false;
36672         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
36673 }
36674
36675 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
36676         LDKHTLCOutputInCommitment this_ptr_conv;
36677         this_ptr_conv.inner = untag_ptr(this_ptr);
36678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36680         this_ptr_conv.is_owned = false;
36681         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
36682         return ret_conv;
36683 }
36684
36685 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
36686         LDKHTLCOutputInCommitment this_ptr_conv;
36687         this_ptr_conv.inner = untag_ptr(this_ptr);
36688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36690         this_ptr_conv.is_owned = false;
36691         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
36692 }
36693
36694 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
36695         LDKHTLCOutputInCommitment this_ptr_conv;
36696         this_ptr_conv.inner = untag_ptr(this_ptr);
36697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36699         this_ptr_conv.is_owned = false;
36700         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
36701         return ret_conv;
36702 }
36703
36704 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
36705         LDKHTLCOutputInCommitment this_ptr_conv;
36706         this_ptr_conv.inner = untag_ptr(this_ptr);
36707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36709         this_ptr_conv.is_owned = false;
36710         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
36711 }
36712
36713 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
36714         LDKHTLCOutputInCommitment this_ptr_conv;
36715         this_ptr_conv.inner = untag_ptr(this_ptr);
36716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36718         this_ptr_conv.is_owned = false;
36719         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36720         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
36721         return ret_arr;
36722 }
36723
36724 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
36725         LDKHTLCOutputInCommitment this_ptr_conv;
36726         this_ptr_conv.inner = untag_ptr(this_ptr);
36727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36729         this_ptr_conv.is_owned = false;
36730         LDKThirtyTwoBytes val_ref;
36731         CHECK(val->arr_len == 32);
36732         memcpy(val_ref.data, val->elems, 32); FREE(val);
36733         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
36734 }
36735
36736 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
36737         LDKHTLCOutputInCommitment this_ptr_conv;
36738         this_ptr_conv.inner = untag_ptr(this_ptr);
36739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36741         this_ptr_conv.is_owned = false;
36742         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36743         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
36744         uint64_t ret_ref = tag_ptr(ret_copy, true);
36745         return ret_ref;
36746 }
36747
36748 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
36749         LDKHTLCOutputInCommitment this_ptr_conv;
36750         this_ptr_conv.inner = untag_ptr(this_ptr);
36751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36753         this_ptr_conv.is_owned = false;
36754         void* val_ptr = untag_ptr(val);
36755         CHECK_ACCESS(val_ptr);
36756         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36757         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
36758         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
36759 }
36760
36761 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) {
36762         LDKThirtyTwoBytes payment_hash_arg_ref;
36763         CHECK(payment_hash_arg->arr_len == 32);
36764         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36765         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
36766         CHECK_ACCESS(transaction_output_index_arg_ptr);
36767         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
36768         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
36769         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
36770         uint64_t ret_ref = 0;
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36773         return ret_ref;
36774 }
36775
36776 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
36777         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
36778         uint64_t ret_ref = 0;
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36781         return ret_ref;
36782 }
36783 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
36784         LDKHTLCOutputInCommitment arg_conv;
36785         arg_conv.inner = untag_ptr(arg);
36786         arg_conv.is_owned = ptr_is_owned(arg);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36788         arg_conv.is_owned = false;
36789         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
36790         return ret_conv;
36791 }
36792
36793 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
36794         LDKHTLCOutputInCommitment orig_conv;
36795         orig_conv.inner = untag_ptr(orig);
36796         orig_conv.is_owned = ptr_is_owned(orig);
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36798         orig_conv.is_owned = false;
36799         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
36800         uint64_t ret_ref = 0;
36801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36803         return ret_ref;
36804 }
36805
36806 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
36807         LDKHTLCOutputInCommitment a_conv;
36808         a_conv.inner = untag_ptr(a);
36809         a_conv.is_owned = ptr_is_owned(a);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36811         a_conv.is_owned = false;
36812         LDKHTLCOutputInCommitment b_conv;
36813         b_conv.inner = untag_ptr(b);
36814         b_conv.is_owned = ptr_is_owned(b);
36815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36816         b_conv.is_owned = false;
36817         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
36818         return ret_conv;
36819 }
36820
36821 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
36822         LDKHTLCOutputInCommitment obj_conv;
36823         obj_conv.inner = untag_ptr(obj);
36824         obj_conv.is_owned = ptr_is_owned(obj);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36826         obj_conv.is_owned = false;
36827         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
36828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36830         CVec_u8Z_free(ret_var);
36831         return ret_arr;
36832 }
36833
36834 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
36835         LDKu8slice ser_ref;
36836         ser_ref.datalen = ser->arr_len;
36837         ser_ref.data = ser->elems;
36838         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36839         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
36840         FREE(ser);
36841         return tag_ptr(ret_conv, true);
36842 }
36843
36844 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
36845         LDKHTLCOutputInCommitment htlc_conv;
36846         htlc_conv.inner = untag_ptr(htlc);
36847         htlc_conv.is_owned = ptr_is_owned(htlc);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36849         htlc_conv.is_owned = false;
36850         LDKTxCreationKeys keys_conv;
36851         keys_conv.inner = untag_ptr(keys);
36852         keys_conv.is_owned = ptr_is_owned(keys);
36853         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36854         keys_conv.is_owned = false;
36855         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
36856         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36857         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36858         CVec_u8Z_free(ret_var);
36859         return ret_arr;
36860 }
36861
36862 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
36863         LDKPublicKey broadcaster_ref;
36864         CHECK(broadcaster->arr_len == 33);
36865         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
36866         LDKPublicKey countersignatory_ref;
36867         CHECK(countersignatory->arr_len == 33);
36868         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
36869         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
36870         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36871         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36872         CVec_u8Z_free(ret_var);
36873         return ret_arr;
36874 }
36875
36876 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) {
36877         unsigned char commitment_txid_arr[32];
36878         CHECK(commitment_txid->arr_len == 32);
36879         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
36880         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
36881         LDKHTLCOutputInCommitment htlc_conv;
36882         htlc_conv.inner = untag_ptr(htlc);
36883         htlc_conv.is_owned = ptr_is_owned(htlc);
36884         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36885         htlc_conv.is_owned = false;
36886         LDKPublicKey broadcaster_delayed_payment_key_ref;
36887         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
36888         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
36889         LDKPublicKey revocation_key_ref;
36890         CHECK(revocation_key->arr_len == 33);
36891         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
36892         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);
36893         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36894         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36895         Transaction_free(ret_var);
36896         return ret_arr;
36897 }
36898
36899 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
36900         LDKPublicKey funding_pubkey_ref;
36901         CHECK(funding_pubkey->arr_len == 33);
36902         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
36903         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
36904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36906         CVec_u8Z_free(ret_var);
36907         return ret_arr;
36908 }
36909
36910 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
36911         LDKChannelTransactionParameters this_obj_conv;
36912         this_obj_conv.inner = untag_ptr(this_obj);
36913         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36915         ChannelTransactionParameters_free(this_obj_conv);
36916 }
36917
36918 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
36919         LDKChannelTransactionParameters this_ptr_conv;
36920         this_ptr_conv.inner = untag_ptr(this_ptr);
36921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36923         this_ptr_conv.is_owned = false;
36924         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36925         uint64_t ret_ref = 0;
36926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36928         return ret_ref;
36929 }
36930
36931 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
36932         LDKChannelTransactionParameters this_ptr_conv;
36933         this_ptr_conv.inner = untag_ptr(this_ptr);
36934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36936         this_ptr_conv.is_owned = false;
36937         LDKChannelPublicKeys val_conv;
36938         val_conv.inner = untag_ptr(val);
36939         val_conv.is_owned = ptr_is_owned(val);
36940         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36941         val_conv = ChannelPublicKeys_clone(&val_conv);
36942         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
36943 }
36944
36945 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
36946         LDKChannelTransactionParameters this_ptr_conv;
36947         this_ptr_conv.inner = untag_ptr(this_ptr);
36948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36950         this_ptr_conv.is_owned = false;
36951         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
36952         return ret_conv;
36953 }
36954
36955 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) {
36956         LDKChannelTransactionParameters this_ptr_conv;
36957         this_ptr_conv.inner = untag_ptr(this_ptr);
36958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36960         this_ptr_conv.is_owned = false;
36961         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
36962 }
36963
36964 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
36965         LDKChannelTransactionParameters this_ptr_conv;
36966         this_ptr_conv.inner = untag_ptr(this_ptr);
36967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36969         this_ptr_conv.is_owned = false;
36970         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
36971         return ret_conv;
36972 }
36973
36974 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
36975         LDKChannelTransactionParameters this_ptr_conv;
36976         this_ptr_conv.inner = untag_ptr(this_ptr);
36977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36979         this_ptr_conv.is_owned = false;
36980         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
36981 }
36982
36983 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
36984         LDKChannelTransactionParameters this_ptr_conv;
36985         this_ptr_conv.inner = untag_ptr(this_ptr);
36986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36988         this_ptr_conv.is_owned = false;
36989         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
36990         uint64_t ret_ref = 0;
36991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36993         return ret_ref;
36994 }
36995
36996 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
36997         LDKChannelTransactionParameters this_ptr_conv;
36998         this_ptr_conv.inner = untag_ptr(this_ptr);
36999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37001         this_ptr_conv.is_owned = false;
37002         LDKCounterpartyChannelTransactionParameters val_conv;
37003         val_conv.inner = untag_ptr(val);
37004         val_conv.is_owned = ptr_is_owned(val);
37005         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37006         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
37007         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
37008 }
37009
37010 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
37011         LDKChannelTransactionParameters this_ptr_conv;
37012         this_ptr_conv.inner = untag_ptr(this_ptr);
37013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37015         this_ptr_conv.is_owned = false;
37016         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
37017         uint64_t ret_ref = 0;
37018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37020         return ret_ref;
37021 }
37022
37023 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
37024         LDKChannelTransactionParameters this_ptr_conv;
37025         this_ptr_conv.inner = untag_ptr(this_ptr);
37026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37028         this_ptr_conv.is_owned = false;
37029         LDKOutPoint val_conv;
37030         val_conv.inner = untag_ptr(val);
37031         val_conv.is_owned = ptr_is_owned(val);
37032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37033         val_conv = OutPoint_clone(&val_conv);
37034         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
37035 }
37036
37037 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
37038         LDKChannelTransactionParameters this_ptr_conv;
37039         this_ptr_conv.inner = untag_ptr(this_ptr);
37040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37042         this_ptr_conv.is_owned = false;
37043         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
37044         return ret_conv;
37045 }
37046
37047 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
37048         LDKChannelTransactionParameters this_ptr_conv;
37049         this_ptr_conv.inner = untag_ptr(this_ptr);
37050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37052         this_ptr_conv.is_owned = false;
37053         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
37054         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
37055 }
37056
37057 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) {
37058         LDKChannelPublicKeys holder_pubkeys_arg_conv;
37059         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
37060         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
37061         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
37062         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
37063         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
37064         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
37065         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
37066         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
37067         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
37068         LDKOutPoint funding_outpoint_arg_conv;
37069         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
37070         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
37071         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37072         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37073         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
37074         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);
37075         uint64_t ret_ref = 0;
37076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37078         return ret_ref;
37079 }
37080
37081 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37082         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37083         uint64_t ret_ref = 0;
37084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37086         return ret_ref;
37087 }
37088 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
37089         LDKChannelTransactionParameters arg_conv;
37090         arg_conv.inner = untag_ptr(arg);
37091         arg_conv.is_owned = ptr_is_owned(arg);
37092         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37093         arg_conv.is_owned = false;
37094         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
37095         return ret_conv;
37096 }
37097
37098 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
37099         LDKChannelTransactionParameters orig_conv;
37100         orig_conv.inner = untag_ptr(orig);
37101         orig_conv.is_owned = ptr_is_owned(orig);
37102         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37103         orig_conv.is_owned = false;
37104         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37105         uint64_t ret_ref = 0;
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37108         return ret_ref;
37109 }
37110
37111 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
37112         LDKCounterpartyChannelTransactionParameters this_obj_conv;
37113         this_obj_conv.inner = untag_ptr(this_obj);
37114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37116         CounterpartyChannelTransactionParameters_free(this_obj_conv);
37117 }
37118
37119 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
37120         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37121         this_ptr_conv.inner = untag_ptr(this_ptr);
37122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37124         this_ptr_conv.is_owned = false;
37125         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37126         uint64_t ret_ref = 0;
37127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37129         return ret_ref;
37130 }
37131
37132 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
37133         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37134         this_ptr_conv.inner = untag_ptr(this_ptr);
37135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37137         this_ptr_conv.is_owned = false;
37138         LDKChannelPublicKeys val_conv;
37139         val_conv.inner = untag_ptr(val);
37140         val_conv.is_owned = ptr_is_owned(val);
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37142         val_conv = ChannelPublicKeys_clone(&val_conv);
37143         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37144 }
37145
37146 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
37147         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37148         this_ptr_conv.inner = untag_ptr(this_ptr);
37149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37151         this_ptr_conv.is_owned = false;
37152         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37153         return ret_conv;
37154 }
37155
37156 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
37157         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37158         this_ptr_conv.inner = untag_ptr(this_ptr);
37159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37161         this_ptr_conv.is_owned = false;
37162         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37163 }
37164
37165 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
37166         LDKChannelPublicKeys pubkeys_arg_conv;
37167         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
37168         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
37169         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37170         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37171         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37172         uint64_t ret_ref = 0;
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37175         return ret_ref;
37176 }
37177
37178 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37179         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37180         uint64_t ret_ref = 0;
37181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37183         return ret_ref;
37184 }
37185 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
37186         LDKCounterpartyChannelTransactionParameters arg_conv;
37187         arg_conv.inner = untag_ptr(arg);
37188         arg_conv.is_owned = ptr_is_owned(arg);
37189         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37190         arg_conv.is_owned = false;
37191         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37192         return ret_conv;
37193 }
37194
37195 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
37196         LDKCounterpartyChannelTransactionParameters orig_conv;
37197         orig_conv.inner = untag_ptr(orig);
37198         orig_conv.is_owned = ptr_is_owned(orig);
37199         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37200         orig_conv.is_owned = false;
37201         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37202         uint64_t ret_ref = 0;
37203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37205         return ret_ref;
37206 }
37207
37208 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
37209         LDKChannelTransactionParameters this_arg_conv;
37210         this_arg_conv.inner = untag_ptr(this_arg);
37211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37213         this_arg_conv.is_owned = false;
37214         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
37215         return ret_conv;
37216 }
37217
37218 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
37219         LDKChannelTransactionParameters this_arg_conv;
37220         this_arg_conv.inner = untag_ptr(this_arg);
37221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37223         this_arg_conv.is_owned = false;
37224         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37225         uint64_t ret_ref = 0;
37226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37228         return ret_ref;
37229 }
37230
37231 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
37232         LDKChannelTransactionParameters this_arg_conv;
37233         this_arg_conv.inner = untag_ptr(this_arg);
37234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37236         this_arg_conv.is_owned = false;
37237         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37238         uint64_t ret_ref = 0;
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37241         return ret_ref;
37242 }
37243
37244 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
37245         LDKCounterpartyChannelTransactionParameters obj_conv;
37246         obj_conv.inner = untag_ptr(obj);
37247         obj_conv.is_owned = ptr_is_owned(obj);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37249         obj_conv.is_owned = false;
37250         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37251         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37252         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37253         CVec_u8Z_free(ret_var);
37254         return ret_arr;
37255 }
37256
37257 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
37258         LDKu8slice ser_ref;
37259         ser_ref.datalen = ser->arr_len;
37260         ser_ref.data = ser->elems;
37261         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37262         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37263         FREE(ser);
37264         return tag_ptr(ret_conv, true);
37265 }
37266
37267 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
37268         LDKChannelTransactionParameters obj_conv;
37269         obj_conv.inner = untag_ptr(obj);
37270         obj_conv.is_owned = ptr_is_owned(obj);
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37272         obj_conv.is_owned = false;
37273         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37276         CVec_u8Z_free(ret_var);
37277         return ret_arr;
37278 }
37279
37280 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
37281         LDKu8slice ser_ref;
37282         ser_ref.datalen = ser->arr_len;
37283         ser_ref.data = ser->elems;
37284         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37285         *ret_conv = ChannelTransactionParameters_read(ser_ref);
37286         FREE(ser);
37287         return tag_ptr(ret_conv, true);
37288 }
37289
37290 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
37291         LDKDirectedChannelTransactionParameters this_obj_conv;
37292         this_obj_conv.inner = untag_ptr(this_obj);
37293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37295         DirectedChannelTransactionParameters_free(this_obj_conv);
37296 }
37297
37298 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
37299         LDKDirectedChannelTransactionParameters this_arg_conv;
37300         this_arg_conv.inner = untag_ptr(this_arg);
37301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37303         this_arg_conv.is_owned = false;
37304         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37305         uint64_t ret_ref = 0;
37306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37308         return ret_ref;
37309 }
37310
37311 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
37312         LDKDirectedChannelTransactionParameters this_arg_conv;
37313         this_arg_conv.inner = untag_ptr(this_arg);
37314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37316         this_arg_conv.is_owned = false;
37317         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37318         uint64_t ret_ref = 0;
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37321         return ret_ref;
37322 }
37323
37324 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
37325         LDKDirectedChannelTransactionParameters this_arg_conv;
37326         this_arg_conv.inner = untag_ptr(this_arg);
37327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37329         this_arg_conv.is_owned = false;
37330         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
37331         return ret_conv;
37332 }
37333
37334 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
37335         LDKDirectedChannelTransactionParameters this_arg_conv;
37336         this_arg_conv.inner = untag_ptr(this_arg);
37337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37339         this_arg_conv.is_owned = false;
37340         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
37341         return ret_conv;
37342 }
37343
37344 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
37345         LDKDirectedChannelTransactionParameters this_arg_conv;
37346         this_arg_conv.inner = untag_ptr(this_arg);
37347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37349         this_arg_conv.is_owned = false;
37350         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
37351         uint64_t ret_ref = 0;
37352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37354         return ret_ref;
37355 }
37356
37357 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
37358         LDKDirectedChannelTransactionParameters this_arg_conv;
37359         this_arg_conv.inner = untag_ptr(this_arg);
37360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37362         this_arg_conv.is_owned = false;
37363         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
37364         return ret_conv;
37365 }
37366
37367 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
37368         LDKHolderCommitmentTransaction this_obj_conv;
37369         this_obj_conv.inner = untag_ptr(this_obj);
37370         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37372         HolderCommitmentTransaction_free(this_obj_conv);
37373 }
37374
37375 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
37376         LDKHolderCommitmentTransaction this_ptr_conv;
37377         this_ptr_conv.inner = untag_ptr(this_ptr);
37378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37380         this_ptr_conv.is_owned = false;
37381         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37382         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
37383         return ret_arr;
37384 }
37385
37386 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
37387         LDKHolderCommitmentTransaction this_ptr_conv;
37388         this_ptr_conv.inner = untag_ptr(this_ptr);
37389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37391         this_ptr_conv.is_owned = false;
37392         LDKSignature val_ref;
37393         CHECK(val->arr_len == 64);
37394         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
37395         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
37396 }
37397
37398 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
37399         LDKHolderCommitmentTransaction this_ptr_conv;
37400         this_ptr_conv.inner = untag_ptr(this_ptr);
37401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37403         this_ptr_conv.is_owned = false;
37404         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
37405         ptrArray ret_arr = NULL;
37406         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37407         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
37408         for (size_t m = 0; m < ret_var.datalen; m++) {
37409                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
37410                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
37411                 ret_arr_ptr[m] = ret_conv_12_arr;
37412         }
37413         
37414         FREE(ret_var.data);
37415         return ret_arr;
37416 }
37417
37418 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
37419         LDKHolderCommitmentTransaction this_ptr_conv;
37420         this_ptr_conv.inner = untag_ptr(this_ptr);
37421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37423         this_ptr_conv.is_owned = false;
37424         LDKCVec_SignatureZ val_constr;
37425         val_constr.datalen = val->arr_len;
37426         if (val_constr.datalen > 0)
37427                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37428         else
37429                 val_constr.data = NULL;
37430         int8_tArray* val_vals = (void*) val->elems;
37431         for (size_t m = 0; m < val_constr.datalen; m++) {
37432                 int8_tArray val_conv_12 = val_vals[m];
37433                 LDKSignature val_conv_12_ref;
37434                 CHECK(val_conv_12->arr_len == 64);
37435                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
37436                 val_constr.data[m] = val_conv_12_ref;
37437         }
37438         FREE(val);
37439         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
37440 }
37441
37442 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
37443         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
37444         uint64_t ret_ref = 0;
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37447         return ret_ref;
37448 }
37449 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
37450         LDKHolderCommitmentTransaction arg_conv;
37451         arg_conv.inner = untag_ptr(arg);
37452         arg_conv.is_owned = ptr_is_owned(arg);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37454         arg_conv.is_owned = false;
37455         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
37456         return ret_conv;
37457 }
37458
37459 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
37460         LDKHolderCommitmentTransaction orig_conv;
37461         orig_conv.inner = untag_ptr(orig);
37462         orig_conv.is_owned = ptr_is_owned(orig);
37463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37464         orig_conv.is_owned = false;
37465         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
37466         uint64_t ret_ref = 0;
37467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37469         return ret_ref;
37470 }
37471
37472 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
37473         LDKHolderCommitmentTransaction obj_conv;
37474         obj_conv.inner = untag_ptr(obj);
37475         obj_conv.is_owned = ptr_is_owned(obj);
37476         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37477         obj_conv.is_owned = false;
37478         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
37479         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37480         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37481         CVec_u8Z_free(ret_var);
37482         return ret_arr;
37483 }
37484
37485 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
37486         LDKu8slice ser_ref;
37487         ser_ref.datalen = ser->arr_len;
37488         ser_ref.data = ser->elems;
37489         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37490         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
37491         FREE(ser);
37492         return tag_ptr(ret_conv, true);
37493 }
37494
37495 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) {
37496         LDKCommitmentTransaction commitment_tx_conv;
37497         commitment_tx_conv.inner = untag_ptr(commitment_tx);
37498         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
37499         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
37500         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
37501         LDKSignature counterparty_sig_ref;
37502         CHECK(counterparty_sig->arr_len == 64);
37503         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
37504         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
37505         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
37506         if (counterparty_htlc_sigs_constr.datalen > 0)
37507                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37508         else
37509                 counterparty_htlc_sigs_constr.data = NULL;
37510         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
37511         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
37512                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
37513                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
37514                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
37515                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
37516                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
37517         }
37518         FREE(counterparty_htlc_sigs);
37519         LDKPublicKey holder_funding_key_ref;
37520         CHECK(holder_funding_key->arr_len == 33);
37521         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
37522         LDKPublicKey counterparty_funding_key_ref;
37523         CHECK(counterparty_funding_key->arr_len == 33);
37524         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
37525         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
37526         uint64_t ret_ref = 0;
37527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37529         return ret_ref;
37530 }
37531
37532 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
37533         LDKBuiltCommitmentTransaction this_obj_conv;
37534         this_obj_conv.inner = untag_ptr(this_obj);
37535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37537         BuiltCommitmentTransaction_free(this_obj_conv);
37538 }
37539
37540 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
37541         LDKBuiltCommitmentTransaction this_ptr_conv;
37542         this_ptr_conv.inner = untag_ptr(this_ptr);
37543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37545         this_ptr_conv.is_owned = false;
37546         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
37547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37549         Transaction_free(ret_var);
37550         return ret_arr;
37551 }
37552
37553 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
37554         LDKBuiltCommitmentTransaction this_ptr_conv;
37555         this_ptr_conv.inner = untag_ptr(this_ptr);
37556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37558         this_ptr_conv.is_owned = false;
37559         LDKTransaction val_ref;
37560         val_ref.datalen = val->arr_len;
37561         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
37562         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37563         val_ref.data_is_owned = true;
37564         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
37565 }
37566
37567 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
37568         LDKBuiltCommitmentTransaction this_ptr_conv;
37569         this_ptr_conv.inner = untag_ptr(this_ptr);
37570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37572         this_ptr_conv.is_owned = false;
37573         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37574         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
37575         return ret_arr;
37576 }
37577
37578 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
37579         LDKBuiltCommitmentTransaction this_ptr_conv;
37580         this_ptr_conv.inner = untag_ptr(this_ptr);
37581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37583         this_ptr_conv.is_owned = false;
37584         LDKThirtyTwoBytes val_ref;
37585         CHECK(val->arr_len == 32);
37586         memcpy(val_ref.data, val->elems, 32); FREE(val);
37587         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
37588 }
37589
37590 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
37591         LDKTransaction transaction_arg_ref;
37592         transaction_arg_ref.datalen = transaction_arg->arr_len;
37593         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
37594         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
37595         transaction_arg_ref.data_is_owned = true;
37596         LDKThirtyTwoBytes txid_arg_ref;
37597         CHECK(txid_arg->arr_len == 32);
37598         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
37599         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
37600         uint64_t ret_ref = 0;
37601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37603         return ret_ref;
37604 }
37605
37606 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
37607         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
37608         uint64_t ret_ref = 0;
37609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37611         return ret_ref;
37612 }
37613 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
37614         LDKBuiltCommitmentTransaction arg_conv;
37615         arg_conv.inner = untag_ptr(arg);
37616         arg_conv.is_owned = ptr_is_owned(arg);
37617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37618         arg_conv.is_owned = false;
37619         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
37620         return ret_conv;
37621 }
37622
37623 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
37624         LDKBuiltCommitmentTransaction orig_conv;
37625         orig_conv.inner = untag_ptr(orig);
37626         orig_conv.is_owned = ptr_is_owned(orig);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37628         orig_conv.is_owned = false;
37629         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
37630         uint64_t ret_ref = 0;
37631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37633         return ret_ref;
37634 }
37635
37636 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
37637         LDKBuiltCommitmentTransaction obj_conv;
37638         obj_conv.inner = untag_ptr(obj);
37639         obj_conv.is_owned = ptr_is_owned(obj);
37640         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37641         obj_conv.is_owned = false;
37642         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
37643         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37644         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37645         CVec_u8Z_free(ret_var);
37646         return ret_arr;
37647 }
37648
37649 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
37650         LDKu8slice ser_ref;
37651         ser_ref.datalen = ser->arr_len;
37652         ser_ref.data = ser->elems;
37653         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37654         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
37655         FREE(ser);
37656         return tag_ptr(ret_conv, true);
37657 }
37658
37659 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) {
37660         LDKBuiltCommitmentTransaction this_arg_conv;
37661         this_arg_conv.inner = untag_ptr(this_arg);
37662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37664         this_arg_conv.is_owned = false;
37665         LDKu8slice funding_redeemscript_ref;
37666         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37667         funding_redeemscript_ref.data = funding_redeemscript->elems;
37668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37669         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
37670         FREE(funding_redeemscript);
37671         return ret_arr;
37672 }
37673
37674 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) {
37675         LDKBuiltCommitmentTransaction this_arg_conv;
37676         this_arg_conv.inner = untag_ptr(this_arg);
37677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37679         this_arg_conv.is_owned = false;
37680         unsigned char funding_key_arr[32];
37681         CHECK(funding_key->arr_len == 32);
37682         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
37683         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37684         LDKu8slice funding_redeemscript_ref;
37685         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37686         funding_redeemscript_ref.data = funding_redeemscript->elems;
37687         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37688         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
37689         FREE(funding_redeemscript);
37690         return ret_arr;
37691 }
37692
37693 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
37694         LDKClosingTransaction this_obj_conv;
37695         this_obj_conv.inner = untag_ptr(this_obj);
37696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37698         ClosingTransaction_free(this_obj_conv);
37699 }
37700
37701 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
37702         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
37703         uint64_t ret_ref = 0;
37704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37706         return ret_ref;
37707 }
37708 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
37709         LDKClosingTransaction arg_conv;
37710         arg_conv.inner = untag_ptr(arg);
37711         arg_conv.is_owned = ptr_is_owned(arg);
37712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37713         arg_conv.is_owned = false;
37714         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
37715         return ret_conv;
37716 }
37717
37718 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
37719         LDKClosingTransaction orig_conv;
37720         orig_conv.inner = untag_ptr(orig);
37721         orig_conv.is_owned = ptr_is_owned(orig);
37722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37723         orig_conv.is_owned = false;
37724         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
37725         uint64_t ret_ref = 0;
37726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37728         return ret_ref;
37729 }
37730
37731 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
37732         LDKClosingTransaction o_conv;
37733         o_conv.inner = untag_ptr(o);
37734         o_conv.is_owned = ptr_is_owned(o);
37735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37736         o_conv.is_owned = false;
37737         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
37738         return ret_conv;
37739 }
37740
37741 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
37742         LDKClosingTransaction a_conv;
37743         a_conv.inner = untag_ptr(a);
37744         a_conv.is_owned = ptr_is_owned(a);
37745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37746         a_conv.is_owned = false;
37747         LDKClosingTransaction b_conv;
37748         b_conv.inner = untag_ptr(b);
37749         b_conv.is_owned = ptr_is_owned(b);
37750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37751         b_conv.is_owned = false;
37752         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
37753         return ret_conv;
37754 }
37755
37756 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) {
37757         LDKCVec_u8Z to_holder_script_ref;
37758         to_holder_script_ref.datalen = to_holder_script->arr_len;
37759         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37760         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37761         LDKCVec_u8Z to_counterparty_script_ref;
37762         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37763         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37764         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37765         LDKOutPoint funding_outpoint_conv;
37766         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37767         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37768         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37769         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37770         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
37771         uint64_t ret_ref = 0;
37772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37774         return ret_ref;
37775 }
37776
37777 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
37778         LDKClosingTransaction this_arg_conv;
37779         this_arg_conv.inner = untag_ptr(this_arg);
37780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37782         this_arg_conv.is_owned = false;
37783         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
37784         uint64_t ret_ref = 0;
37785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37787         return ret_ref;
37788 }
37789
37790 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
37791         LDKClosingTransaction this_arg_conv;
37792         this_arg_conv.inner = untag_ptr(this_arg);
37793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37795         this_arg_conv.is_owned = false;
37796         LDKOutPoint funding_outpoint_conv;
37797         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37798         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37799         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37800         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37801         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37802         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
37803         return tag_ptr(ret_conv, true);
37804 }
37805
37806 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
37807         LDKClosingTransaction this_arg_conv;
37808         this_arg_conv.inner = untag_ptr(this_arg);
37809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37811         this_arg_conv.is_owned = false;
37812         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
37813         return ret_conv;
37814 }
37815
37816 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
37817         LDKClosingTransaction this_arg_conv;
37818         this_arg_conv.inner = untag_ptr(this_arg);
37819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37821         this_arg_conv.is_owned = false;
37822         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
37823         return ret_conv;
37824 }
37825
37826 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
37827         LDKClosingTransaction this_arg_conv;
37828         this_arg_conv.inner = untag_ptr(this_arg);
37829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37831         this_arg_conv.is_owned = false;
37832         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
37833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37835         return ret_arr;
37836 }
37837
37838 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
37839         LDKClosingTransaction this_arg_conv;
37840         this_arg_conv.inner = untag_ptr(this_arg);
37841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37843         this_arg_conv.is_owned = false;
37844         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
37845         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37846         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37847         return ret_arr;
37848 }
37849
37850 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
37851         LDKTrustedClosingTransaction this_obj_conv;
37852         this_obj_conv.inner = untag_ptr(this_obj);
37853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37855         TrustedClosingTransaction_free(this_obj_conv);
37856 }
37857
37858 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
37859         LDKTrustedClosingTransaction this_arg_conv;
37860         this_arg_conv.inner = untag_ptr(this_arg);
37861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37863         this_arg_conv.is_owned = false;
37864         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
37865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37867         Transaction_free(ret_var);
37868         return ret_arr;
37869 }
37870
37871 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) {
37872         LDKTrustedClosingTransaction this_arg_conv;
37873         this_arg_conv.inner = untag_ptr(this_arg);
37874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37876         this_arg_conv.is_owned = false;
37877         LDKu8slice funding_redeemscript_ref;
37878         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37879         funding_redeemscript_ref.data = funding_redeemscript->elems;
37880         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37881         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
37882         FREE(funding_redeemscript);
37883         return ret_arr;
37884 }
37885
37886 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) {
37887         LDKTrustedClosingTransaction this_arg_conv;
37888         this_arg_conv.inner = untag_ptr(this_arg);
37889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37891         this_arg_conv.is_owned = false;
37892         unsigned char funding_key_arr[32];
37893         CHECK(funding_key->arr_len == 32);
37894         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
37895         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37896         LDKu8slice funding_redeemscript_ref;
37897         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
37898         funding_redeemscript_ref.data = funding_redeemscript->elems;
37899         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
37900         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
37901         FREE(funding_redeemscript);
37902         return ret_arr;
37903 }
37904
37905 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
37906         LDKCommitmentTransaction this_obj_conv;
37907         this_obj_conv.inner = untag_ptr(this_obj);
37908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37910         CommitmentTransaction_free(this_obj_conv);
37911 }
37912
37913 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
37914         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
37915         uint64_t ret_ref = 0;
37916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37918         return ret_ref;
37919 }
37920 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
37921         LDKCommitmentTransaction arg_conv;
37922         arg_conv.inner = untag_ptr(arg);
37923         arg_conv.is_owned = ptr_is_owned(arg);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37925         arg_conv.is_owned = false;
37926         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
37927         return ret_conv;
37928 }
37929
37930 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
37931         LDKCommitmentTransaction orig_conv;
37932         orig_conv.inner = untag_ptr(orig);
37933         orig_conv.is_owned = ptr_is_owned(orig);
37934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37935         orig_conv.is_owned = false;
37936         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
37937         uint64_t ret_ref = 0;
37938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37940         return ret_ref;
37941 }
37942
37943 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
37944         LDKCommitmentTransaction obj_conv;
37945         obj_conv.inner = untag_ptr(obj);
37946         obj_conv.is_owned = ptr_is_owned(obj);
37947         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37948         obj_conv.is_owned = false;
37949         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
37950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37952         CVec_u8Z_free(ret_var);
37953         return ret_arr;
37954 }
37955
37956 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
37957         LDKu8slice ser_ref;
37958         ser_ref.datalen = ser->arr_len;
37959         ser_ref.data = ser->elems;
37960         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37961         *ret_conv = CommitmentTransaction_read(ser_ref);
37962         FREE(ser);
37963         return tag_ptr(ret_conv, true);
37964 }
37965
37966 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
37967         LDKCommitmentTransaction this_arg_conv;
37968         this_arg_conv.inner = untag_ptr(this_arg);
37969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37971         this_arg_conv.is_owned = false;
37972         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
37973         return ret_conv;
37974 }
37975
37976 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
37977         LDKCommitmentTransaction this_arg_conv;
37978         this_arg_conv.inner = untag_ptr(this_arg);
37979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37981         this_arg_conv.is_owned = false;
37982         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
37983         return ret_conv;
37984 }
37985
37986 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
37987         LDKCommitmentTransaction this_arg_conv;
37988         this_arg_conv.inner = untag_ptr(this_arg);
37989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37991         this_arg_conv.is_owned = false;
37992         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37993         return ret_conv;
37994 }
37995
37996 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
37997         LDKCommitmentTransaction this_arg_conv;
37998         this_arg_conv.inner = untag_ptr(this_arg);
37999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38001         this_arg_conv.is_owned = false;
38002         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
38003         return ret_conv;
38004 }
38005
38006 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
38007         LDKCommitmentTransaction this_arg_conv;
38008         this_arg_conv.inner = untag_ptr(this_arg);
38009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38011         this_arg_conv.is_owned = false;
38012         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
38013         uint64_t ret_ref = 0;
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38016         return ret_ref;
38017 }
38018
38019 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) {
38020         LDKCommitmentTransaction this_arg_conv;
38021         this_arg_conv.inner = untag_ptr(this_arg);
38022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38024         this_arg_conv.is_owned = false;
38025         LDKDirectedChannelTransactionParameters channel_parameters_conv;
38026         channel_parameters_conv.inner = untag_ptr(channel_parameters);
38027         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
38028         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38029         channel_parameters_conv.is_owned = false;
38030         LDKChannelPublicKeys broadcaster_keys_conv;
38031         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
38032         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
38033         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38034         broadcaster_keys_conv.is_owned = false;
38035         LDKChannelPublicKeys countersignatory_keys_conv;
38036         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
38037         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38039         countersignatory_keys_conv.is_owned = false;
38040         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
38041         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
38042         return tag_ptr(ret_conv, true);
38043 }
38044
38045 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
38046         LDKTrustedCommitmentTransaction this_obj_conv;
38047         this_obj_conv.inner = untag_ptr(this_obj);
38048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38050         TrustedCommitmentTransaction_free(this_obj_conv);
38051 }
38052
38053 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
38054         LDKTrustedCommitmentTransaction this_arg_conv;
38055         this_arg_conv.inner = untag_ptr(this_arg);
38056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38058         this_arg_conv.is_owned = false;
38059         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38060         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
38061         return ret_arr;
38062 }
38063
38064 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
38065         LDKTrustedCommitmentTransaction this_arg_conv;
38066         this_arg_conv.inner = untag_ptr(this_arg);
38067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38069         this_arg_conv.is_owned = false;
38070         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38071         uint64_t ret_ref = 0;
38072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38074         return ret_ref;
38075 }
38076
38077 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
38078         LDKTrustedCommitmentTransaction this_arg_conv;
38079         this_arg_conv.inner = untag_ptr(this_arg);
38080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38082         this_arg_conv.is_owned = false;
38083         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38084         uint64_t ret_ref = 0;
38085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38087         return ret_ref;
38088 }
38089
38090 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
38091         LDKTrustedCommitmentTransaction this_arg_conv;
38092         this_arg_conv.inner = untag_ptr(this_arg);
38093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38095         this_arg_conv.is_owned = false;
38096         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38097         return ret_conv;
38098 }
38099
38100 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) {
38101         LDKTrustedCommitmentTransaction this_arg_conv;
38102         this_arg_conv.inner = untag_ptr(this_arg);
38103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38105         this_arg_conv.is_owned = false;
38106         unsigned char htlc_base_key_arr[32];
38107         CHECK(htlc_base_key->arr_len == 32);
38108         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
38109         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38110         LDKDirectedChannelTransactionParameters channel_parameters_conv;
38111         channel_parameters_conv.inner = untag_ptr(channel_parameters);
38112         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
38113         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38114         channel_parameters_conv.is_owned = false;
38115         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38116         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38117         return tag_ptr(ret_conv, true);
38118 }
38119
38120 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) {
38121         LDKPublicKey broadcaster_payment_basepoint_ref;
38122         CHECK(broadcaster_payment_basepoint->arr_len == 33);
38123         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
38124         LDKPublicKey countersignatory_payment_basepoint_ref;
38125         CHECK(countersignatory_payment_basepoint->arr_len == 33);
38126         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
38127         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38128         return ret_conv;
38129 }
38130
38131 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
38132         LDKInitFeatures a_conv;
38133         a_conv.inner = untag_ptr(a);
38134         a_conv.is_owned = ptr_is_owned(a);
38135         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38136         a_conv.is_owned = false;
38137         LDKInitFeatures b_conv;
38138         b_conv.inner = untag_ptr(b);
38139         b_conv.is_owned = ptr_is_owned(b);
38140         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38141         b_conv.is_owned = false;
38142         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
38143         return ret_conv;
38144 }
38145
38146 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
38147         LDKNodeFeatures a_conv;
38148         a_conv.inner = untag_ptr(a);
38149         a_conv.is_owned = ptr_is_owned(a);
38150         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38151         a_conv.is_owned = false;
38152         LDKNodeFeatures b_conv;
38153         b_conv.inner = untag_ptr(b);
38154         b_conv.is_owned = ptr_is_owned(b);
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38156         b_conv.is_owned = false;
38157         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
38158         return ret_conv;
38159 }
38160
38161 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
38162         LDKChannelFeatures a_conv;
38163         a_conv.inner = untag_ptr(a);
38164         a_conv.is_owned = ptr_is_owned(a);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38166         a_conv.is_owned = false;
38167         LDKChannelFeatures b_conv;
38168         b_conv.inner = untag_ptr(b);
38169         b_conv.is_owned = ptr_is_owned(b);
38170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38171         b_conv.is_owned = false;
38172         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
38173         return ret_conv;
38174 }
38175
38176 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
38177         LDKInvoiceFeatures a_conv;
38178         a_conv.inner = untag_ptr(a);
38179         a_conv.is_owned = ptr_is_owned(a);
38180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38181         a_conv.is_owned = false;
38182         LDKInvoiceFeatures b_conv;
38183         b_conv.inner = untag_ptr(b);
38184         b_conv.is_owned = ptr_is_owned(b);
38185         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38186         b_conv.is_owned = false;
38187         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
38188         return ret_conv;
38189 }
38190
38191 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
38192         LDKChannelTypeFeatures a_conv;
38193         a_conv.inner = untag_ptr(a);
38194         a_conv.is_owned = ptr_is_owned(a);
38195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38196         a_conv.is_owned = false;
38197         LDKChannelTypeFeatures b_conv;
38198         b_conv.inner = untag_ptr(b);
38199         b_conv.is_owned = ptr_is_owned(b);
38200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38201         b_conv.is_owned = false;
38202         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38203         return ret_conv;
38204 }
38205
38206 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38207         LDKInitFeatures ret_var = InitFeatures_clone(arg);
38208         uint64_t ret_ref = 0;
38209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38211         return ret_ref;
38212 }
38213 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
38214         LDKInitFeatures arg_conv;
38215         arg_conv.inner = untag_ptr(arg);
38216         arg_conv.is_owned = ptr_is_owned(arg);
38217         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38218         arg_conv.is_owned = false;
38219         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
38220         return ret_conv;
38221 }
38222
38223 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
38224         LDKInitFeatures orig_conv;
38225         orig_conv.inner = untag_ptr(orig);
38226         orig_conv.is_owned = ptr_is_owned(orig);
38227         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38228         orig_conv.is_owned = false;
38229         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38230         uint64_t ret_ref = 0;
38231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38233         return ret_ref;
38234 }
38235
38236 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38237         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38238         uint64_t ret_ref = 0;
38239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38241         return ret_ref;
38242 }
38243 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
38244         LDKNodeFeatures arg_conv;
38245         arg_conv.inner = untag_ptr(arg);
38246         arg_conv.is_owned = ptr_is_owned(arg);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38248         arg_conv.is_owned = false;
38249         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
38250         return ret_conv;
38251 }
38252
38253 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
38254         LDKNodeFeatures orig_conv;
38255         orig_conv.inner = untag_ptr(orig);
38256         orig_conv.is_owned = ptr_is_owned(orig);
38257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38258         orig_conv.is_owned = false;
38259         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38260         uint64_t ret_ref = 0;
38261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38263         return ret_ref;
38264 }
38265
38266 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38267         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38268         uint64_t ret_ref = 0;
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38271         return ret_ref;
38272 }
38273 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
38274         LDKChannelFeatures arg_conv;
38275         arg_conv.inner = untag_ptr(arg);
38276         arg_conv.is_owned = ptr_is_owned(arg);
38277         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38278         arg_conv.is_owned = false;
38279         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
38280         return ret_conv;
38281 }
38282
38283 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
38284         LDKChannelFeatures orig_conv;
38285         orig_conv.inner = untag_ptr(orig);
38286         orig_conv.is_owned = ptr_is_owned(orig);
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38288         orig_conv.is_owned = false;
38289         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
38290         uint64_t ret_ref = 0;
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38293         return ret_ref;
38294 }
38295
38296 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38297         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38298         uint64_t ret_ref = 0;
38299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38301         return ret_ref;
38302 }
38303 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
38304         LDKInvoiceFeatures arg_conv;
38305         arg_conv.inner = untag_ptr(arg);
38306         arg_conv.is_owned = ptr_is_owned(arg);
38307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38308         arg_conv.is_owned = false;
38309         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
38310         return ret_conv;
38311 }
38312
38313 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
38314         LDKInvoiceFeatures orig_conv;
38315         orig_conv.inner = untag_ptr(orig);
38316         orig_conv.is_owned = ptr_is_owned(orig);
38317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38318         orig_conv.is_owned = false;
38319         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
38320         uint64_t ret_ref = 0;
38321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38323         return ret_ref;
38324 }
38325
38326 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
38327         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
38328         uint64_t ret_ref = 0;
38329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38331         return ret_ref;
38332 }
38333 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
38334         LDKChannelTypeFeatures arg_conv;
38335         arg_conv.inner = untag_ptr(arg);
38336         arg_conv.is_owned = ptr_is_owned(arg);
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38338         arg_conv.is_owned = false;
38339         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
38340         return ret_conv;
38341 }
38342
38343 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
38344         LDKChannelTypeFeatures orig_conv;
38345         orig_conv.inner = untag_ptr(orig);
38346         orig_conv.is_owned = ptr_is_owned(orig);
38347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38348         orig_conv.is_owned = false;
38349         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
38350         uint64_t ret_ref = 0;
38351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38353         return ret_ref;
38354 }
38355
38356 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
38357         LDKInitFeatures this_obj_conv;
38358         this_obj_conv.inner = untag_ptr(this_obj);
38359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38361         InitFeatures_free(this_obj_conv);
38362 }
38363
38364 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
38365         LDKNodeFeatures this_obj_conv;
38366         this_obj_conv.inner = untag_ptr(this_obj);
38367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38369         NodeFeatures_free(this_obj_conv);
38370 }
38371
38372 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
38373         LDKChannelFeatures this_obj_conv;
38374         this_obj_conv.inner = untag_ptr(this_obj);
38375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38377         ChannelFeatures_free(this_obj_conv);
38378 }
38379
38380 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
38381         LDKInvoiceFeatures this_obj_conv;
38382         this_obj_conv.inner = untag_ptr(this_obj);
38383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38385         InvoiceFeatures_free(this_obj_conv);
38386 }
38387
38388 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
38389         LDKChannelTypeFeatures this_obj_conv;
38390         this_obj_conv.inner = untag_ptr(this_obj);
38391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38393         ChannelTypeFeatures_free(this_obj_conv);
38394 }
38395
38396 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
38397         LDKInitFeatures ret_var = InitFeatures_empty();
38398         uint64_t ret_ref = 0;
38399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38401         return ret_ref;
38402 }
38403
38404 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
38405         LDKInitFeatures this_arg_conv;
38406         this_arg_conv.inner = untag_ptr(this_arg);
38407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38409         this_arg_conv.is_owned = false;
38410         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
38411         return ret_conv;
38412 }
38413
38414 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
38415         LDKNodeFeatures ret_var = NodeFeatures_empty();
38416         uint64_t ret_ref = 0;
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38419         return ret_ref;
38420 }
38421
38422 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
38423         LDKNodeFeatures this_arg_conv;
38424         this_arg_conv.inner = untag_ptr(this_arg);
38425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38427         this_arg_conv.is_owned = false;
38428         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
38429         return ret_conv;
38430 }
38431
38432 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
38433         LDKChannelFeatures ret_var = ChannelFeatures_empty();
38434         uint64_t ret_ref = 0;
38435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38437         return ret_ref;
38438 }
38439
38440 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
38441         LDKChannelFeatures this_arg_conv;
38442         this_arg_conv.inner = untag_ptr(this_arg);
38443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38445         this_arg_conv.is_owned = false;
38446         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
38447         return ret_conv;
38448 }
38449
38450 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
38451         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
38452         uint64_t ret_ref = 0;
38453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38455         return ret_ref;
38456 }
38457
38458 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
38459         LDKInvoiceFeatures this_arg_conv;
38460         this_arg_conv.inner = untag_ptr(this_arg);
38461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38463         this_arg_conv.is_owned = false;
38464         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
38465         return ret_conv;
38466 }
38467
38468 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
38469         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
38470         uint64_t ret_ref = 0;
38471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38473         return ret_ref;
38474 }
38475
38476 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
38477         LDKChannelTypeFeatures this_arg_conv;
38478         this_arg_conv.inner = untag_ptr(this_arg);
38479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38481         this_arg_conv.is_owned = false;
38482         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
38483         return ret_conv;
38484 }
38485
38486 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
38487         LDKInitFeatures obj_conv;
38488         obj_conv.inner = untag_ptr(obj);
38489         obj_conv.is_owned = ptr_is_owned(obj);
38490         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38491         obj_conv.is_owned = false;
38492         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
38493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38495         CVec_u8Z_free(ret_var);
38496         return ret_arr;
38497 }
38498
38499 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
38500         LDKu8slice ser_ref;
38501         ser_ref.datalen = ser->arr_len;
38502         ser_ref.data = ser->elems;
38503         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
38504         *ret_conv = InitFeatures_read(ser_ref);
38505         FREE(ser);
38506         return tag_ptr(ret_conv, true);
38507 }
38508
38509 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
38510         LDKChannelFeatures obj_conv;
38511         obj_conv.inner = untag_ptr(obj);
38512         obj_conv.is_owned = ptr_is_owned(obj);
38513         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38514         obj_conv.is_owned = false;
38515         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
38516         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38517         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38518         CVec_u8Z_free(ret_var);
38519         return ret_arr;
38520 }
38521
38522 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
38523         LDKu8slice ser_ref;
38524         ser_ref.datalen = ser->arr_len;
38525         ser_ref.data = ser->elems;
38526         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
38527         *ret_conv = ChannelFeatures_read(ser_ref);
38528         FREE(ser);
38529         return tag_ptr(ret_conv, true);
38530 }
38531
38532 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
38533         LDKNodeFeatures obj_conv;
38534         obj_conv.inner = untag_ptr(obj);
38535         obj_conv.is_owned = ptr_is_owned(obj);
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38537         obj_conv.is_owned = false;
38538         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
38539         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38540         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38541         CVec_u8Z_free(ret_var);
38542         return ret_arr;
38543 }
38544
38545 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
38546         LDKu8slice ser_ref;
38547         ser_ref.datalen = ser->arr_len;
38548         ser_ref.data = ser->elems;
38549         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
38550         *ret_conv = NodeFeatures_read(ser_ref);
38551         FREE(ser);
38552         return tag_ptr(ret_conv, true);
38553 }
38554
38555 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
38556         LDKInvoiceFeatures obj_conv;
38557         obj_conv.inner = untag_ptr(obj);
38558         obj_conv.is_owned = ptr_is_owned(obj);
38559         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38560         obj_conv.is_owned = false;
38561         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
38562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38564         CVec_u8Z_free(ret_var);
38565         return ret_arr;
38566 }
38567
38568 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
38569         LDKu8slice ser_ref;
38570         ser_ref.datalen = ser->arr_len;
38571         ser_ref.data = ser->elems;
38572         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
38573         *ret_conv = InvoiceFeatures_read(ser_ref);
38574         FREE(ser);
38575         return tag_ptr(ret_conv, true);
38576 }
38577
38578 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
38579         LDKChannelTypeFeatures obj_conv;
38580         obj_conv.inner = untag_ptr(obj);
38581         obj_conv.is_owned = ptr_is_owned(obj);
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38583         obj_conv.is_owned = false;
38584         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
38585         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38586         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38587         CVec_u8Z_free(ret_var);
38588         return ret_arr;
38589 }
38590
38591 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
38592         LDKu8slice ser_ref;
38593         ser_ref.datalen = ser->arr_len;
38594         ser_ref.data = ser->elems;
38595         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
38596         *ret_conv = ChannelTypeFeatures_read(ser_ref);
38597         FREE(ser);
38598         return tag_ptr(ret_conv, true);
38599 }
38600
38601 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
38602         LDKInitFeatures this_arg_conv;
38603         this_arg_conv.inner = untag_ptr(this_arg);
38604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38606         this_arg_conv.is_owned = false;
38607         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
38608 }
38609
38610 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
38611         LDKInitFeatures this_arg_conv;
38612         this_arg_conv.inner = untag_ptr(this_arg);
38613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38615         this_arg_conv.is_owned = false;
38616         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
38617 }
38618
38619 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
38620         LDKInitFeatures this_arg_conv;
38621         this_arg_conv.inner = untag_ptr(this_arg);
38622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38624         this_arg_conv.is_owned = false;
38625         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
38626         return ret_conv;
38627 }
38628
38629 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
38630         LDKNodeFeatures this_arg_conv;
38631         this_arg_conv.inner = untag_ptr(this_arg);
38632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38634         this_arg_conv.is_owned = false;
38635         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
38636 }
38637
38638 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
38639         LDKNodeFeatures this_arg_conv;
38640         this_arg_conv.inner = untag_ptr(this_arg);
38641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38643         this_arg_conv.is_owned = false;
38644         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
38645 }
38646
38647 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
38648         LDKNodeFeatures this_arg_conv;
38649         this_arg_conv.inner = untag_ptr(this_arg);
38650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38652         this_arg_conv.is_owned = false;
38653         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
38654         return ret_conv;
38655 }
38656
38657 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
38658         LDKInitFeatures this_arg_conv;
38659         this_arg_conv.inner = untag_ptr(this_arg);
38660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38662         this_arg_conv.is_owned = false;
38663         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
38664         return ret_conv;
38665 }
38666
38667 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
38668         LDKNodeFeatures this_arg_conv;
38669         this_arg_conv.inner = untag_ptr(this_arg);
38670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38672         this_arg_conv.is_owned = false;
38673         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
38674         return ret_conv;
38675 }
38676
38677 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
38678         LDKInitFeatures this_arg_conv;
38679         this_arg_conv.inner = untag_ptr(this_arg);
38680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38682         this_arg_conv.is_owned = false;
38683         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
38684 }
38685
38686 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
38687         LDKInitFeatures this_arg_conv;
38688         this_arg_conv.inner = untag_ptr(this_arg);
38689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38691         this_arg_conv.is_owned = false;
38692         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
38693 }
38694
38695 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
38696         LDKInitFeatures this_arg_conv;
38697         this_arg_conv.inner = untag_ptr(this_arg);
38698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38700         this_arg_conv.is_owned = false;
38701         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
38702         return ret_conv;
38703 }
38704
38705 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
38706         LDKInitFeatures this_arg_conv;
38707         this_arg_conv.inner = untag_ptr(this_arg);
38708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38710         this_arg_conv.is_owned = false;
38711         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
38712 }
38713
38714 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
38715         LDKInitFeatures this_arg_conv;
38716         this_arg_conv.inner = untag_ptr(this_arg);
38717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38719         this_arg_conv.is_owned = false;
38720         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
38721 }
38722
38723 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
38724         LDKInitFeatures this_arg_conv;
38725         this_arg_conv.inner = untag_ptr(this_arg);
38726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38728         this_arg_conv.is_owned = false;
38729         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
38730         return ret_conv;
38731 }
38732
38733 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
38734         LDKNodeFeatures this_arg_conv;
38735         this_arg_conv.inner = untag_ptr(this_arg);
38736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38738         this_arg_conv.is_owned = false;
38739         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
38740 }
38741
38742 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
38743         LDKNodeFeatures this_arg_conv;
38744         this_arg_conv.inner = untag_ptr(this_arg);
38745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38747         this_arg_conv.is_owned = false;
38748         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
38749 }
38750
38751 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
38752         LDKNodeFeatures this_arg_conv;
38753         this_arg_conv.inner = untag_ptr(this_arg);
38754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38756         this_arg_conv.is_owned = false;
38757         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
38758         return ret_conv;
38759 }
38760
38761 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
38762         LDKInitFeatures this_arg_conv;
38763         this_arg_conv.inner = untag_ptr(this_arg);
38764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38766         this_arg_conv.is_owned = false;
38767         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
38768         return ret_conv;
38769 }
38770
38771 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
38772         LDKNodeFeatures this_arg_conv;
38773         this_arg_conv.inner = untag_ptr(this_arg);
38774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38776         this_arg_conv.is_owned = false;
38777         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
38778         return ret_conv;
38779 }
38780
38781 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
38782         LDKInitFeatures this_arg_conv;
38783         this_arg_conv.inner = untag_ptr(this_arg);
38784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38786         this_arg_conv.is_owned = false;
38787         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
38788 }
38789
38790 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
38791         LDKInitFeatures this_arg_conv;
38792         this_arg_conv.inner = untag_ptr(this_arg);
38793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38795         this_arg_conv.is_owned = false;
38796         InitFeatures_set_gossip_queries_required(&this_arg_conv);
38797 }
38798
38799 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
38800         LDKInitFeatures this_arg_conv;
38801         this_arg_conv.inner = untag_ptr(this_arg);
38802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38804         this_arg_conv.is_owned = false;
38805         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
38806         return ret_conv;
38807 }
38808
38809 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
38810         LDKNodeFeatures this_arg_conv;
38811         this_arg_conv.inner = untag_ptr(this_arg);
38812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38814         this_arg_conv.is_owned = false;
38815         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
38816 }
38817
38818 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
38819         LDKNodeFeatures this_arg_conv;
38820         this_arg_conv.inner = untag_ptr(this_arg);
38821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38823         this_arg_conv.is_owned = false;
38824         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
38825 }
38826
38827 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
38828         LDKNodeFeatures this_arg_conv;
38829         this_arg_conv.inner = untag_ptr(this_arg);
38830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38832         this_arg_conv.is_owned = false;
38833         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
38834         return ret_conv;
38835 }
38836
38837 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
38838         LDKInitFeatures this_arg_conv;
38839         this_arg_conv.inner = untag_ptr(this_arg);
38840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38842         this_arg_conv.is_owned = false;
38843         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
38844         return ret_conv;
38845 }
38846
38847 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
38848         LDKNodeFeatures this_arg_conv;
38849         this_arg_conv.inner = untag_ptr(this_arg);
38850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38852         this_arg_conv.is_owned = false;
38853         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
38854         return ret_conv;
38855 }
38856
38857 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38858         LDKInitFeatures this_arg_conv;
38859         this_arg_conv.inner = untag_ptr(this_arg);
38860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38862         this_arg_conv.is_owned = false;
38863         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
38864 }
38865
38866 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38867         LDKInitFeatures this_arg_conv;
38868         this_arg_conv.inner = untag_ptr(this_arg);
38869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38871         this_arg_conv.is_owned = false;
38872         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
38873 }
38874
38875 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
38876         LDKInitFeatures this_arg_conv;
38877         this_arg_conv.inner = untag_ptr(this_arg);
38878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38880         this_arg_conv.is_owned = false;
38881         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
38882         return ret_conv;
38883 }
38884
38885 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38886         LDKNodeFeatures this_arg_conv;
38887         this_arg_conv.inner = untag_ptr(this_arg);
38888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38890         this_arg_conv.is_owned = false;
38891         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
38892 }
38893
38894 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38895         LDKNodeFeatures this_arg_conv;
38896         this_arg_conv.inner = untag_ptr(this_arg);
38897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38899         this_arg_conv.is_owned = false;
38900         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
38901 }
38902
38903 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
38904         LDKNodeFeatures this_arg_conv;
38905         this_arg_conv.inner = untag_ptr(this_arg);
38906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38908         this_arg_conv.is_owned = false;
38909         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
38910         return ret_conv;
38911 }
38912
38913 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38914         LDKInvoiceFeatures this_arg_conv;
38915         this_arg_conv.inner = untag_ptr(this_arg);
38916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38918         this_arg_conv.is_owned = false;
38919         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
38920 }
38921
38922 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38923         LDKInvoiceFeatures this_arg_conv;
38924         this_arg_conv.inner = untag_ptr(this_arg);
38925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38927         this_arg_conv.is_owned = false;
38928         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
38929 }
38930
38931 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
38932         LDKInvoiceFeatures this_arg_conv;
38933         this_arg_conv.inner = untag_ptr(this_arg);
38934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38936         this_arg_conv.is_owned = false;
38937         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
38938         return ret_conv;
38939 }
38940
38941 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
38942         LDKInitFeatures this_arg_conv;
38943         this_arg_conv.inner = untag_ptr(this_arg);
38944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38946         this_arg_conv.is_owned = false;
38947         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
38948         return ret_conv;
38949 }
38950
38951 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
38952         LDKNodeFeatures this_arg_conv;
38953         this_arg_conv.inner = untag_ptr(this_arg);
38954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38956         this_arg_conv.is_owned = false;
38957         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
38958         return ret_conv;
38959 }
38960
38961 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
38962         LDKInvoiceFeatures this_arg_conv;
38963         this_arg_conv.inner = untag_ptr(this_arg);
38964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38966         this_arg_conv.is_owned = false;
38967         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
38968         return ret_conv;
38969 }
38970
38971 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38972         LDKInitFeatures this_arg_conv;
38973         this_arg_conv.inner = untag_ptr(this_arg);
38974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38976         this_arg_conv.is_owned = false;
38977         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
38978 }
38979
38980 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
38981         LDKInitFeatures this_arg_conv;
38982         this_arg_conv.inner = untag_ptr(this_arg);
38983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38985         this_arg_conv.is_owned = false;
38986         InitFeatures_set_static_remote_key_required(&this_arg_conv);
38987 }
38988
38989 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
38990         LDKInitFeatures this_arg_conv;
38991         this_arg_conv.inner = untag_ptr(this_arg);
38992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38994         this_arg_conv.is_owned = false;
38995         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
38996         return ret_conv;
38997 }
38998
38999 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
39000         LDKNodeFeatures this_arg_conv;
39001         this_arg_conv.inner = untag_ptr(this_arg);
39002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39004         this_arg_conv.is_owned = false;
39005         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
39006 }
39007
39008 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
39009         LDKNodeFeatures this_arg_conv;
39010         this_arg_conv.inner = untag_ptr(this_arg);
39011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39013         this_arg_conv.is_owned = false;
39014         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
39015 }
39016
39017 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
39018         LDKNodeFeatures this_arg_conv;
39019         this_arg_conv.inner = untag_ptr(this_arg);
39020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39022         this_arg_conv.is_owned = false;
39023         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
39024         return ret_conv;
39025 }
39026
39027 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
39028         LDKChannelTypeFeatures this_arg_conv;
39029         this_arg_conv.inner = untag_ptr(this_arg);
39030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39032         this_arg_conv.is_owned = false;
39033         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
39034 }
39035
39036 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
39037         LDKChannelTypeFeatures this_arg_conv;
39038         this_arg_conv.inner = untag_ptr(this_arg);
39039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39041         this_arg_conv.is_owned = false;
39042         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
39043 }
39044
39045 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
39046         LDKChannelTypeFeatures this_arg_conv;
39047         this_arg_conv.inner = untag_ptr(this_arg);
39048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39050         this_arg_conv.is_owned = false;
39051         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
39052         return ret_conv;
39053 }
39054
39055 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
39056         LDKInitFeatures this_arg_conv;
39057         this_arg_conv.inner = untag_ptr(this_arg);
39058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39060         this_arg_conv.is_owned = false;
39061         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
39062         return ret_conv;
39063 }
39064
39065 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
39066         LDKNodeFeatures this_arg_conv;
39067         this_arg_conv.inner = untag_ptr(this_arg);
39068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39070         this_arg_conv.is_owned = false;
39071         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
39072         return ret_conv;
39073 }
39074
39075 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
39076         LDKChannelTypeFeatures this_arg_conv;
39077         this_arg_conv.inner = untag_ptr(this_arg);
39078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39080         this_arg_conv.is_owned = false;
39081         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
39082         return ret_conv;
39083 }
39084
39085 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
39086         LDKInitFeatures this_arg_conv;
39087         this_arg_conv.inner = untag_ptr(this_arg);
39088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39090         this_arg_conv.is_owned = false;
39091         InitFeatures_set_payment_secret_optional(&this_arg_conv);
39092 }
39093
39094 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
39095         LDKInitFeatures this_arg_conv;
39096         this_arg_conv.inner = untag_ptr(this_arg);
39097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39099         this_arg_conv.is_owned = false;
39100         InitFeatures_set_payment_secret_required(&this_arg_conv);
39101 }
39102
39103 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
39104         LDKInitFeatures this_arg_conv;
39105         this_arg_conv.inner = untag_ptr(this_arg);
39106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39108         this_arg_conv.is_owned = false;
39109         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
39110         return ret_conv;
39111 }
39112
39113 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
39114         LDKNodeFeatures this_arg_conv;
39115         this_arg_conv.inner = untag_ptr(this_arg);
39116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39118         this_arg_conv.is_owned = false;
39119         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
39120 }
39121
39122 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
39123         LDKNodeFeatures this_arg_conv;
39124         this_arg_conv.inner = untag_ptr(this_arg);
39125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39127         this_arg_conv.is_owned = false;
39128         NodeFeatures_set_payment_secret_required(&this_arg_conv);
39129 }
39130
39131 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
39132         LDKNodeFeatures this_arg_conv;
39133         this_arg_conv.inner = untag_ptr(this_arg);
39134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39136         this_arg_conv.is_owned = false;
39137         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
39138         return ret_conv;
39139 }
39140
39141 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
39142         LDKInvoiceFeatures this_arg_conv;
39143         this_arg_conv.inner = untag_ptr(this_arg);
39144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39146         this_arg_conv.is_owned = false;
39147         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
39148 }
39149
39150 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
39151         LDKInvoiceFeatures this_arg_conv;
39152         this_arg_conv.inner = untag_ptr(this_arg);
39153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39155         this_arg_conv.is_owned = false;
39156         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
39157 }
39158
39159 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
39160         LDKInvoiceFeatures this_arg_conv;
39161         this_arg_conv.inner = untag_ptr(this_arg);
39162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39164         this_arg_conv.is_owned = false;
39165         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
39166         return ret_conv;
39167 }
39168
39169 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
39170         LDKInitFeatures this_arg_conv;
39171         this_arg_conv.inner = untag_ptr(this_arg);
39172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39174         this_arg_conv.is_owned = false;
39175         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
39176         return ret_conv;
39177 }
39178
39179 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
39180         LDKNodeFeatures this_arg_conv;
39181         this_arg_conv.inner = untag_ptr(this_arg);
39182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39184         this_arg_conv.is_owned = false;
39185         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
39186         return ret_conv;
39187 }
39188
39189 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
39190         LDKInvoiceFeatures this_arg_conv;
39191         this_arg_conv.inner = untag_ptr(this_arg);
39192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39194         this_arg_conv.is_owned = false;
39195         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
39196         return ret_conv;
39197 }
39198
39199 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39200         LDKInitFeatures this_arg_conv;
39201         this_arg_conv.inner = untag_ptr(this_arg);
39202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39204         this_arg_conv.is_owned = false;
39205         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
39206 }
39207
39208 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
39209         LDKInitFeatures this_arg_conv;
39210         this_arg_conv.inner = untag_ptr(this_arg);
39211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39213         this_arg_conv.is_owned = false;
39214         InitFeatures_set_basic_mpp_required(&this_arg_conv);
39215 }
39216
39217 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
39218         LDKInitFeatures this_arg_conv;
39219         this_arg_conv.inner = untag_ptr(this_arg);
39220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39222         this_arg_conv.is_owned = false;
39223         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
39224         return ret_conv;
39225 }
39226
39227 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39228         LDKNodeFeatures this_arg_conv;
39229         this_arg_conv.inner = untag_ptr(this_arg);
39230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39232         this_arg_conv.is_owned = false;
39233         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
39234 }
39235
39236 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
39237         LDKNodeFeatures this_arg_conv;
39238         this_arg_conv.inner = untag_ptr(this_arg);
39239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39241         this_arg_conv.is_owned = false;
39242         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
39243 }
39244
39245 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
39246         LDKNodeFeatures this_arg_conv;
39247         this_arg_conv.inner = untag_ptr(this_arg);
39248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39250         this_arg_conv.is_owned = false;
39251         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
39252         return ret_conv;
39253 }
39254
39255 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
39256         LDKInvoiceFeatures this_arg_conv;
39257         this_arg_conv.inner = untag_ptr(this_arg);
39258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39260         this_arg_conv.is_owned = false;
39261         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
39262 }
39263
39264 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
39265         LDKInvoiceFeatures this_arg_conv;
39266         this_arg_conv.inner = untag_ptr(this_arg);
39267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39269         this_arg_conv.is_owned = false;
39270         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
39271 }
39272
39273 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
39274         LDKInvoiceFeatures this_arg_conv;
39275         this_arg_conv.inner = untag_ptr(this_arg);
39276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39278         this_arg_conv.is_owned = false;
39279         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
39280         return ret_conv;
39281 }
39282
39283 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
39284         LDKInitFeatures this_arg_conv;
39285         this_arg_conv.inner = untag_ptr(this_arg);
39286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39288         this_arg_conv.is_owned = false;
39289         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
39290         return ret_conv;
39291 }
39292
39293 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
39294         LDKNodeFeatures this_arg_conv;
39295         this_arg_conv.inner = untag_ptr(this_arg);
39296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39298         this_arg_conv.is_owned = false;
39299         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
39300         return ret_conv;
39301 }
39302
39303 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
39304         LDKInvoiceFeatures this_arg_conv;
39305         this_arg_conv.inner = untag_ptr(this_arg);
39306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39308         this_arg_conv.is_owned = false;
39309         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
39310         return ret_conv;
39311 }
39312
39313 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
39314         LDKInitFeatures this_arg_conv;
39315         this_arg_conv.inner = untag_ptr(this_arg);
39316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39318         this_arg_conv.is_owned = false;
39319         InitFeatures_set_wumbo_optional(&this_arg_conv);
39320 }
39321
39322 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
39323         LDKInitFeatures this_arg_conv;
39324         this_arg_conv.inner = untag_ptr(this_arg);
39325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39327         this_arg_conv.is_owned = false;
39328         InitFeatures_set_wumbo_required(&this_arg_conv);
39329 }
39330
39331 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
39332         LDKInitFeatures this_arg_conv;
39333         this_arg_conv.inner = untag_ptr(this_arg);
39334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39336         this_arg_conv.is_owned = false;
39337         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
39338         return ret_conv;
39339 }
39340
39341 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
39342         LDKNodeFeatures this_arg_conv;
39343         this_arg_conv.inner = untag_ptr(this_arg);
39344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39346         this_arg_conv.is_owned = false;
39347         NodeFeatures_set_wumbo_optional(&this_arg_conv);
39348 }
39349
39350 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
39351         LDKNodeFeatures this_arg_conv;
39352         this_arg_conv.inner = untag_ptr(this_arg);
39353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39355         this_arg_conv.is_owned = false;
39356         NodeFeatures_set_wumbo_required(&this_arg_conv);
39357 }
39358
39359 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
39360         LDKNodeFeatures this_arg_conv;
39361         this_arg_conv.inner = untag_ptr(this_arg);
39362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39364         this_arg_conv.is_owned = false;
39365         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
39366         return ret_conv;
39367 }
39368
39369 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
39370         LDKInitFeatures this_arg_conv;
39371         this_arg_conv.inner = untag_ptr(this_arg);
39372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39374         this_arg_conv.is_owned = false;
39375         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
39376         return ret_conv;
39377 }
39378
39379 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
39380         LDKNodeFeatures this_arg_conv;
39381         this_arg_conv.inner = untag_ptr(this_arg);
39382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39384         this_arg_conv.is_owned = false;
39385         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
39386         return ret_conv;
39387 }
39388
39389 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
39390         LDKInitFeatures this_arg_conv;
39391         this_arg_conv.inner = untag_ptr(this_arg);
39392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39394         this_arg_conv.is_owned = false;
39395         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
39396 }
39397
39398 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
39399         LDKInitFeatures this_arg_conv;
39400         this_arg_conv.inner = untag_ptr(this_arg);
39401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39403         this_arg_conv.is_owned = false;
39404         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
39405 }
39406
39407 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
39408         LDKInitFeatures this_arg_conv;
39409         this_arg_conv.inner = untag_ptr(this_arg);
39410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39412         this_arg_conv.is_owned = false;
39413         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
39414         return ret_conv;
39415 }
39416
39417 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
39418         LDKNodeFeatures this_arg_conv;
39419         this_arg_conv.inner = untag_ptr(this_arg);
39420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39422         this_arg_conv.is_owned = false;
39423         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
39424 }
39425
39426 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
39427         LDKNodeFeatures this_arg_conv;
39428         this_arg_conv.inner = untag_ptr(this_arg);
39429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39431         this_arg_conv.is_owned = false;
39432         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
39433 }
39434
39435 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
39436         LDKNodeFeatures this_arg_conv;
39437         this_arg_conv.inner = untag_ptr(this_arg);
39438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39440         this_arg_conv.is_owned = false;
39441         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
39442         return ret_conv;
39443 }
39444
39445 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
39446         LDKInitFeatures this_arg_conv;
39447         this_arg_conv.inner = untag_ptr(this_arg);
39448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39450         this_arg_conv.is_owned = false;
39451         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
39452         return ret_conv;
39453 }
39454
39455 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
39456         LDKNodeFeatures this_arg_conv;
39457         this_arg_conv.inner = untag_ptr(this_arg);
39458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39460         this_arg_conv.is_owned = false;
39461         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
39462         return ret_conv;
39463 }
39464
39465 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
39466         LDKInitFeatures this_arg_conv;
39467         this_arg_conv.inner = untag_ptr(this_arg);
39468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39470         this_arg_conv.is_owned = false;
39471         InitFeatures_set_onion_messages_optional(&this_arg_conv);
39472 }
39473
39474 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
39475         LDKInitFeatures this_arg_conv;
39476         this_arg_conv.inner = untag_ptr(this_arg);
39477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39479         this_arg_conv.is_owned = false;
39480         InitFeatures_set_onion_messages_required(&this_arg_conv);
39481 }
39482
39483 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
39484         LDKInitFeatures this_arg_conv;
39485         this_arg_conv.inner = untag_ptr(this_arg);
39486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39488         this_arg_conv.is_owned = false;
39489         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
39490         return ret_conv;
39491 }
39492
39493 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
39494         LDKNodeFeatures this_arg_conv;
39495         this_arg_conv.inner = untag_ptr(this_arg);
39496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39498         this_arg_conv.is_owned = false;
39499         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
39500 }
39501
39502 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
39503         LDKNodeFeatures this_arg_conv;
39504         this_arg_conv.inner = untag_ptr(this_arg);
39505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39507         this_arg_conv.is_owned = false;
39508         NodeFeatures_set_onion_messages_required(&this_arg_conv);
39509 }
39510
39511 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
39512         LDKNodeFeatures this_arg_conv;
39513         this_arg_conv.inner = untag_ptr(this_arg);
39514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39516         this_arg_conv.is_owned = false;
39517         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
39518         return ret_conv;
39519 }
39520
39521 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
39522         LDKInitFeatures this_arg_conv;
39523         this_arg_conv.inner = untag_ptr(this_arg);
39524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39526         this_arg_conv.is_owned = false;
39527         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
39528         return ret_conv;
39529 }
39530
39531 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
39532         LDKNodeFeatures this_arg_conv;
39533         this_arg_conv.inner = untag_ptr(this_arg);
39534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39536         this_arg_conv.is_owned = false;
39537         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
39538         return ret_conv;
39539 }
39540
39541 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
39542         LDKInitFeatures this_arg_conv;
39543         this_arg_conv.inner = untag_ptr(this_arg);
39544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39546         this_arg_conv.is_owned = false;
39547         InitFeatures_set_channel_type_optional(&this_arg_conv);
39548 }
39549
39550 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
39551         LDKInitFeatures this_arg_conv;
39552         this_arg_conv.inner = untag_ptr(this_arg);
39553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39555         this_arg_conv.is_owned = false;
39556         InitFeatures_set_channel_type_required(&this_arg_conv);
39557 }
39558
39559 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
39560         LDKInitFeatures this_arg_conv;
39561         this_arg_conv.inner = untag_ptr(this_arg);
39562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39564         this_arg_conv.is_owned = false;
39565         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
39566         return ret_conv;
39567 }
39568
39569 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
39570         LDKNodeFeatures this_arg_conv;
39571         this_arg_conv.inner = untag_ptr(this_arg);
39572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39574         this_arg_conv.is_owned = false;
39575         NodeFeatures_set_channel_type_optional(&this_arg_conv);
39576 }
39577
39578 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
39579         LDKNodeFeatures this_arg_conv;
39580         this_arg_conv.inner = untag_ptr(this_arg);
39581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39583         this_arg_conv.is_owned = false;
39584         NodeFeatures_set_channel_type_required(&this_arg_conv);
39585 }
39586
39587 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
39588         LDKNodeFeatures this_arg_conv;
39589         this_arg_conv.inner = untag_ptr(this_arg);
39590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39592         this_arg_conv.is_owned = false;
39593         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
39594         return ret_conv;
39595 }
39596
39597 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
39598         LDKInitFeatures this_arg_conv;
39599         this_arg_conv.inner = untag_ptr(this_arg);
39600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39602         this_arg_conv.is_owned = false;
39603         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
39604         return ret_conv;
39605 }
39606
39607 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
39608         LDKNodeFeatures this_arg_conv;
39609         this_arg_conv.inner = untag_ptr(this_arg);
39610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39612         this_arg_conv.is_owned = false;
39613         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
39614         return ret_conv;
39615 }
39616
39617 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39618         LDKInitFeatures this_arg_conv;
39619         this_arg_conv.inner = untag_ptr(this_arg);
39620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39622         this_arg_conv.is_owned = false;
39623         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
39624 }
39625
39626 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
39627         LDKInitFeatures this_arg_conv;
39628         this_arg_conv.inner = untag_ptr(this_arg);
39629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39631         this_arg_conv.is_owned = false;
39632         InitFeatures_set_scid_privacy_required(&this_arg_conv);
39633 }
39634
39635 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
39636         LDKInitFeatures this_arg_conv;
39637         this_arg_conv.inner = untag_ptr(this_arg);
39638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39640         this_arg_conv.is_owned = false;
39641         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
39642         return ret_conv;
39643 }
39644
39645 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39646         LDKNodeFeatures this_arg_conv;
39647         this_arg_conv.inner = untag_ptr(this_arg);
39648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39650         this_arg_conv.is_owned = false;
39651         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
39652 }
39653
39654 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
39655         LDKNodeFeatures this_arg_conv;
39656         this_arg_conv.inner = untag_ptr(this_arg);
39657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39659         this_arg_conv.is_owned = false;
39660         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
39661 }
39662
39663 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
39664         LDKNodeFeatures this_arg_conv;
39665         this_arg_conv.inner = untag_ptr(this_arg);
39666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39668         this_arg_conv.is_owned = false;
39669         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
39670         return ret_conv;
39671 }
39672
39673 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
39674         LDKChannelTypeFeatures this_arg_conv;
39675         this_arg_conv.inner = untag_ptr(this_arg);
39676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39678         this_arg_conv.is_owned = false;
39679         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
39680 }
39681
39682 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
39683         LDKChannelTypeFeatures this_arg_conv;
39684         this_arg_conv.inner = untag_ptr(this_arg);
39685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39687         this_arg_conv.is_owned = false;
39688         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
39689 }
39690
39691 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
39692         LDKChannelTypeFeatures this_arg_conv;
39693         this_arg_conv.inner = untag_ptr(this_arg);
39694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39696         this_arg_conv.is_owned = false;
39697         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
39698         return ret_conv;
39699 }
39700
39701 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
39702         LDKInitFeatures this_arg_conv;
39703         this_arg_conv.inner = untag_ptr(this_arg);
39704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39706         this_arg_conv.is_owned = false;
39707         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
39708         return ret_conv;
39709 }
39710
39711 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
39712         LDKNodeFeatures this_arg_conv;
39713         this_arg_conv.inner = untag_ptr(this_arg);
39714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39716         this_arg_conv.is_owned = false;
39717         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
39718         return ret_conv;
39719 }
39720
39721 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
39722         LDKChannelTypeFeatures this_arg_conv;
39723         this_arg_conv.inner = untag_ptr(this_arg);
39724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39726         this_arg_conv.is_owned = false;
39727         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
39728         return ret_conv;
39729 }
39730
39731 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
39732         LDKInitFeatures this_arg_conv;
39733         this_arg_conv.inner = untag_ptr(this_arg);
39734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39736         this_arg_conv.is_owned = false;
39737         InitFeatures_set_zero_conf_optional(&this_arg_conv);
39738 }
39739
39740 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
39741         LDKInitFeatures this_arg_conv;
39742         this_arg_conv.inner = untag_ptr(this_arg);
39743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39745         this_arg_conv.is_owned = false;
39746         InitFeatures_set_zero_conf_required(&this_arg_conv);
39747 }
39748
39749 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
39750         LDKInitFeatures this_arg_conv;
39751         this_arg_conv.inner = untag_ptr(this_arg);
39752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39754         this_arg_conv.is_owned = false;
39755         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
39756         return ret_conv;
39757 }
39758
39759 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
39760         LDKNodeFeatures this_arg_conv;
39761         this_arg_conv.inner = untag_ptr(this_arg);
39762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39764         this_arg_conv.is_owned = false;
39765         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
39766 }
39767
39768 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
39769         LDKNodeFeatures this_arg_conv;
39770         this_arg_conv.inner = untag_ptr(this_arg);
39771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39773         this_arg_conv.is_owned = false;
39774         NodeFeatures_set_zero_conf_required(&this_arg_conv);
39775 }
39776
39777 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
39778         LDKNodeFeatures this_arg_conv;
39779         this_arg_conv.inner = untag_ptr(this_arg);
39780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39782         this_arg_conv.is_owned = false;
39783         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
39784         return ret_conv;
39785 }
39786
39787 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
39788         LDKChannelTypeFeatures this_arg_conv;
39789         this_arg_conv.inner = untag_ptr(this_arg);
39790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39792         this_arg_conv.is_owned = false;
39793         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
39794 }
39795
39796 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
39797         LDKChannelTypeFeatures this_arg_conv;
39798         this_arg_conv.inner = untag_ptr(this_arg);
39799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39801         this_arg_conv.is_owned = false;
39802         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
39803 }
39804
39805 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
39806         LDKChannelTypeFeatures this_arg_conv;
39807         this_arg_conv.inner = untag_ptr(this_arg);
39808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39810         this_arg_conv.is_owned = false;
39811         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
39812         return ret_conv;
39813 }
39814
39815 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
39816         LDKInitFeatures this_arg_conv;
39817         this_arg_conv.inner = untag_ptr(this_arg);
39818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39820         this_arg_conv.is_owned = false;
39821         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
39822         return ret_conv;
39823 }
39824
39825 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
39826         LDKNodeFeatures this_arg_conv;
39827         this_arg_conv.inner = untag_ptr(this_arg);
39828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39830         this_arg_conv.is_owned = false;
39831         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
39832         return ret_conv;
39833 }
39834
39835 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
39836         LDKChannelTypeFeatures this_arg_conv;
39837         this_arg_conv.inner = untag_ptr(this_arg);
39838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39840         this_arg_conv.is_owned = false;
39841         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
39842         return ret_conv;
39843 }
39844
39845 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
39846         LDKNodeFeatures this_arg_conv;
39847         this_arg_conv.inner = untag_ptr(this_arg);
39848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39850         this_arg_conv.is_owned = false;
39851         NodeFeatures_set_keysend_optional(&this_arg_conv);
39852 }
39853
39854 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
39855         LDKNodeFeatures this_arg_conv;
39856         this_arg_conv.inner = untag_ptr(this_arg);
39857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39859         this_arg_conv.is_owned = false;
39860         NodeFeatures_set_keysend_required(&this_arg_conv);
39861 }
39862
39863 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
39864         LDKNodeFeatures this_arg_conv;
39865         this_arg_conv.inner = untag_ptr(this_arg);
39866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39868         this_arg_conv.is_owned = false;
39869         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
39870         return ret_conv;
39871 }
39872
39873 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
39874         LDKNodeFeatures this_arg_conv;
39875         this_arg_conv.inner = untag_ptr(this_arg);
39876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39878         this_arg_conv.is_owned = false;
39879         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
39880         return ret_conv;
39881 }
39882
39883 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
39884         LDKShutdownScript this_obj_conv;
39885         this_obj_conv.inner = untag_ptr(this_obj);
39886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39888         ShutdownScript_free(this_obj_conv);
39889 }
39890
39891 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39892         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39893         uint64_t ret_ref = 0;
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39896         return ret_ref;
39897 }
39898 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
39899         LDKShutdownScript arg_conv;
39900         arg_conv.inner = untag_ptr(arg);
39901         arg_conv.is_owned = ptr_is_owned(arg);
39902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39903         arg_conv.is_owned = false;
39904         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
39905         return ret_conv;
39906 }
39907
39908 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
39909         LDKShutdownScript orig_conv;
39910         orig_conv.inner = untag_ptr(orig);
39911         orig_conv.is_owned = ptr_is_owned(orig);
39912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39913         orig_conv.is_owned = false;
39914         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39915         uint64_t ret_ref = 0;
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39918         return ret_ref;
39919 }
39920
39921 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
39922         LDKShutdownScript a_conv;
39923         a_conv.inner = untag_ptr(a);
39924         a_conv.is_owned = ptr_is_owned(a);
39925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39926         a_conv.is_owned = false;
39927         LDKShutdownScript b_conv;
39928         b_conv.inner = untag_ptr(b);
39929         b_conv.is_owned = ptr_is_owned(b);
39930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39931         b_conv.is_owned = false;
39932         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
39933         return ret_conv;
39934 }
39935
39936 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
39937         LDKInvalidShutdownScript this_obj_conv;
39938         this_obj_conv.inner = untag_ptr(this_obj);
39939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39941         InvalidShutdownScript_free(this_obj_conv);
39942 }
39943
39944 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
39945         LDKInvalidShutdownScript this_ptr_conv;
39946         this_ptr_conv.inner = untag_ptr(this_ptr);
39947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39949         this_ptr_conv.is_owned = false;
39950         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39953         return ret_arr;
39954 }
39955
39956 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
39957         LDKInvalidShutdownScript this_ptr_conv;
39958         this_ptr_conv.inner = untag_ptr(this_ptr);
39959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39961         this_ptr_conv.is_owned = false;
39962         LDKCVec_u8Z val_ref;
39963         val_ref.datalen = val->arr_len;
39964         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39965         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39966         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39967 }
39968
39969 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
39970         LDKCVec_u8Z script_arg_ref;
39971         script_arg_ref.datalen = script_arg->arr_len;
39972         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39973         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39974         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
39975         uint64_t ret_ref = 0;
39976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39978         return ret_ref;
39979 }
39980
39981 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39982         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39983         uint64_t ret_ref = 0;
39984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39986         return ret_ref;
39987 }
39988 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
39989         LDKInvalidShutdownScript arg_conv;
39990         arg_conv.inner = untag_ptr(arg);
39991         arg_conv.is_owned = ptr_is_owned(arg);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39993         arg_conv.is_owned = false;
39994         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
39995         return ret_conv;
39996 }
39997
39998 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
39999         LDKInvalidShutdownScript orig_conv;
40000         orig_conv.inner = untag_ptr(orig);
40001         orig_conv.is_owned = ptr_is_owned(orig);
40002         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40003         orig_conv.is_owned = false;
40004         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
40005         uint64_t ret_ref = 0;
40006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40008         return ret_ref;
40009 }
40010
40011 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
40012         LDKShutdownScript obj_conv;
40013         obj_conv.inner = untag_ptr(obj);
40014         obj_conv.is_owned = ptr_is_owned(obj);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40016         obj_conv.is_owned = false;
40017         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
40018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40020         CVec_u8Z_free(ret_var);
40021         return ret_arr;
40022 }
40023
40024 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
40025         LDKu8slice ser_ref;
40026         ser_ref.datalen = ser->arr_len;
40027         ser_ref.data = ser->elems;
40028         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
40029         *ret_conv = ShutdownScript_read(ser_ref);
40030         FREE(ser);
40031         return tag_ptr(ret_conv, true);
40032 }
40033
40034 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
40035         unsigned char pubkey_hash_arr[20];
40036         CHECK(pubkey_hash->arr_len == 20);
40037         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
40038         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
40039         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
40040         uint64_t ret_ref = 0;
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40043         return ret_ref;
40044 }
40045
40046 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
40047         unsigned char script_hash_arr[32];
40048         CHECK(script_hash->arr_len == 32);
40049         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
40050         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
40051         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
40052         uint64_t ret_ref = 0;
40053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40055         return ret_ref;
40056 }
40057
40058 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
40059         
40060         LDKu8slice program_ref;
40061         program_ref.datalen = program->arr_len;
40062         program_ref.data = program->elems;
40063         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
40064         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
40065         FREE(program);
40066         return tag_ptr(ret_conv, true);
40067 }
40068
40069 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
40070         LDKShutdownScript this_arg_conv;
40071         this_arg_conv.inner = untag_ptr(this_arg);
40072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40074         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
40075         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
40076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40078         CVec_u8Z_free(ret_var);
40079         return ret_arr;
40080 }
40081
40082 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
40083         LDKShutdownScript this_arg_conv;
40084         this_arg_conv.inner = untag_ptr(this_arg);
40085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40087         this_arg_conv.is_owned = false;
40088         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40089         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
40090         return ret_arr;
40091 }
40092
40093 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
40094         LDKShutdownScript this_arg_conv;
40095         this_arg_conv.inner = untag_ptr(this_arg);
40096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40098         this_arg_conv.is_owned = false;
40099         LDKInitFeatures features_conv;
40100         features_conv.inner = untag_ptr(features);
40101         features_conv.is_owned = ptr_is_owned(features);
40102         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
40103         features_conv.is_owned = false;
40104         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
40105         return ret_conv;
40106 }
40107
40108 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
40109         if (!ptr_is_owned(this_ptr)) return;
40110         void* this_ptr_ptr = untag_ptr(this_ptr);
40111         CHECK_ACCESS(this_ptr_ptr);
40112         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
40113         FREE(untag_ptr(this_ptr));
40114         CustomMessageReader_free(this_ptr_conv);
40115 }
40116
40117 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
40118         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
40119         *ret_ret = Type_clone(arg);
40120         return tag_ptr(ret_ret, true);
40121 }
40122 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
40123         void* arg_ptr = untag_ptr(arg);
40124         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
40125         LDKType* arg_conv = (LDKType*)arg_ptr;
40126         int64_t ret_conv = Type_clone_ptr(arg_conv);
40127         return ret_conv;
40128 }
40129
40130 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
40131         void* orig_ptr = untag_ptr(orig);
40132         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
40133         LDKType* orig_conv = (LDKType*)orig_ptr;
40134         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
40135         *ret_ret = Type_clone(orig_conv);
40136         return tag_ptr(ret_ret, true);
40137 }
40138
40139 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
40140         if (!ptr_is_owned(this_ptr)) return;
40141         void* this_ptr_ptr = untag_ptr(this_ptr);
40142         CHECK_ACCESS(this_ptr_ptr);
40143         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
40144         FREE(untag_ptr(this_ptr));
40145         Type_free(this_ptr_conv);
40146 }
40147
40148 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
40149         LDKNodeId this_obj_conv;
40150         this_obj_conv.inner = untag_ptr(this_obj);
40151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40153         NodeId_free(this_obj_conv);
40154 }
40155
40156 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
40157         LDKNodeId ret_var = NodeId_clone(arg);
40158         uint64_t ret_ref = 0;
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40161         return ret_ref;
40162 }
40163 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
40164         LDKNodeId arg_conv;
40165         arg_conv.inner = untag_ptr(arg);
40166         arg_conv.is_owned = ptr_is_owned(arg);
40167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40168         arg_conv.is_owned = false;
40169         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
40170         return ret_conv;
40171 }
40172
40173 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
40174         LDKNodeId orig_conv;
40175         orig_conv.inner = untag_ptr(orig);
40176         orig_conv.is_owned = ptr_is_owned(orig);
40177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40178         orig_conv.is_owned = false;
40179         LDKNodeId ret_var = NodeId_clone(&orig_conv);
40180         uint64_t ret_ref = 0;
40181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40183         return ret_ref;
40184 }
40185
40186 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
40187         LDKPublicKey pubkey_ref;
40188         CHECK(pubkey->arr_len == 33);
40189         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
40190         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
40191         uint64_t ret_ref = 0;
40192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40194         return ret_ref;
40195 }
40196
40197 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
40198         LDKNodeId this_arg_conv;
40199         this_arg_conv.inner = untag_ptr(this_arg);
40200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40202         this_arg_conv.is_owned = false;
40203         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
40204         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40205         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40206         return ret_arr;
40207 }
40208
40209 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
40210         LDKNodeId o_conv;
40211         o_conv.inner = untag_ptr(o);
40212         o_conv.is_owned = ptr_is_owned(o);
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40214         o_conv.is_owned = false;
40215         int64_t ret_conv = NodeId_hash(&o_conv);
40216         return ret_conv;
40217 }
40218
40219 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
40220         LDKNodeId obj_conv;
40221         obj_conv.inner = untag_ptr(obj);
40222         obj_conv.is_owned = ptr_is_owned(obj);
40223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40224         obj_conv.is_owned = false;
40225         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
40226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40228         CVec_u8Z_free(ret_var);
40229         return ret_arr;
40230 }
40231
40232 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
40233         LDKu8slice ser_ref;
40234         ser_ref.datalen = ser->arr_len;
40235         ser_ref.data = ser->elems;
40236         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
40237         *ret_conv = NodeId_read(ser_ref);
40238         FREE(ser);
40239         return tag_ptr(ret_conv, true);
40240 }
40241
40242 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
40243         LDKNetworkGraph this_obj_conv;
40244         this_obj_conv.inner = untag_ptr(this_obj);
40245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40247         NetworkGraph_free(this_obj_conv);
40248 }
40249
40250 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
40251         LDKReadOnlyNetworkGraph this_obj_conv;
40252         this_obj_conv.inner = untag_ptr(this_obj);
40253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40255         ReadOnlyNetworkGraph_free(this_obj_conv);
40256 }
40257
40258 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
40259         if (!ptr_is_owned(this_ptr)) return;
40260         void* this_ptr_ptr = untag_ptr(this_ptr);
40261         CHECK_ACCESS(this_ptr_ptr);
40262         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
40263         FREE(untag_ptr(this_ptr));
40264         NetworkUpdate_free(this_ptr_conv);
40265 }
40266
40267 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
40268         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40269         *ret_copy = NetworkUpdate_clone(arg);
40270         uint64_t ret_ref = tag_ptr(ret_copy, true);
40271         return ret_ref;
40272 }
40273 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
40274         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
40275         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
40276         return ret_conv;
40277 }
40278
40279 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
40280         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
40281         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40282         *ret_copy = NetworkUpdate_clone(orig_conv);
40283         uint64_t ret_ref = tag_ptr(ret_copy, true);
40284         return ret_ref;
40285 }
40286
40287 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
40288         LDKChannelUpdate msg_conv;
40289         msg_conv.inner = untag_ptr(msg);
40290         msg_conv.is_owned = ptr_is_owned(msg);
40291         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40292         msg_conv = ChannelUpdate_clone(&msg_conv);
40293         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40294         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
40295         uint64_t ret_ref = tag_ptr(ret_copy, true);
40296         return ret_ref;
40297 }
40298
40299 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
40300         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40301         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
40302         uint64_t ret_ref = tag_ptr(ret_copy, true);
40303         return ret_ref;
40304 }
40305
40306 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
40307         LDKPublicKey node_id_ref;
40308         CHECK(node_id->arr_len == 33);
40309         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
40310         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
40311         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
40312         uint64_t ret_ref = tag_ptr(ret_copy, true);
40313         return ret_ref;
40314 }
40315
40316 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
40317         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
40318         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
40319         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
40320         return ret_conv;
40321 }
40322
40323 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
40324         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
40325         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
40326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40328         CVec_u8Z_free(ret_var);
40329         return ret_arr;
40330 }
40331
40332 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
40333         LDKu8slice ser_ref;
40334         ser_ref.datalen = ser->arr_len;
40335         ser_ref.data = ser->elems;
40336         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
40337         *ret_conv = NetworkUpdate_read(ser_ref);
40338         FREE(ser);
40339         return tag_ptr(ret_conv, true);
40340 }
40341
40342 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
40343         LDKP2PGossipSync this_obj_conv;
40344         this_obj_conv.inner = untag_ptr(this_obj);
40345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40347         P2PGossipSync_free(this_obj_conv);
40348 }
40349
40350 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
40351         LDKNetworkGraph network_graph_conv;
40352         network_graph_conv.inner = untag_ptr(network_graph);
40353         network_graph_conv.is_owned = ptr_is_owned(network_graph);
40354         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
40355         network_graph_conv.is_owned = false;
40356         void* chain_access_ptr = untag_ptr(chain_access);
40357         CHECK_ACCESS(chain_access_ptr);
40358         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40359         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40360         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40361                 // Manually implement clone for Java trait instances
40362                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40363                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40364                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
40365                 }
40366         }
40367         void* logger_ptr = untag_ptr(logger);
40368         CHECK_ACCESS(logger_ptr);
40369         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40370         if (logger_conv.free == LDKLogger_JCalls_free) {
40371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40372                 LDKLogger_JCalls_cloned(&logger_conv);
40373         }
40374         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
40375         uint64_t ret_ref = 0;
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40378         return ret_ref;
40379 }
40380
40381 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
40382         LDKP2PGossipSync this_arg_conv;
40383         this_arg_conv.inner = untag_ptr(this_arg);
40384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40386         this_arg_conv.is_owned = false;
40387         void* chain_access_ptr = untag_ptr(chain_access);
40388         CHECK_ACCESS(chain_access_ptr);
40389         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40390         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40391         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40392                 // Manually implement clone for Java trait instances
40393                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40394                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40395                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
40396                 }
40397         }
40398         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
40399 }
40400
40401 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
40402         LDKNetworkGraph this_arg_conv;
40403         this_arg_conv.inner = untag_ptr(this_arg);
40404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40406         this_arg_conv.is_owned = false;
40407         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
40408         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
40409         return tag_ptr(ret_ret, true);
40410 }
40411
40412 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
40413         LDKP2PGossipSync this_arg_conv;
40414         this_arg_conv.inner = untag_ptr(this_arg);
40415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40417         this_arg_conv.is_owned = false;
40418         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
40419         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
40420         return tag_ptr(ret_ret, true);
40421 }
40422
40423 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
40424         LDKP2PGossipSync this_arg_conv;
40425         this_arg_conv.inner = untag_ptr(this_arg);
40426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40428         this_arg_conv.is_owned = false;
40429         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
40430         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
40431         return tag_ptr(ret_ret, true);
40432 }
40433
40434 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
40435         LDKChannelUpdateInfo this_obj_conv;
40436         this_obj_conv.inner = untag_ptr(this_obj);
40437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40439         ChannelUpdateInfo_free(this_obj_conv);
40440 }
40441
40442 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
40443         LDKChannelUpdateInfo this_ptr_conv;
40444         this_ptr_conv.inner = untag_ptr(this_ptr);
40445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40447         this_ptr_conv.is_owned = false;
40448         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
40449         return ret_conv;
40450 }
40451
40452 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
40453         LDKChannelUpdateInfo this_ptr_conv;
40454         this_ptr_conv.inner = untag_ptr(this_ptr);
40455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40457         this_ptr_conv.is_owned = false;
40458         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
40459 }
40460
40461 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
40462         LDKChannelUpdateInfo this_ptr_conv;
40463         this_ptr_conv.inner = untag_ptr(this_ptr);
40464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40466         this_ptr_conv.is_owned = false;
40467         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
40468         return ret_conv;
40469 }
40470
40471 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
40472         LDKChannelUpdateInfo this_ptr_conv;
40473         this_ptr_conv.inner = untag_ptr(this_ptr);
40474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40476         this_ptr_conv.is_owned = false;
40477         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
40478 }
40479
40480 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
40481         LDKChannelUpdateInfo this_ptr_conv;
40482         this_ptr_conv.inner = untag_ptr(this_ptr);
40483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40485         this_ptr_conv.is_owned = false;
40486         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
40487         return ret_conv;
40488 }
40489
40490 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
40491         LDKChannelUpdateInfo this_ptr_conv;
40492         this_ptr_conv.inner = untag_ptr(this_ptr);
40493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40495         this_ptr_conv.is_owned = false;
40496         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
40497 }
40498
40499 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
40500         LDKChannelUpdateInfo this_ptr_conv;
40501         this_ptr_conv.inner = untag_ptr(this_ptr);
40502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40504         this_ptr_conv.is_owned = false;
40505         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
40506         return ret_conv;
40507 }
40508
40509 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
40510         LDKChannelUpdateInfo this_ptr_conv;
40511         this_ptr_conv.inner = untag_ptr(this_ptr);
40512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40514         this_ptr_conv.is_owned = false;
40515         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
40516 }
40517
40518 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
40519         LDKChannelUpdateInfo this_ptr_conv;
40520         this_ptr_conv.inner = untag_ptr(this_ptr);
40521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40523         this_ptr_conv.is_owned = false;
40524         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
40525         return ret_conv;
40526 }
40527
40528 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
40529         LDKChannelUpdateInfo this_ptr_conv;
40530         this_ptr_conv.inner = untag_ptr(this_ptr);
40531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40533         this_ptr_conv.is_owned = false;
40534         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
40535 }
40536
40537 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
40538         LDKChannelUpdateInfo this_ptr_conv;
40539         this_ptr_conv.inner = untag_ptr(this_ptr);
40540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40542         this_ptr_conv.is_owned = false;
40543         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
40544         uint64_t ret_ref = 0;
40545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40547         return ret_ref;
40548 }
40549
40550 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
40551         LDKChannelUpdateInfo this_ptr_conv;
40552         this_ptr_conv.inner = untag_ptr(this_ptr);
40553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40555         this_ptr_conv.is_owned = false;
40556         LDKRoutingFees val_conv;
40557         val_conv.inner = untag_ptr(val);
40558         val_conv.is_owned = ptr_is_owned(val);
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40560         val_conv = RoutingFees_clone(&val_conv);
40561         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
40562 }
40563
40564 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
40565         LDKChannelUpdateInfo this_ptr_conv;
40566         this_ptr_conv.inner = untag_ptr(this_ptr);
40567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40569         this_ptr_conv.is_owned = false;
40570         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
40571         uint64_t ret_ref = 0;
40572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40574         return ret_ref;
40575 }
40576
40577 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
40578         LDKChannelUpdateInfo this_ptr_conv;
40579         this_ptr_conv.inner = untag_ptr(this_ptr);
40580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40582         this_ptr_conv.is_owned = false;
40583         LDKChannelUpdate val_conv;
40584         val_conv.inner = untag_ptr(val);
40585         val_conv.is_owned = ptr_is_owned(val);
40586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40587         val_conv = ChannelUpdate_clone(&val_conv);
40588         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
40589 }
40590
40591 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) {
40592         LDKRoutingFees fees_arg_conv;
40593         fees_arg_conv.inner = untag_ptr(fees_arg);
40594         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
40595         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40596         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40597         LDKChannelUpdate last_update_message_arg_conv;
40598         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
40599         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
40601         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
40602         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);
40603         uint64_t ret_ref = 0;
40604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40606         return ret_ref;
40607 }
40608
40609 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
40610         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
40611         uint64_t ret_ref = 0;
40612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40614         return ret_ref;
40615 }
40616 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
40617         LDKChannelUpdateInfo arg_conv;
40618         arg_conv.inner = untag_ptr(arg);
40619         arg_conv.is_owned = ptr_is_owned(arg);
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40621         arg_conv.is_owned = false;
40622         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
40623         return ret_conv;
40624 }
40625
40626 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
40627         LDKChannelUpdateInfo orig_conv;
40628         orig_conv.inner = untag_ptr(orig);
40629         orig_conv.is_owned = ptr_is_owned(orig);
40630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40631         orig_conv.is_owned = false;
40632         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
40633         uint64_t ret_ref = 0;
40634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40636         return ret_ref;
40637 }
40638
40639 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
40640         LDKChannelUpdateInfo a_conv;
40641         a_conv.inner = untag_ptr(a);
40642         a_conv.is_owned = ptr_is_owned(a);
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40644         a_conv.is_owned = false;
40645         LDKChannelUpdateInfo b_conv;
40646         b_conv.inner = untag_ptr(b);
40647         b_conv.is_owned = ptr_is_owned(b);
40648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40649         b_conv.is_owned = false;
40650         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
40651         return ret_conv;
40652 }
40653
40654 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
40655         LDKChannelUpdateInfo obj_conv;
40656         obj_conv.inner = untag_ptr(obj);
40657         obj_conv.is_owned = ptr_is_owned(obj);
40658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40659         obj_conv.is_owned = false;
40660         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
40661         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40662         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40663         CVec_u8Z_free(ret_var);
40664         return ret_arr;
40665 }
40666
40667 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
40668         LDKu8slice ser_ref;
40669         ser_ref.datalen = ser->arr_len;
40670         ser_ref.data = ser->elems;
40671         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
40672         *ret_conv = ChannelUpdateInfo_read(ser_ref);
40673         FREE(ser);
40674         return tag_ptr(ret_conv, true);
40675 }
40676
40677 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
40678         LDKChannelInfo this_obj_conv;
40679         this_obj_conv.inner = untag_ptr(this_obj);
40680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40682         ChannelInfo_free(this_obj_conv);
40683 }
40684
40685 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
40686         LDKChannelInfo this_ptr_conv;
40687         this_ptr_conv.inner = untag_ptr(this_ptr);
40688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40690         this_ptr_conv.is_owned = false;
40691         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
40692         uint64_t ret_ref = 0;
40693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40695         return ret_ref;
40696 }
40697
40698 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
40699         LDKChannelInfo this_ptr_conv;
40700         this_ptr_conv.inner = untag_ptr(this_ptr);
40701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40703         this_ptr_conv.is_owned = false;
40704         LDKChannelFeatures val_conv;
40705         val_conv.inner = untag_ptr(val);
40706         val_conv.is_owned = ptr_is_owned(val);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40708         val_conv = ChannelFeatures_clone(&val_conv);
40709         ChannelInfo_set_features(&this_ptr_conv, val_conv);
40710 }
40711
40712 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
40713         LDKChannelInfo this_ptr_conv;
40714         this_ptr_conv.inner = untag_ptr(this_ptr);
40715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40717         this_ptr_conv.is_owned = false;
40718         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
40719         uint64_t ret_ref = 0;
40720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40722         return ret_ref;
40723 }
40724
40725 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
40726         LDKChannelInfo this_ptr_conv;
40727         this_ptr_conv.inner = untag_ptr(this_ptr);
40728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40730         this_ptr_conv.is_owned = false;
40731         LDKNodeId val_conv;
40732         val_conv.inner = untag_ptr(val);
40733         val_conv.is_owned = ptr_is_owned(val);
40734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40735         val_conv = NodeId_clone(&val_conv);
40736         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
40737 }
40738
40739 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
40740         LDKChannelInfo this_ptr_conv;
40741         this_ptr_conv.inner = untag_ptr(this_ptr);
40742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40744         this_ptr_conv.is_owned = false;
40745         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
40746         uint64_t ret_ref = 0;
40747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40749         return ret_ref;
40750 }
40751
40752 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
40753         LDKChannelInfo this_ptr_conv;
40754         this_ptr_conv.inner = untag_ptr(this_ptr);
40755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40757         this_ptr_conv.is_owned = false;
40758         LDKChannelUpdateInfo val_conv;
40759         val_conv.inner = untag_ptr(val);
40760         val_conv.is_owned = ptr_is_owned(val);
40761         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40762         val_conv = ChannelUpdateInfo_clone(&val_conv);
40763         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
40764 }
40765
40766 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
40767         LDKChannelInfo this_ptr_conv;
40768         this_ptr_conv.inner = untag_ptr(this_ptr);
40769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40771         this_ptr_conv.is_owned = false;
40772         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
40773         uint64_t ret_ref = 0;
40774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40776         return ret_ref;
40777 }
40778
40779 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
40780         LDKChannelInfo this_ptr_conv;
40781         this_ptr_conv.inner = untag_ptr(this_ptr);
40782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40784         this_ptr_conv.is_owned = false;
40785         LDKNodeId val_conv;
40786         val_conv.inner = untag_ptr(val);
40787         val_conv.is_owned = ptr_is_owned(val);
40788         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40789         val_conv = NodeId_clone(&val_conv);
40790         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
40791 }
40792
40793 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
40794         LDKChannelInfo this_ptr_conv;
40795         this_ptr_conv.inner = untag_ptr(this_ptr);
40796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40798         this_ptr_conv.is_owned = false;
40799         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
40800         uint64_t ret_ref = 0;
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40803         return ret_ref;
40804 }
40805
40806 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
40807         LDKChannelInfo this_ptr_conv;
40808         this_ptr_conv.inner = untag_ptr(this_ptr);
40809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40811         this_ptr_conv.is_owned = false;
40812         LDKChannelUpdateInfo val_conv;
40813         val_conv.inner = untag_ptr(val);
40814         val_conv.is_owned = ptr_is_owned(val);
40815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40816         val_conv = ChannelUpdateInfo_clone(&val_conv);
40817         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
40818 }
40819
40820 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
40821         LDKChannelInfo this_ptr_conv;
40822         this_ptr_conv.inner = untag_ptr(this_ptr);
40823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40825         this_ptr_conv.is_owned = false;
40826         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40827         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
40828         uint64_t ret_ref = tag_ptr(ret_copy, true);
40829         return ret_ref;
40830 }
40831
40832 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
40833         LDKChannelInfo this_ptr_conv;
40834         this_ptr_conv.inner = untag_ptr(this_ptr);
40835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40837         this_ptr_conv.is_owned = false;
40838         void* val_ptr = untag_ptr(val);
40839         CHECK_ACCESS(val_ptr);
40840         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40841         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40842         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
40843 }
40844
40845 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
40846         LDKChannelInfo this_ptr_conv;
40847         this_ptr_conv.inner = untag_ptr(this_ptr);
40848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40850         this_ptr_conv.is_owned = false;
40851         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
40852         uint64_t ret_ref = 0;
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40855         return ret_ref;
40856 }
40857
40858 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
40859         LDKChannelInfo this_ptr_conv;
40860         this_ptr_conv.inner = untag_ptr(this_ptr);
40861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40863         this_ptr_conv.is_owned = false;
40864         LDKChannelAnnouncement val_conv;
40865         val_conv.inner = untag_ptr(val);
40866         val_conv.is_owned = ptr_is_owned(val);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40868         val_conv = ChannelAnnouncement_clone(&val_conv);
40869         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
40870 }
40871
40872 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
40873         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
40874         uint64_t ret_ref = 0;
40875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40877         return ret_ref;
40878 }
40879 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
40880         LDKChannelInfo arg_conv;
40881         arg_conv.inner = untag_ptr(arg);
40882         arg_conv.is_owned = ptr_is_owned(arg);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40884         arg_conv.is_owned = false;
40885         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
40886         return ret_conv;
40887 }
40888
40889 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
40890         LDKChannelInfo orig_conv;
40891         orig_conv.inner = untag_ptr(orig);
40892         orig_conv.is_owned = ptr_is_owned(orig);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40894         orig_conv.is_owned = false;
40895         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
40896         uint64_t ret_ref = 0;
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40899         return ret_ref;
40900 }
40901
40902 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
40903         LDKChannelInfo a_conv;
40904         a_conv.inner = untag_ptr(a);
40905         a_conv.is_owned = ptr_is_owned(a);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40907         a_conv.is_owned = false;
40908         LDKChannelInfo b_conv;
40909         b_conv.inner = untag_ptr(b);
40910         b_conv.is_owned = ptr_is_owned(b);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40912         b_conv.is_owned = false;
40913         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
40914         return ret_conv;
40915 }
40916
40917 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
40918         LDKChannelInfo this_arg_conv;
40919         this_arg_conv.inner = untag_ptr(this_arg);
40920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40922         this_arg_conv.is_owned = false;
40923         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
40924         uint64_t ret_ref = 0;
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40927         return ret_ref;
40928 }
40929
40930 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
40931         LDKChannelInfo obj_conv;
40932         obj_conv.inner = untag_ptr(obj);
40933         obj_conv.is_owned = ptr_is_owned(obj);
40934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40935         obj_conv.is_owned = false;
40936         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40937         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40938         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40939         CVec_u8Z_free(ret_var);
40940         return ret_arr;
40941 }
40942
40943 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
40944         LDKu8slice ser_ref;
40945         ser_ref.datalen = ser->arr_len;
40946         ser_ref.data = ser->elems;
40947         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40948         *ret_conv = ChannelInfo_read(ser_ref);
40949         FREE(ser);
40950         return tag_ptr(ret_conv, true);
40951 }
40952
40953 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
40954         LDKDirectedChannelInfo this_obj_conv;
40955         this_obj_conv.inner = untag_ptr(this_obj);
40956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40958         DirectedChannelInfo_free(this_obj_conv);
40959 }
40960
40961 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40962         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40963         uint64_t ret_ref = 0;
40964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40966         return ret_ref;
40967 }
40968 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
40969         LDKDirectedChannelInfo arg_conv;
40970         arg_conv.inner = untag_ptr(arg);
40971         arg_conv.is_owned = ptr_is_owned(arg);
40972         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40973         arg_conv.is_owned = false;
40974         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
40975         return ret_conv;
40976 }
40977
40978 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
40979         LDKDirectedChannelInfo orig_conv;
40980         orig_conv.inner = untag_ptr(orig);
40981         orig_conv.is_owned = ptr_is_owned(orig);
40982         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40983         orig_conv.is_owned = false;
40984         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40985         uint64_t ret_ref = 0;
40986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40988         return ret_ref;
40989 }
40990
40991 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
40992         LDKDirectedChannelInfo this_arg_conv;
40993         this_arg_conv.inner = untag_ptr(this_arg);
40994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40996         this_arg_conv.is_owned = false;
40997         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40998         uint64_t ret_ref = 0;
40999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41001         return ret_ref;
41002 }
41003
41004 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
41005         LDKDirectedChannelInfo this_arg_conv;
41006         this_arg_conv.inner = untag_ptr(this_arg);
41007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41009         this_arg_conv.is_owned = false;
41010         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
41011         uint64_t ret_ref = 0;
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41014         return ret_ref;
41015 }
41016
41017 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
41018         LDKDirectedChannelInfo this_arg_conv;
41019         this_arg_conv.inner = untag_ptr(this_arg);
41020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41022         this_arg_conv.is_owned = false;
41023         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
41024         return ret_conv;
41025 }
41026
41027 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
41028         LDKDirectedChannelInfo this_arg_conv;
41029         this_arg_conv.inner = untag_ptr(this_arg);
41030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41032         this_arg_conv.is_owned = false;
41033         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41034         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
41035         uint64_t ret_ref = tag_ptr(ret_copy, true);
41036         return ret_ref;
41037 }
41038
41039 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
41040         if (!ptr_is_owned(this_ptr)) return;
41041         void* this_ptr_ptr = untag_ptr(this_ptr);
41042         CHECK_ACCESS(this_ptr_ptr);
41043         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
41044         FREE(untag_ptr(this_ptr));
41045         EffectiveCapacity_free(this_ptr_conv);
41046 }
41047
41048 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
41049         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41050         *ret_copy = EffectiveCapacity_clone(arg);
41051         uint64_t ret_ref = tag_ptr(ret_copy, true);
41052         return ret_ref;
41053 }
41054 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
41055         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
41056         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
41057         return ret_conv;
41058 }
41059
41060 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
41061         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
41062         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41063         *ret_copy = EffectiveCapacity_clone(orig_conv);
41064         uint64_t ret_ref = tag_ptr(ret_copy, true);
41065         return ret_ref;
41066 }
41067
41068 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
41069         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41070         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
41071         uint64_t ret_ref = tag_ptr(ret_copy, true);
41072         return ret_ref;
41073 }
41074
41075 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
41076         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41077         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
41078         uint64_t ret_ref = tag_ptr(ret_copy, true);
41079         return ret_ref;
41080 }
41081
41082 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
41083         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
41084         CHECK_ACCESS(htlc_maximum_msat_ptr);
41085         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
41086         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
41087         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41088         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
41089         uint64_t ret_ref = tag_ptr(ret_copy, true);
41090         return ret_ref;
41091 }
41092
41093 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
41094         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41095         *ret_copy = EffectiveCapacity_infinite();
41096         uint64_t ret_ref = tag_ptr(ret_copy, true);
41097         return ret_ref;
41098 }
41099
41100 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
41101         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
41102         *ret_copy = EffectiveCapacity_unknown();
41103         uint64_t ret_ref = tag_ptr(ret_copy, true);
41104         return ret_ref;
41105 }
41106
41107 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
41108         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
41109         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
41110         return ret_conv;
41111 }
41112
41113 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
41114         LDKRoutingFees this_obj_conv;
41115         this_obj_conv.inner = untag_ptr(this_obj);
41116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41118         RoutingFees_free(this_obj_conv);
41119 }
41120
41121 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
41122         LDKRoutingFees this_ptr_conv;
41123         this_ptr_conv.inner = untag_ptr(this_ptr);
41124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41126         this_ptr_conv.is_owned = false;
41127         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
41128         return ret_conv;
41129 }
41130
41131 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
41132         LDKRoutingFees this_ptr_conv;
41133         this_ptr_conv.inner = untag_ptr(this_ptr);
41134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41136         this_ptr_conv.is_owned = false;
41137         RoutingFees_set_base_msat(&this_ptr_conv, val);
41138 }
41139
41140 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
41141         LDKRoutingFees this_ptr_conv;
41142         this_ptr_conv.inner = untag_ptr(this_ptr);
41143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41145         this_ptr_conv.is_owned = false;
41146         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
41147         return ret_conv;
41148 }
41149
41150 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
41151         LDKRoutingFees this_ptr_conv;
41152         this_ptr_conv.inner = untag_ptr(this_ptr);
41153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41155         this_ptr_conv.is_owned = false;
41156         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
41157 }
41158
41159 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
41160         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
41161         uint64_t ret_ref = 0;
41162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41164         return ret_ref;
41165 }
41166
41167 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
41168         LDKRoutingFees a_conv;
41169         a_conv.inner = untag_ptr(a);
41170         a_conv.is_owned = ptr_is_owned(a);
41171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41172         a_conv.is_owned = false;
41173         LDKRoutingFees b_conv;
41174         b_conv.inner = untag_ptr(b);
41175         b_conv.is_owned = ptr_is_owned(b);
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41177         b_conv.is_owned = false;
41178         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
41179         return ret_conv;
41180 }
41181
41182 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
41183         LDKRoutingFees ret_var = RoutingFees_clone(arg);
41184         uint64_t ret_ref = 0;
41185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41187         return ret_ref;
41188 }
41189 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
41190         LDKRoutingFees arg_conv;
41191         arg_conv.inner = untag_ptr(arg);
41192         arg_conv.is_owned = ptr_is_owned(arg);
41193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41194         arg_conv.is_owned = false;
41195         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
41196         return ret_conv;
41197 }
41198
41199 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
41200         LDKRoutingFees orig_conv;
41201         orig_conv.inner = untag_ptr(orig);
41202         orig_conv.is_owned = ptr_is_owned(orig);
41203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41204         orig_conv.is_owned = false;
41205         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
41206         uint64_t ret_ref = 0;
41207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41209         return ret_ref;
41210 }
41211
41212 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
41213         LDKRoutingFees o_conv;
41214         o_conv.inner = untag_ptr(o);
41215         o_conv.is_owned = ptr_is_owned(o);
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41217         o_conv.is_owned = false;
41218         int64_t ret_conv = RoutingFees_hash(&o_conv);
41219         return ret_conv;
41220 }
41221
41222 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
41223         LDKRoutingFees obj_conv;
41224         obj_conv.inner = untag_ptr(obj);
41225         obj_conv.is_owned = ptr_is_owned(obj);
41226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41227         obj_conv.is_owned = false;
41228         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
41229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41231         CVec_u8Z_free(ret_var);
41232         return ret_arr;
41233 }
41234
41235 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
41236         LDKu8slice ser_ref;
41237         ser_ref.datalen = ser->arr_len;
41238         ser_ref.data = ser->elems;
41239         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
41240         *ret_conv = RoutingFees_read(ser_ref);
41241         FREE(ser);
41242         return tag_ptr(ret_conv, true);
41243 }
41244
41245 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
41246         LDKNodeAnnouncementInfo this_obj_conv;
41247         this_obj_conv.inner = untag_ptr(this_obj);
41248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41250         NodeAnnouncementInfo_free(this_obj_conv);
41251 }
41252
41253 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
41254         LDKNodeAnnouncementInfo this_ptr_conv;
41255         this_ptr_conv.inner = untag_ptr(this_ptr);
41256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41258         this_ptr_conv.is_owned = false;
41259         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
41260         uint64_t ret_ref = 0;
41261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41263         return ret_ref;
41264 }
41265
41266 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
41267         LDKNodeAnnouncementInfo this_ptr_conv;
41268         this_ptr_conv.inner = untag_ptr(this_ptr);
41269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41271         this_ptr_conv.is_owned = false;
41272         LDKNodeFeatures val_conv;
41273         val_conv.inner = untag_ptr(val);
41274         val_conv.is_owned = ptr_is_owned(val);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41276         val_conv = NodeFeatures_clone(&val_conv);
41277         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
41278 }
41279
41280 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
41281         LDKNodeAnnouncementInfo this_ptr_conv;
41282         this_ptr_conv.inner = untag_ptr(this_ptr);
41283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41285         this_ptr_conv.is_owned = false;
41286         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
41287         return ret_conv;
41288 }
41289
41290 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
41291         LDKNodeAnnouncementInfo this_ptr_conv;
41292         this_ptr_conv.inner = untag_ptr(this_ptr);
41293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41295         this_ptr_conv.is_owned = false;
41296         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
41297 }
41298
41299 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
41300         LDKNodeAnnouncementInfo this_ptr_conv;
41301         this_ptr_conv.inner = untag_ptr(this_ptr);
41302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41304         this_ptr_conv.is_owned = false;
41305         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
41306         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
41307         return ret_arr;
41308 }
41309
41310 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
41311         LDKNodeAnnouncementInfo this_ptr_conv;
41312         this_ptr_conv.inner = untag_ptr(this_ptr);
41313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41315         this_ptr_conv.is_owned = false;
41316         LDKThreeBytes val_ref;
41317         CHECK(val->arr_len == 3);
41318         memcpy(val_ref.data, val->elems, 3); FREE(val);
41319         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
41320 }
41321
41322 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
41323         LDKNodeAnnouncementInfo this_ptr_conv;
41324         this_ptr_conv.inner = untag_ptr(this_ptr);
41325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41327         this_ptr_conv.is_owned = false;
41328         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
41329         uint64_t ret_ref = 0;
41330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41332         return ret_ref;
41333 }
41334
41335 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
41336         LDKNodeAnnouncementInfo this_ptr_conv;
41337         this_ptr_conv.inner = untag_ptr(this_ptr);
41338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41340         this_ptr_conv.is_owned = false;
41341         LDKNodeAlias val_conv;
41342         val_conv.inner = untag_ptr(val);
41343         val_conv.is_owned = ptr_is_owned(val);
41344         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41345         val_conv = NodeAlias_clone(&val_conv);
41346         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
41347 }
41348
41349 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
41350         LDKNodeAnnouncementInfo this_ptr_conv;
41351         this_ptr_conv.inner = untag_ptr(this_ptr);
41352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41354         this_ptr_conv.is_owned = false;
41355         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
41356         uint64_tArray ret_arr = NULL;
41357         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41358         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41359         for (size_t m = 0; m < ret_var.datalen; m++) {
41360                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
41361                 *ret_conv_12_copy = ret_var.data[m];
41362                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
41363                 ret_arr_ptr[m] = ret_conv_12_ref;
41364         }
41365         
41366         FREE(ret_var.data);
41367         return ret_arr;
41368 }
41369
41370 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
41371         LDKNodeAnnouncementInfo this_ptr_conv;
41372         this_ptr_conv.inner = untag_ptr(this_ptr);
41373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41375         this_ptr_conv.is_owned = false;
41376         LDKCVec_NetAddressZ val_constr;
41377         val_constr.datalen = val->arr_len;
41378         if (val_constr.datalen > 0)
41379                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
41380         else
41381                 val_constr.data = NULL;
41382         uint64_t* val_vals = val->elems;
41383         for (size_t m = 0; m < val_constr.datalen; m++) {
41384                 uint64_t val_conv_12 = val_vals[m];
41385                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
41386                 CHECK_ACCESS(val_conv_12_ptr);
41387                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
41388                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
41389                 val_constr.data[m] = val_conv_12_conv;
41390         }
41391         FREE(val);
41392         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
41393 }
41394
41395 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
41396         LDKNodeAnnouncementInfo this_ptr_conv;
41397         this_ptr_conv.inner = untag_ptr(this_ptr);
41398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41400         this_ptr_conv.is_owned = false;
41401         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
41402         uint64_t ret_ref = 0;
41403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41405         return ret_ref;
41406 }
41407
41408 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
41409         LDKNodeAnnouncementInfo this_ptr_conv;
41410         this_ptr_conv.inner = untag_ptr(this_ptr);
41411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413         this_ptr_conv.is_owned = false;
41414         LDKNodeAnnouncement val_conv;
41415         val_conv.inner = untag_ptr(val);
41416         val_conv.is_owned = ptr_is_owned(val);
41417         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41418         val_conv = NodeAnnouncement_clone(&val_conv);
41419         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
41420 }
41421
41422 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) {
41423         LDKNodeFeatures features_arg_conv;
41424         features_arg_conv.inner = untag_ptr(features_arg);
41425         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41426         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41427         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
41428         LDKThreeBytes rgb_arg_ref;
41429         CHECK(rgb_arg->arr_len == 3);
41430         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
41431         LDKNodeAlias alias_arg_conv;
41432         alias_arg_conv.inner = untag_ptr(alias_arg);
41433         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
41434         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
41435         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
41436         LDKCVec_NetAddressZ addresses_arg_constr;
41437         addresses_arg_constr.datalen = addresses_arg->arr_len;
41438         if (addresses_arg_constr.datalen > 0)
41439                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
41440         else
41441                 addresses_arg_constr.data = NULL;
41442         uint64_t* addresses_arg_vals = addresses_arg->elems;
41443         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
41444                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
41445                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
41446                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
41447                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
41448                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
41449         }
41450         FREE(addresses_arg);
41451         LDKNodeAnnouncement announcement_message_arg_conv;
41452         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
41453         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
41455         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
41456         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
41457         uint64_t ret_ref = 0;
41458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41460         return ret_ref;
41461 }
41462
41463 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
41464         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
41465         uint64_t ret_ref = 0;
41466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41468         return ret_ref;
41469 }
41470 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
41471         LDKNodeAnnouncementInfo arg_conv;
41472         arg_conv.inner = untag_ptr(arg);
41473         arg_conv.is_owned = ptr_is_owned(arg);
41474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41475         arg_conv.is_owned = false;
41476         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
41477         return ret_conv;
41478 }
41479
41480 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
41481         LDKNodeAnnouncementInfo orig_conv;
41482         orig_conv.inner = untag_ptr(orig);
41483         orig_conv.is_owned = ptr_is_owned(orig);
41484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41485         orig_conv.is_owned = false;
41486         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
41487         uint64_t ret_ref = 0;
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41490         return ret_ref;
41491 }
41492
41493 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
41494         LDKNodeAnnouncementInfo a_conv;
41495         a_conv.inner = untag_ptr(a);
41496         a_conv.is_owned = ptr_is_owned(a);
41497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41498         a_conv.is_owned = false;
41499         LDKNodeAnnouncementInfo b_conv;
41500         b_conv.inner = untag_ptr(b);
41501         b_conv.is_owned = ptr_is_owned(b);
41502         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41503         b_conv.is_owned = false;
41504         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
41505         return ret_conv;
41506 }
41507
41508 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
41509         LDKNodeAnnouncementInfo obj_conv;
41510         obj_conv.inner = untag_ptr(obj);
41511         obj_conv.is_owned = ptr_is_owned(obj);
41512         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41513         obj_conv.is_owned = false;
41514         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
41515         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41516         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41517         CVec_u8Z_free(ret_var);
41518         return ret_arr;
41519 }
41520
41521 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
41522         LDKu8slice ser_ref;
41523         ser_ref.datalen = ser->arr_len;
41524         ser_ref.data = ser->elems;
41525         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
41526         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
41527         FREE(ser);
41528         return tag_ptr(ret_conv, true);
41529 }
41530
41531 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
41532         LDKNodeAlias this_obj_conv;
41533         this_obj_conv.inner = untag_ptr(this_obj);
41534         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41536         NodeAlias_free(this_obj_conv);
41537 }
41538
41539 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
41540         LDKNodeAlias this_ptr_conv;
41541         this_ptr_conv.inner = untag_ptr(this_ptr);
41542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41544         this_ptr_conv.is_owned = false;
41545         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41546         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
41547         return ret_arr;
41548 }
41549
41550 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
41551         LDKNodeAlias this_ptr_conv;
41552         this_ptr_conv.inner = untag_ptr(this_ptr);
41553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41555         this_ptr_conv.is_owned = false;
41556         LDKThirtyTwoBytes val_ref;
41557         CHECK(val->arr_len == 32);
41558         memcpy(val_ref.data, val->elems, 32); FREE(val);
41559         NodeAlias_set_a(&this_ptr_conv, val_ref);
41560 }
41561
41562 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
41563         LDKThirtyTwoBytes a_arg_ref;
41564         CHECK(a_arg->arr_len == 32);
41565         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
41566         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
41567         uint64_t ret_ref = 0;
41568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41570         return ret_ref;
41571 }
41572
41573 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
41574         LDKNodeAlias ret_var = NodeAlias_clone(arg);
41575         uint64_t ret_ref = 0;
41576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41578         return ret_ref;
41579 }
41580 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
41581         LDKNodeAlias arg_conv;
41582         arg_conv.inner = untag_ptr(arg);
41583         arg_conv.is_owned = ptr_is_owned(arg);
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41585         arg_conv.is_owned = false;
41586         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
41587         return ret_conv;
41588 }
41589
41590 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
41591         LDKNodeAlias orig_conv;
41592         orig_conv.inner = untag_ptr(orig);
41593         orig_conv.is_owned = ptr_is_owned(orig);
41594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41595         orig_conv.is_owned = false;
41596         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
41597         uint64_t ret_ref = 0;
41598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41600         return ret_ref;
41601 }
41602
41603 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
41604         LDKNodeAlias a_conv;
41605         a_conv.inner = untag_ptr(a);
41606         a_conv.is_owned = ptr_is_owned(a);
41607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41608         a_conv.is_owned = false;
41609         LDKNodeAlias b_conv;
41610         b_conv.inner = untag_ptr(b);
41611         b_conv.is_owned = ptr_is_owned(b);
41612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41613         b_conv.is_owned = false;
41614         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
41615         return ret_conv;
41616 }
41617
41618 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
41619         LDKNodeAlias obj_conv;
41620         obj_conv.inner = untag_ptr(obj);
41621         obj_conv.is_owned = ptr_is_owned(obj);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41623         obj_conv.is_owned = false;
41624         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
41625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41627         CVec_u8Z_free(ret_var);
41628         return ret_arr;
41629 }
41630
41631 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
41632         LDKu8slice ser_ref;
41633         ser_ref.datalen = ser->arr_len;
41634         ser_ref.data = ser->elems;
41635         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
41636         *ret_conv = NodeAlias_read(ser_ref);
41637         FREE(ser);
41638         return tag_ptr(ret_conv, true);
41639 }
41640
41641 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
41642         LDKNodeInfo this_obj_conv;
41643         this_obj_conv.inner = untag_ptr(this_obj);
41644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41646         NodeInfo_free(this_obj_conv);
41647 }
41648
41649 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
41650         LDKNodeInfo this_ptr_conv;
41651         this_ptr_conv.inner = untag_ptr(this_ptr);
41652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41654         this_ptr_conv.is_owned = false;
41655         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
41656         int64_tArray ret_arr = NULL;
41657         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41658         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41659         for (size_t i = 0; i < ret_var.datalen; i++) {
41660                 int64_t ret_conv_8_conv = ret_var.data[i];
41661                 ret_arr_ptr[i] = ret_conv_8_conv;
41662         }
41663         
41664         FREE(ret_var.data);
41665         return ret_arr;
41666 }
41667
41668 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
41669         LDKNodeInfo this_ptr_conv;
41670         this_ptr_conv.inner = untag_ptr(this_ptr);
41671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673         this_ptr_conv.is_owned = false;
41674         LDKCVec_u64Z val_constr;
41675         val_constr.datalen = val->arr_len;
41676         if (val_constr.datalen > 0)
41677                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41678         else
41679                 val_constr.data = NULL;
41680         int64_t* val_vals = val->elems;
41681         for (size_t i = 0; i < val_constr.datalen; i++) {
41682                 int64_t val_conv_8 = val_vals[i];
41683                 val_constr.data[i] = val_conv_8;
41684         }
41685         FREE(val);
41686         NodeInfo_set_channels(&this_ptr_conv, val_constr);
41687 }
41688
41689 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
41690         LDKNodeInfo this_ptr_conv;
41691         this_ptr_conv.inner = untag_ptr(this_ptr);
41692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41694         this_ptr_conv.is_owned = false;
41695         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
41696         uint64_t ret_ref = 0;
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41699         return ret_ref;
41700 }
41701
41702 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) {
41703         LDKNodeInfo this_ptr_conv;
41704         this_ptr_conv.inner = untag_ptr(this_ptr);
41705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41707         this_ptr_conv.is_owned = false;
41708         LDKRoutingFees val_conv;
41709         val_conv.inner = untag_ptr(val);
41710         val_conv.is_owned = ptr_is_owned(val);
41711         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41712         val_conv = RoutingFees_clone(&val_conv);
41713         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
41714 }
41715
41716 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
41717         LDKNodeInfo this_ptr_conv;
41718         this_ptr_conv.inner = untag_ptr(this_ptr);
41719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41721         this_ptr_conv.is_owned = false;
41722         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
41723         uint64_t ret_ref = 0;
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41726         return ret_ref;
41727 }
41728
41729 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
41730         LDKNodeInfo this_ptr_conv;
41731         this_ptr_conv.inner = untag_ptr(this_ptr);
41732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41734         this_ptr_conv.is_owned = false;
41735         LDKNodeAnnouncementInfo val_conv;
41736         val_conv.inner = untag_ptr(val);
41737         val_conv.is_owned = ptr_is_owned(val);
41738         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41739         val_conv = NodeAnnouncementInfo_clone(&val_conv);
41740         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
41741 }
41742
41743 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) {
41744         LDKCVec_u64Z channels_arg_constr;
41745         channels_arg_constr.datalen = channels_arg->arr_len;
41746         if (channels_arg_constr.datalen > 0)
41747                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41748         else
41749                 channels_arg_constr.data = NULL;
41750         int64_t* channels_arg_vals = channels_arg->elems;
41751         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
41752                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
41753                 channels_arg_constr.data[i] = channels_arg_conv_8;
41754         }
41755         FREE(channels_arg);
41756         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
41757         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
41758         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
41760         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
41761         LDKNodeAnnouncementInfo announcement_info_arg_conv;
41762         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
41763         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
41764         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
41765         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
41766         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
41767         uint64_t ret_ref = 0;
41768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41770         return ret_ref;
41771 }
41772
41773 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
41774         LDKNodeInfo ret_var = NodeInfo_clone(arg);
41775         uint64_t ret_ref = 0;
41776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41778         return ret_ref;
41779 }
41780 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
41781         LDKNodeInfo arg_conv;
41782         arg_conv.inner = untag_ptr(arg);
41783         arg_conv.is_owned = ptr_is_owned(arg);
41784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41785         arg_conv.is_owned = false;
41786         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
41787         return ret_conv;
41788 }
41789
41790 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
41791         LDKNodeInfo orig_conv;
41792         orig_conv.inner = untag_ptr(orig);
41793         orig_conv.is_owned = ptr_is_owned(orig);
41794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41795         orig_conv.is_owned = false;
41796         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
41797         uint64_t ret_ref = 0;
41798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41800         return ret_ref;
41801 }
41802
41803 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
41804         LDKNodeInfo a_conv;
41805         a_conv.inner = untag_ptr(a);
41806         a_conv.is_owned = ptr_is_owned(a);
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41808         a_conv.is_owned = false;
41809         LDKNodeInfo b_conv;
41810         b_conv.inner = untag_ptr(b);
41811         b_conv.is_owned = ptr_is_owned(b);
41812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41813         b_conv.is_owned = false;
41814         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
41815         return ret_conv;
41816 }
41817
41818 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
41819         LDKNodeInfo obj_conv;
41820         obj_conv.inner = untag_ptr(obj);
41821         obj_conv.is_owned = ptr_is_owned(obj);
41822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41823         obj_conv.is_owned = false;
41824         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
41825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41827         CVec_u8Z_free(ret_var);
41828         return ret_arr;
41829 }
41830
41831 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
41832         LDKu8slice ser_ref;
41833         ser_ref.datalen = ser->arr_len;
41834         ser_ref.data = ser->elems;
41835         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
41836         *ret_conv = NodeInfo_read(ser_ref);
41837         FREE(ser);
41838         return tag_ptr(ret_conv, true);
41839 }
41840
41841 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
41842         LDKNetworkGraph obj_conv;
41843         obj_conv.inner = untag_ptr(obj);
41844         obj_conv.is_owned = ptr_is_owned(obj);
41845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41846         obj_conv.is_owned = false;
41847         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
41848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41850         CVec_u8Z_free(ret_var);
41851         return ret_arr;
41852 }
41853
41854 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
41855         LDKu8slice ser_ref;
41856         ser_ref.datalen = ser->arr_len;
41857         ser_ref.data = ser->elems;
41858         void* arg_ptr = untag_ptr(arg);
41859         CHECK_ACCESS(arg_ptr);
41860         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
41861         if (arg_conv.free == LDKLogger_JCalls_free) {
41862                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41863                 LDKLogger_JCalls_cloned(&arg_conv);
41864         }
41865         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
41866         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
41867         FREE(ser);
41868         return tag_ptr(ret_conv, true);
41869 }
41870
41871 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
41872         LDKThirtyTwoBytes genesis_hash_ref;
41873         CHECK(genesis_hash->arr_len == 32);
41874         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
41875         void* logger_ptr = untag_ptr(logger);
41876         CHECK_ACCESS(logger_ptr);
41877         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41878         if (logger_conv.free == LDKLogger_JCalls_free) {
41879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41880                 LDKLogger_JCalls_cloned(&logger_conv);
41881         }
41882         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
41883         uint64_t ret_ref = 0;
41884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41886         return ret_ref;
41887 }
41888
41889 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
41890         LDKNetworkGraph this_arg_conv;
41891         this_arg_conv.inner = untag_ptr(this_arg);
41892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41894         this_arg_conv.is_owned = false;
41895         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
41896         uint64_t ret_ref = 0;
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41899         return ret_ref;
41900 }
41901
41902 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) {
41903         LDKNetworkGraph this_arg_conv;
41904         this_arg_conv.inner = untag_ptr(this_arg);
41905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41907         this_arg_conv.is_owned = false;
41908         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41909         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
41910         uint64_t ret_ref = tag_ptr(ret_copy, true);
41911         return ret_ref;
41912 }
41913
41914 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) {
41915         LDKNetworkGraph this_arg_conv;
41916         this_arg_conv.inner = untag_ptr(this_arg);
41917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41919         this_arg_conv.is_owned = false;
41920         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
41921 }
41922
41923 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
41924         LDKNetworkGraph this_arg_conv;
41925         this_arg_conv.inner = untag_ptr(this_arg);
41926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41928         this_arg_conv.is_owned = false;
41929         LDKNodeAnnouncement msg_conv;
41930         msg_conv.inner = untag_ptr(msg);
41931         msg_conv.is_owned = ptr_is_owned(msg);
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41933         msg_conv.is_owned = false;
41934         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41935         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
41936         return tag_ptr(ret_conv, true);
41937 }
41938
41939 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) {
41940         LDKNetworkGraph this_arg_conv;
41941         this_arg_conv.inner = untag_ptr(this_arg);
41942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41944         this_arg_conv.is_owned = false;
41945         LDKUnsignedNodeAnnouncement msg_conv;
41946         msg_conv.inner = untag_ptr(msg);
41947         msg_conv.is_owned = ptr_is_owned(msg);
41948         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41949         msg_conv.is_owned = false;
41950         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41951         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
41952         return tag_ptr(ret_conv, true);
41953 }
41954
41955 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) {
41956         LDKNetworkGraph this_arg_conv;
41957         this_arg_conv.inner = untag_ptr(this_arg);
41958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41960         this_arg_conv.is_owned = false;
41961         LDKChannelAnnouncement msg_conv;
41962         msg_conv.inner = untag_ptr(msg);
41963         msg_conv.is_owned = ptr_is_owned(msg);
41964         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41965         msg_conv.is_owned = false;
41966         void* chain_access_ptr = untag_ptr(chain_access);
41967         CHECK_ACCESS(chain_access_ptr);
41968         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41969         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41970         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41971                 // Manually implement clone for Java trait instances
41972                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41973                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41974                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41975                 }
41976         }
41977         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41978         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41979         return tag_ptr(ret_conv, true);
41980 }
41981
41982 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) {
41983         LDKNetworkGraph this_arg_conv;
41984         this_arg_conv.inner = untag_ptr(this_arg);
41985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41987         this_arg_conv.is_owned = false;
41988         LDKUnsignedChannelAnnouncement msg_conv;
41989         msg_conv.inner = untag_ptr(msg);
41990         msg_conv.is_owned = ptr_is_owned(msg);
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41992         msg_conv.is_owned = false;
41993         void* chain_access_ptr = untag_ptr(chain_access);
41994         CHECK_ACCESS(chain_access_ptr);
41995         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41996         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41997         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41998                 // Manually implement clone for Java trait instances
41999                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
42000                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42001                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
42002                 }
42003         }
42004         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42005         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
42006         return tag_ptr(ret_conv, true);
42007 }
42008
42009 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) {
42010         LDKNetworkGraph this_arg_conv;
42011         this_arg_conv.inner = untag_ptr(this_arg);
42012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42014         this_arg_conv.is_owned = false;
42015         LDKChannelFeatures features_conv;
42016         features_conv.inner = untag_ptr(features);
42017         features_conv.is_owned = ptr_is_owned(features);
42018         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42019         features_conv = ChannelFeatures_clone(&features_conv);
42020         LDKPublicKey node_id_1_ref;
42021         CHECK(node_id_1->arr_len == 33);
42022         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
42023         LDKPublicKey node_id_2_ref;
42024         CHECK(node_id_2->arr_len == 33);
42025         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
42026         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42027         *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);
42028         return tag_ptr(ret_conv, true);
42029 }
42030
42031 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
42032         LDKNetworkGraph this_arg_conv;
42033         this_arg_conv.inner = untag_ptr(this_arg);
42034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42036         this_arg_conv.is_owned = false;
42037         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
42038 }
42039
42040 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
42041         LDKNetworkGraph this_arg_conv;
42042         this_arg_conv.inner = untag_ptr(this_arg);
42043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42045         this_arg_conv.is_owned = false;
42046         LDKPublicKey node_id_ref;
42047         CHECK(node_id->arr_len == 33);
42048         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42049         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
42050 }
42051
42052 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) {
42053         LDKNetworkGraph this_arg_conv;
42054         this_arg_conv.inner = untag_ptr(this_arg);
42055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42057         this_arg_conv.is_owned = false;
42058         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
42059 }
42060
42061 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
42062         LDKNetworkGraph this_arg_conv;
42063         this_arg_conv.inner = untag_ptr(this_arg);
42064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42066         this_arg_conv.is_owned = false;
42067         LDKChannelUpdate msg_conv;
42068         msg_conv.inner = untag_ptr(msg);
42069         msg_conv.is_owned = ptr_is_owned(msg);
42070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42071         msg_conv.is_owned = false;
42072         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42073         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
42074         return tag_ptr(ret_conv, true);
42075 }
42076
42077 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
42078         LDKNetworkGraph this_arg_conv;
42079         this_arg_conv.inner = untag_ptr(this_arg);
42080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42082         this_arg_conv.is_owned = false;
42083         LDKUnsignedChannelUpdate msg_conv;
42084         msg_conv.inner = untag_ptr(msg);
42085         msg_conv.is_owned = ptr_is_owned(msg);
42086         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42087         msg_conv.is_owned = false;
42088         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42089         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
42090         return tag_ptr(ret_conv, true);
42091 }
42092
42093 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
42094         LDKReadOnlyNetworkGraph this_arg_conv;
42095         this_arg_conv.inner = untag_ptr(this_arg);
42096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42098         this_arg_conv.is_owned = false;
42099         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
42100         uint64_t ret_ref = 0;
42101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42103         return ret_ref;
42104 }
42105
42106 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
42107         LDKReadOnlyNetworkGraph this_arg_conv;
42108         this_arg_conv.inner = untag_ptr(this_arg);
42109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42111         this_arg_conv.is_owned = false;
42112         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
42113         int64_tArray ret_arr = NULL;
42114         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42115         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42116         for (size_t i = 0; i < ret_var.datalen; i++) {
42117                 int64_t ret_conv_8_conv = ret_var.data[i];
42118                 ret_arr_ptr[i] = ret_conv_8_conv;
42119         }
42120         
42121         FREE(ret_var.data);
42122         return ret_arr;
42123 }
42124
42125 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
42126         LDKReadOnlyNetworkGraph this_arg_conv;
42127         this_arg_conv.inner = untag_ptr(this_arg);
42128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42130         this_arg_conv.is_owned = false;
42131         LDKNodeId node_id_conv;
42132         node_id_conv.inner = untag_ptr(node_id);
42133         node_id_conv.is_owned = ptr_is_owned(node_id);
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
42135         node_id_conv.is_owned = false;
42136         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
42137         uint64_t ret_ref = 0;
42138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42140         return ret_ref;
42141 }
42142
42143 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
42144         LDKReadOnlyNetworkGraph this_arg_conv;
42145         this_arg_conv.inner = untag_ptr(this_arg);
42146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42148         this_arg_conv.is_owned = false;
42149         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
42150         uint64_tArray ret_arr = NULL;
42151         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42152         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42153         for (size_t i = 0; i < ret_var.datalen; i++) {
42154                 LDKNodeId ret_conv_8_var = ret_var.data[i];
42155                 uint64_t ret_conv_8_ref = 0;
42156                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
42157                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
42158                 ret_arr_ptr[i] = ret_conv_8_ref;
42159         }
42160         
42161         FREE(ret_var.data);
42162         return ret_arr;
42163 }
42164
42165 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
42166         LDKReadOnlyNetworkGraph this_arg_conv;
42167         this_arg_conv.inner = untag_ptr(this_arg);
42168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42170         this_arg_conv.is_owned = false;
42171         LDKPublicKey pubkey_ref;
42172         CHECK(pubkey->arr_len == 33);
42173         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
42174         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
42175         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
42176         uint64_t ret_ref = tag_ptr(ret_copy, true);
42177         return ret_ref;
42178 }
42179
42180 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
42181         LDKRouteHop this_obj_conv;
42182         this_obj_conv.inner = untag_ptr(this_obj);
42183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42185         RouteHop_free(this_obj_conv);
42186 }
42187
42188 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
42189         LDKRouteHop this_ptr_conv;
42190         this_ptr_conv.inner = untag_ptr(this_ptr);
42191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42193         this_ptr_conv.is_owned = false;
42194         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42195         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
42196         return ret_arr;
42197 }
42198
42199 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
42200         LDKRouteHop this_ptr_conv;
42201         this_ptr_conv.inner = untag_ptr(this_ptr);
42202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42204         this_ptr_conv.is_owned = false;
42205         LDKPublicKey val_ref;
42206         CHECK(val->arr_len == 33);
42207         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42208         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
42209 }
42210
42211 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
42212         LDKRouteHop this_ptr_conv;
42213         this_ptr_conv.inner = untag_ptr(this_ptr);
42214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42216         this_ptr_conv.is_owned = false;
42217         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
42218         uint64_t ret_ref = 0;
42219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42221         return ret_ref;
42222 }
42223
42224 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
42225         LDKRouteHop this_ptr_conv;
42226         this_ptr_conv.inner = untag_ptr(this_ptr);
42227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42229         this_ptr_conv.is_owned = false;
42230         LDKNodeFeatures val_conv;
42231         val_conv.inner = untag_ptr(val);
42232         val_conv.is_owned = ptr_is_owned(val);
42233         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42234         val_conv = NodeFeatures_clone(&val_conv);
42235         RouteHop_set_node_features(&this_ptr_conv, val_conv);
42236 }
42237
42238 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
42239         LDKRouteHop this_ptr_conv;
42240         this_ptr_conv.inner = untag_ptr(this_ptr);
42241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42243         this_ptr_conv.is_owned = false;
42244         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
42245         return ret_conv;
42246 }
42247
42248 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42249         LDKRouteHop this_ptr_conv;
42250         this_ptr_conv.inner = untag_ptr(this_ptr);
42251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42253         this_ptr_conv.is_owned = false;
42254         RouteHop_set_short_channel_id(&this_ptr_conv, val);
42255 }
42256
42257 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
42258         LDKRouteHop this_ptr_conv;
42259         this_ptr_conv.inner = untag_ptr(this_ptr);
42260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42262         this_ptr_conv.is_owned = false;
42263         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
42264         uint64_t ret_ref = 0;
42265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42267         return ret_ref;
42268 }
42269
42270 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
42271         LDKRouteHop this_ptr_conv;
42272         this_ptr_conv.inner = untag_ptr(this_ptr);
42273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42275         this_ptr_conv.is_owned = false;
42276         LDKChannelFeatures val_conv;
42277         val_conv.inner = untag_ptr(val);
42278         val_conv.is_owned = ptr_is_owned(val);
42279         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42280         val_conv = ChannelFeatures_clone(&val_conv);
42281         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
42282 }
42283
42284 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
42285         LDKRouteHop this_ptr_conv;
42286         this_ptr_conv.inner = untag_ptr(this_ptr);
42287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42289         this_ptr_conv.is_owned = false;
42290         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
42291         return ret_conv;
42292 }
42293
42294 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
42295         LDKRouteHop this_ptr_conv;
42296         this_ptr_conv.inner = untag_ptr(this_ptr);
42297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42299         this_ptr_conv.is_owned = false;
42300         RouteHop_set_fee_msat(&this_ptr_conv, val);
42301 }
42302
42303 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
42304         LDKRouteHop this_ptr_conv;
42305         this_ptr_conv.inner = untag_ptr(this_ptr);
42306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42308         this_ptr_conv.is_owned = false;
42309         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
42310         return ret_conv;
42311 }
42312
42313 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
42314         LDKRouteHop this_ptr_conv;
42315         this_ptr_conv.inner = untag_ptr(this_ptr);
42316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42318         this_ptr_conv.is_owned = false;
42319         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42320 }
42321
42322 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) {
42323         LDKPublicKey pubkey_arg_ref;
42324         CHECK(pubkey_arg->arr_len == 33);
42325         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
42326         LDKNodeFeatures node_features_arg_conv;
42327         node_features_arg_conv.inner = untag_ptr(node_features_arg);
42328         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
42330         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
42331         LDKChannelFeatures channel_features_arg_conv;
42332         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
42333         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
42335         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
42336         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);
42337         uint64_t ret_ref = 0;
42338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42340         return ret_ref;
42341 }
42342
42343 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
42344         LDKRouteHop ret_var = RouteHop_clone(arg);
42345         uint64_t ret_ref = 0;
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42348         return ret_ref;
42349 }
42350 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
42351         LDKRouteHop arg_conv;
42352         arg_conv.inner = untag_ptr(arg);
42353         arg_conv.is_owned = ptr_is_owned(arg);
42354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42355         arg_conv.is_owned = false;
42356         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
42357         return ret_conv;
42358 }
42359
42360 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
42361         LDKRouteHop orig_conv;
42362         orig_conv.inner = untag_ptr(orig);
42363         orig_conv.is_owned = ptr_is_owned(orig);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42365         orig_conv.is_owned = false;
42366         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
42367         uint64_t ret_ref = 0;
42368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42370         return ret_ref;
42371 }
42372
42373 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
42374         LDKRouteHop o_conv;
42375         o_conv.inner = untag_ptr(o);
42376         o_conv.is_owned = ptr_is_owned(o);
42377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42378         o_conv.is_owned = false;
42379         int64_t ret_conv = RouteHop_hash(&o_conv);
42380         return ret_conv;
42381 }
42382
42383 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
42384         LDKRouteHop a_conv;
42385         a_conv.inner = untag_ptr(a);
42386         a_conv.is_owned = ptr_is_owned(a);
42387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42388         a_conv.is_owned = false;
42389         LDKRouteHop b_conv;
42390         b_conv.inner = untag_ptr(b);
42391         b_conv.is_owned = ptr_is_owned(b);
42392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42393         b_conv.is_owned = false;
42394         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
42395         return ret_conv;
42396 }
42397
42398 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
42399         LDKRouteHop obj_conv;
42400         obj_conv.inner = untag_ptr(obj);
42401         obj_conv.is_owned = ptr_is_owned(obj);
42402         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42403         obj_conv.is_owned = false;
42404         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
42405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42407         CVec_u8Z_free(ret_var);
42408         return ret_arr;
42409 }
42410
42411 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
42412         LDKu8slice ser_ref;
42413         ser_ref.datalen = ser->arr_len;
42414         ser_ref.data = ser->elems;
42415         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
42416         *ret_conv = RouteHop_read(ser_ref);
42417         FREE(ser);
42418         return tag_ptr(ret_conv, true);
42419 }
42420
42421 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
42422         LDKRoute this_obj_conv;
42423         this_obj_conv.inner = untag_ptr(this_obj);
42424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42426         Route_free(this_obj_conv);
42427 }
42428
42429 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
42430         LDKRoute this_ptr_conv;
42431         this_ptr_conv.inner = untag_ptr(this_ptr);
42432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42434         this_ptr_conv.is_owned = false;
42435         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
42436         ptrArray ret_arr = NULL;
42437         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
42438         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
42439         for (size_t m = 0; m < ret_var.datalen; m++) {
42440                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
42441                 uint64_tArray ret_conv_12_arr = NULL;
42442                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
42443                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
42444                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
42445                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
42446                         uint64_t ret_conv_12_conv_10_ref = 0;
42447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
42448                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
42449                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
42450                 }
42451                 
42452                 FREE(ret_conv_12_var.data);
42453                 ret_arr_ptr[m] = ret_conv_12_arr;
42454         }
42455         
42456         FREE(ret_var.data);
42457         return ret_arr;
42458 }
42459
42460 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
42461         LDKRoute this_ptr_conv;
42462         this_ptr_conv.inner = untag_ptr(this_ptr);
42463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42465         this_ptr_conv.is_owned = false;
42466         LDKCVec_CVec_RouteHopZZ val_constr;
42467         val_constr.datalen = val->arr_len;
42468         if (val_constr.datalen > 0)
42469                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
42470         else
42471                 val_constr.data = NULL;
42472         uint64_tArray* val_vals = (void*) val->elems;
42473         for (size_t m = 0; m < val_constr.datalen; m++) {
42474                 uint64_tArray val_conv_12 = val_vals[m];
42475                 LDKCVec_RouteHopZ val_conv_12_constr;
42476                 val_conv_12_constr.datalen = val_conv_12->arr_len;
42477                 if (val_conv_12_constr.datalen > 0)
42478                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
42479                 else
42480                         val_conv_12_constr.data = NULL;
42481                 uint64_t* val_conv_12_vals = val_conv_12->elems;
42482                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
42483                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
42484                         LDKRouteHop val_conv_12_conv_10_conv;
42485                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
42486                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
42487                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
42488                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
42489                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
42490                 }
42491                 FREE(val_conv_12);
42492                 val_constr.data[m] = val_conv_12_constr;
42493         }
42494         FREE(val);
42495         Route_set_paths(&this_ptr_conv, val_constr);
42496 }
42497
42498 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
42499         LDKRoute this_ptr_conv;
42500         this_ptr_conv.inner = untag_ptr(this_ptr);
42501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42503         this_ptr_conv.is_owned = false;
42504         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
42505         uint64_t ret_ref = 0;
42506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42508         return ret_ref;
42509 }
42510
42511 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
42512         LDKRoute this_ptr_conv;
42513         this_ptr_conv.inner = untag_ptr(this_ptr);
42514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42516         this_ptr_conv.is_owned = false;
42517         LDKPaymentParameters val_conv;
42518         val_conv.inner = untag_ptr(val);
42519         val_conv.is_owned = ptr_is_owned(val);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42521         val_conv = PaymentParameters_clone(&val_conv);
42522         Route_set_payment_params(&this_ptr_conv, val_conv);
42523 }
42524
42525 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
42526         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
42527         paths_arg_constr.datalen = paths_arg->arr_len;
42528         if (paths_arg_constr.datalen > 0)
42529                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
42530         else
42531                 paths_arg_constr.data = NULL;
42532         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
42533         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
42534                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
42535                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
42536                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
42537                 if (paths_arg_conv_12_constr.datalen > 0)
42538                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
42539                 else
42540                         paths_arg_conv_12_constr.data = NULL;
42541                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
42542                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
42543                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
42544                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
42545                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
42546                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
42547                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
42548                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
42549                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
42550                 }
42551                 FREE(paths_arg_conv_12);
42552                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
42553         }
42554         FREE(paths_arg);
42555         LDKPaymentParameters payment_params_arg_conv;
42556         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
42557         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
42558         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
42559         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
42560         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
42561         uint64_t ret_ref = 0;
42562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42564         return ret_ref;
42565 }
42566
42567 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
42568         LDKRoute ret_var = Route_clone(arg);
42569         uint64_t ret_ref = 0;
42570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42572         return ret_ref;
42573 }
42574 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
42575         LDKRoute arg_conv;
42576         arg_conv.inner = untag_ptr(arg);
42577         arg_conv.is_owned = ptr_is_owned(arg);
42578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42579         arg_conv.is_owned = false;
42580         int64_t ret_conv = Route_clone_ptr(&arg_conv);
42581         return ret_conv;
42582 }
42583
42584 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
42585         LDKRoute orig_conv;
42586         orig_conv.inner = untag_ptr(orig);
42587         orig_conv.is_owned = ptr_is_owned(orig);
42588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42589         orig_conv.is_owned = false;
42590         LDKRoute ret_var = Route_clone(&orig_conv);
42591         uint64_t ret_ref = 0;
42592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42594         return ret_ref;
42595 }
42596
42597 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
42598         LDKRoute o_conv;
42599         o_conv.inner = untag_ptr(o);
42600         o_conv.is_owned = ptr_is_owned(o);
42601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42602         o_conv.is_owned = false;
42603         int64_t ret_conv = Route_hash(&o_conv);
42604         return ret_conv;
42605 }
42606
42607 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
42608         LDKRoute a_conv;
42609         a_conv.inner = untag_ptr(a);
42610         a_conv.is_owned = ptr_is_owned(a);
42611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42612         a_conv.is_owned = false;
42613         LDKRoute b_conv;
42614         b_conv.inner = untag_ptr(b);
42615         b_conv.is_owned = ptr_is_owned(b);
42616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42617         b_conv.is_owned = false;
42618         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
42619         return ret_conv;
42620 }
42621
42622 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
42623         LDKRoute this_arg_conv;
42624         this_arg_conv.inner = untag_ptr(this_arg);
42625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42627         this_arg_conv.is_owned = false;
42628         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
42629         return ret_conv;
42630 }
42631
42632 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
42633         LDKRoute this_arg_conv;
42634         this_arg_conv.inner = untag_ptr(this_arg);
42635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42637         this_arg_conv.is_owned = false;
42638         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
42639         return ret_conv;
42640 }
42641
42642 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
42643         LDKRoute obj_conv;
42644         obj_conv.inner = untag_ptr(obj);
42645         obj_conv.is_owned = ptr_is_owned(obj);
42646         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42647         obj_conv.is_owned = false;
42648         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
42649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42651         CVec_u8Z_free(ret_var);
42652         return ret_arr;
42653 }
42654
42655 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
42656         LDKu8slice ser_ref;
42657         ser_ref.datalen = ser->arr_len;
42658         ser_ref.data = ser->elems;
42659         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
42660         *ret_conv = Route_read(ser_ref);
42661         FREE(ser);
42662         return tag_ptr(ret_conv, true);
42663 }
42664
42665 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
42666         LDKRouteParameters this_obj_conv;
42667         this_obj_conv.inner = untag_ptr(this_obj);
42668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42670         RouteParameters_free(this_obj_conv);
42671 }
42672
42673 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
42674         LDKRouteParameters this_ptr_conv;
42675         this_ptr_conv.inner = untag_ptr(this_ptr);
42676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42678         this_ptr_conv.is_owned = false;
42679         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
42680         uint64_t ret_ref = 0;
42681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42683         return ret_ref;
42684 }
42685
42686 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
42687         LDKRouteParameters this_ptr_conv;
42688         this_ptr_conv.inner = untag_ptr(this_ptr);
42689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42691         this_ptr_conv.is_owned = false;
42692         LDKPaymentParameters val_conv;
42693         val_conv.inner = untag_ptr(val);
42694         val_conv.is_owned = ptr_is_owned(val);
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42696         val_conv = PaymentParameters_clone(&val_conv);
42697         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
42698 }
42699
42700 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
42701         LDKRouteParameters this_ptr_conv;
42702         this_ptr_conv.inner = untag_ptr(this_ptr);
42703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42705         this_ptr_conv.is_owned = false;
42706         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
42707         return ret_conv;
42708 }
42709
42710 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
42711         LDKRouteParameters this_ptr_conv;
42712         this_ptr_conv.inner = untag_ptr(this_ptr);
42713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42715         this_ptr_conv.is_owned = false;
42716         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
42717 }
42718
42719 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
42720         LDKRouteParameters this_ptr_conv;
42721         this_ptr_conv.inner = untag_ptr(this_ptr);
42722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42724         this_ptr_conv.is_owned = false;
42725         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
42726         return ret_conv;
42727 }
42728
42729 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) {
42730         LDKRouteParameters this_ptr_conv;
42731         this_ptr_conv.inner = untag_ptr(this_ptr);
42732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42734         this_ptr_conv.is_owned = false;
42735         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
42736 }
42737
42738 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) {
42739         LDKPaymentParameters payment_params_arg_conv;
42740         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
42741         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
42743         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
42744         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
42745         uint64_t ret_ref = 0;
42746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42748         return ret_ref;
42749 }
42750
42751 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
42752         LDKRouteParameters ret_var = RouteParameters_clone(arg);
42753         uint64_t ret_ref = 0;
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42756         return ret_ref;
42757 }
42758 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
42759         LDKRouteParameters arg_conv;
42760         arg_conv.inner = untag_ptr(arg);
42761         arg_conv.is_owned = ptr_is_owned(arg);
42762         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42763         arg_conv.is_owned = false;
42764         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
42765         return ret_conv;
42766 }
42767
42768 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
42769         LDKRouteParameters orig_conv;
42770         orig_conv.inner = untag_ptr(orig);
42771         orig_conv.is_owned = ptr_is_owned(orig);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42773         orig_conv.is_owned = false;
42774         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
42775         uint64_t ret_ref = 0;
42776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42778         return ret_ref;
42779 }
42780
42781 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
42782         LDKRouteParameters obj_conv;
42783         obj_conv.inner = untag_ptr(obj);
42784         obj_conv.is_owned = ptr_is_owned(obj);
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42786         obj_conv.is_owned = false;
42787         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
42788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42790         CVec_u8Z_free(ret_var);
42791         return ret_arr;
42792 }
42793
42794 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
42795         LDKu8slice ser_ref;
42796         ser_ref.datalen = ser->arr_len;
42797         ser_ref.data = ser->elems;
42798         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
42799         *ret_conv = RouteParameters_read(ser_ref);
42800         FREE(ser);
42801         return tag_ptr(ret_conv, true);
42802 }
42803
42804 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
42805         LDKPaymentParameters this_obj_conv;
42806         this_obj_conv.inner = untag_ptr(this_obj);
42807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42809         PaymentParameters_free(this_obj_conv);
42810 }
42811
42812 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
42813         LDKPaymentParameters this_ptr_conv;
42814         this_ptr_conv.inner = untag_ptr(this_ptr);
42815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42817         this_ptr_conv.is_owned = false;
42818         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42819         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
42820         return ret_arr;
42821 }
42822
42823 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
42824         LDKPaymentParameters this_ptr_conv;
42825         this_ptr_conv.inner = untag_ptr(this_ptr);
42826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42828         this_ptr_conv.is_owned = false;
42829         LDKPublicKey val_ref;
42830         CHECK(val->arr_len == 33);
42831         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42832         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
42833 }
42834
42835 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
42836         LDKPaymentParameters this_ptr_conv;
42837         this_ptr_conv.inner = untag_ptr(this_ptr);
42838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42840         this_ptr_conv.is_owned = false;
42841         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
42842         uint64_t ret_ref = 0;
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42845         return ret_ref;
42846 }
42847
42848 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
42849         LDKPaymentParameters this_ptr_conv;
42850         this_ptr_conv.inner = untag_ptr(this_ptr);
42851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42853         this_ptr_conv.is_owned = false;
42854         LDKInvoiceFeatures val_conv;
42855         val_conv.inner = untag_ptr(val);
42856         val_conv.is_owned = ptr_is_owned(val);
42857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42858         val_conv = InvoiceFeatures_clone(&val_conv);
42859         PaymentParameters_set_features(&this_ptr_conv, val_conv);
42860 }
42861
42862 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
42863         LDKPaymentParameters this_ptr_conv;
42864         this_ptr_conv.inner = untag_ptr(this_ptr);
42865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42867         this_ptr_conv.is_owned = false;
42868         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
42869         uint64_tArray ret_arr = NULL;
42870         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42871         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42872         for (size_t l = 0; l < ret_var.datalen; l++) {
42873                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
42874                 uint64_t ret_conv_11_ref = 0;
42875                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
42876                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
42877                 ret_arr_ptr[l] = ret_conv_11_ref;
42878         }
42879         
42880         FREE(ret_var.data);
42881         return ret_arr;
42882 }
42883
42884 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
42885         LDKPaymentParameters this_ptr_conv;
42886         this_ptr_conv.inner = untag_ptr(this_ptr);
42887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42889         this_ptr_conv.is_owned = false;
42890         LDKCVec_RouteHintZ val_constr;
42891         val_constr.datalen = val->arr_len;
42892         if (val_constr.datalen > 0)
42893                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42894         else
42895                 val_constr.data = NULL;
42896         uint64_t* val_vals = val->elems;
42897         for (size_t l = 0; l < val_constr.datalen; l++) {
42898                 uint64_t val_conv_11 = val_vals[l];
42899                 LDKRouteHint val_conv_11_conv;
42900                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
42901                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
42902                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
42903                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
42904                 val_constr.data[l] = val_conv_11_conv;
42905         }
42906         FREE(val);
42907         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
42908 }
42909
42910 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
42911         LDKPaymentParameters this_ptr_conv;
42912         this_ptr_conv.inner = untag_ptr(this_ptr);
42913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42915         this_ptr_conv.is_owned = false;
42916         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42917         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
42918         uint64_t ret_ref = tag_ptr(ret_copy, true);
42919         return ret_ref;
42920 }
42921
42922 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
42923         LDKPaymentParameters this_ptr_conv;
42924         this_ptr_conv.inner = untag_ptr(this_ptr);
42925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42927         this_ptr_conv.is_owned = false;
42928         void* val_ptr = untag_ptr(val);
42929         CHECK_ACCESS(val_ptr);
42930         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42931         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42932         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
42933 }
42934
42935 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) {
42936         LDKPaymentParameters this_ptr_conv;
42937         this_ptr_conv.inner = untag_ptr(this_ptr);
42938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42940         this_ptr_conv.is_owned = false;
42941         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
42942         return ret_conv;
42943 }
42944
42945 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) {
42946         LDKPaymentParameters this_ptr_conv;
42947         this_ptr_conv.inner = untag_ptr(this_ptr);
42948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42950         this_ptr_conv.is_owned = false;
42951         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
42952 }
42953
42954 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
42955         LDKPaymentParameters this_ptr_conv;
42956         this_ptr_conv.inner = untag_ptr(this_ptr);
42957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42959         this_ptr_conv.is_owned = false;
42960         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
42961         return ret_conv;
42962 }
42963
42964 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
42965         LDKPaymentParameters this_ptr_conv;
42966         this_ptr_conv.inner = untag_ptr(this_ptr);
42967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42969         this_ptr_conv.is_owned = false;
42970         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
42971 }
42972
42973 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) {
42974         LDKPaymentParameters this_ptr_conv;
42975         this_ptr_conv.inner = untag_ptr(this_ptr);
42976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42978         this_ptr_conv.is_owned = false;
42979         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
42980         return ret_conv;
42981 }
42982
42983 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) {
42984         LDKPaymentParameters this_ptr_conv;
42985         this_ptr_conv.inner = untag_ptr(this_ptr);
42986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42988         this_ptr_conv.is_owned = false;
42989         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
42990 }
42991
42992 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
42993         LDKPaymentParameters this_ptr_conv;
42994         this_ptr_conv.inner = untag_ptr(this_ptr);
42995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42997         this_ptr_conv.is_owned = false;
42998         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
42999         int64_tArray ret_arr = NULL;
43000         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
43001         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43002         for (size_t i = 0; i < ret_var.datalen; i++) {
43003                 int64_t ret_conv_8_conv = ret_var.data[i];
43004                 ret_arr_ptr[i] = ret_conv_8_conv;
43005         }
43006         
43007         FREE(ret_var.data);
43008         return ret_arr;
43009 }
43010
43011 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
43012         LDKPaymentParameters this_ptr_conv;
43013         this_ptr_conv.inner = untag_ptr(this_ptr);
43014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43016         this_ptr_conv.is_owned = false;
43017         LDKCVec_u64Z val_constr;
43018         val_constr.datalen = val->arr_len;
43019         if (val_constr.datalen > 0)
43020                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43021         else
43022                 val_constr.data = NULL;
43023         int64_t* val_vals = val->elems;
43024         for (size_t i = 0; i < val_constr.datalen; i++) {
43025                 int64_t val_conv_8 = val_vals[i];
43026                 val_constr.data[i] = val_conv_8;
43027         }
43028         FREE(val);
43029         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
43030 }
43031
43032 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) {
43033         LDKPublicKey payee_pubkey_arg_ref;
43034         CHECK(payee_pubkey_arg->arr_len == 33);
43035         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
43036         LDKInvoiceFeatures features_arg_conv;
43037         features_arg_conv.inner = untag_ptr(features_arg);
43038         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43039         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43040         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
43041         LDKCVec_RouteHintZ route_hints_arg_constr;
43042         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
43043         if (route_hints_arg_constr.datalen > 0)
43044                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
43045         else
43046                 route_hints_arg_constr.data = NULL;
43047         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
43048         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
43049                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
43050                 LDKRouteHint route_hints_arg_conv_11_conv;
43051                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
43052                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
43053                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
43054                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
43055                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
43056         }
43057         FREE(route_hints_arg);
43058         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
43059         CHECK_ACCESS(expiry_time_arg_ptr);
43060         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
43061         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
43062         LDKCVec_u64Z previously_failed_channels_arg_constr;
43063         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
43064         if (previously_failed_channels_arg_constr.datalen > 0)
43065                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43066         else
43067                 previously_failed_channels_arg_constr.data = NULL;
43068         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
43069         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
43070                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
43071                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
43072         }
43073         FREE(previously_failed_channels_arg);
43074         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);
43075         uint64_t ret_ref = 0;
43076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43078         return ret_ref;
43079 }
43080
43081 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
43082         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
43083         uint64_t ret_ref = 0;
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43086         return ret_ref;
43087 }
43088 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
43089         LDKPaymentParameters arg_conv;
43090         arg_conv.inner = untag_ptr(arg);
43091         arg_conv.is_owned = ptr_is_owned(arg);
43092         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43093         arg_conv.is_owned = false;
43094         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
43095         return ret_conv;
43096 }
43097
43098 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
43099         LDKPaymentParameters orig_conv;
43100         orig_conv.inner = untag_ptr(orig);
43101         orig_conv.is_owned = ptr_is_owned(orig);
43102         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43103         orig_conv.is_owned = false;
43104         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
43105         uint64_t ret_ref = 0;
43106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43108         return ret_ref;
43109 }
43110
43111 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
43112         LDKPaymentParameters o_conv;
43113         o_conv.inner = untag_ptr(o);
43114         o_conv.is_owned = ptr_is_owned(o);
43115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43116         o_conv.is_owned = false;
43117         int64_t ret_conv = PaymentParameters_hash(&o_conv);
43118         return ret_conv;
43119 }
43120
43121 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
43122         LDKPaymentParameters a_conv;
43123         a_conv.inner = untag_ptr(a);
43124         a_conv.is_owned = ptr_is_owned(a);
43125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43126         a_conv.is_owned = false;
43127         LDKPaymentParameters b_conv;
43128         b_conv.inner = untag_ptr(b);
43129         b_conv.is_owned = ptr_is_owned(b);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43131         b_conv.is_owned = false;
43132         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
43133         return ret_conv;
43134 }
43135
43136 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
43137         LDKPaymentParameters obj_conv;
43138         obj_conv.inner = untag_ptr(obj);
43139         obj_conv.is_owned = ptr_is_owned(obj);
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43141         obj_conv.is_owned = false;
43142         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
43143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43145         CVec_u8Z_free(ret_var);
43146         return ret_arr;
43147 }
43148
43149 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
43150         LDKu8slice ser_ref;
43151         ser_ref.datalen = ser->arr_len;
43152         ser_ref.data = ser->elems;
43153         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
43154         *ret_conv = PaymentParameters_read(ser_ref);
43155         FREE(ser);
43156         return tag_ptr(ret_conv, true);
43157 }
43158
43159 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
43160         LDKPublicKey payee_pubkey_ref;
43161         CHECK(payee_pubkey->arr_len == 33);
43162         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
43163         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
43164         uint64_t ret_ref = 0;
43165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43167         return ret_ref;
43168 }
43169
43170 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
43171         LDKPublicKey payee_pubkey_ref;
43172         CHECK(payee_pubkey->arr_len == 33);
43173         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
43174         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
43175         uint64_t ret_ref = 0;
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43178         return ret_ref;
43179 }
43180
43181 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
43182         LDKRouteHint this_obj_conv;
43183         this_obj_conv.inner = untag_ptr(this_obj);
43184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43186         RouteHint_free(this_obj_conv);
43187 }
43188
43189 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
43190         LDKRouteHint this_ptr_conv;
43191         this_ptr_conv.inner = untag_ptr(this_ptr);
43192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43194         this_ptr_conv.is_owned = false;
43195         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
43196         uint64_tArray ret_arr = NULL;
43197         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43198         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43199         for (size_t o = 0; o < ret_var.datalen; o++) {
43200                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
43201                 uint64_t ret_conv_14_ref = 0;
43202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
43203                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
43204                 ret_arr_ptr[o] = ret_conv_14_ref;
43205         }
43206         
43207         FREE(ret_var.data);
43208         return ret_arr;
43209 }
43210
43211 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
43212         LDKRouteHint this_ptr_conv;
43213         this_ptr_conv.inner = untag_ptr(this_ptr);
43214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43216         this_ptr_conv.is_owned = false;
43217         LDKCVec_RouteHintHopZ val_constr;
43218         val_constr.datalen = val->arr_len;
43219         if (val_constr.datalen > 0)
43220                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
43221         else
43222                 val_constr.data = NULL;
43223         uint64_t* val_vals = val->elems;
43224         for (size_t o = 0; o < val_constr.datalen; o++) {
43225                 uint64_t val_conv_14 = val_vals[o];
43226                 LDKRouteHintHop val_conv_14_conv;
43227                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
43228                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
43229                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
43230                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
43231                 val_constr.data[o] = val_conv_14_conv;
43232         }
43233         FREE(val);
43234         RouteHint_set_a(&this_ptr_conv, val_constr);
43235 }
43236
43237 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
43238         LDKCVec_RouteHintHopZ a_arg_constr;
43239         a_arg_constr.datalen = a_arg->arr_len;
43240         if (a_arg_constr.datalen > 0)
43241                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
43242         else
43243                 a_arg_constr.data = NULL;
43244         uint64_t* a_arg_vals = a_arg->elems;
43245         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
43246                 uint64_t a_arg_conv_14 = a_arg_vals[o];
43247                 LDKRouteHintHop a_arg_conv_14_conv;
43248                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
43249                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
43250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
43251                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
43252                 a_arg_constr.data[o] = a_arg_conv_14_conv;
43253         }
43254         FREE(a_arg);
43255         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
43256         uint64_t ret_ref = 0;
43257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43259         return ret_ref;
43260 }
43261
43262 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
43263         LDKRouteHint ret_var = RouteHint_clone(arg);
43264         uint64_t ret_ref = 0;
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43267         return ret_ref;
43268 }
43269 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
43270         LDKRouteHint arg_conv;
43271         arg_conv.inner = untag_ptr(arg);
43272         arg_conv.is_owned = ptr_is_owned(arg);
43273         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43274         arg_conv.is_owned = false;
43275         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
43276         return ret_conv;
43277 }
43278
43279 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
43280         LDKRouteHint orig_conv;
43281         orig_conv.inner = untag_ptr(orig);
43282         orig_conv.is_owned = ptr_is_owned(orig);
43283         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43284         orig_conv.is_owned = false;
43285         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
43286         uint64_t ret_ref = 0;
43287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43289         return ret_ref;
43290 }
43291
43292 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
43293         LDKRouteHint o_conv;
43294         o_conv.inner = untag_ptr(o);
43295         o_conv.is_owned = ptr_is_owned(o);
43296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43297         o_conv.is_owned = false;
43298         int64_t ret_conv = RouteHint_hash(&o_conv);
43299         return ret_conv;
43300 }
43301
43302 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
43303         LDKRouteHint a_conv;
43304         a_conv.inner = untag_ptr(a);
43305         a_conv.is_owned = ptr_is_owned(a);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43307         a_conv.is_owned = false;
43308         LDKRouteHint b_conv;
43309         b_conv.inner = untag_ptr(b);
43310         b_conv.is_owned = ptr_is_owned(b);
43311         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43312         b_conv.is_owned = false;
43313         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
43314         return ret_conv;
43315 }
43316
43317 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
43318         LDKRouteHint obj_conv;
43319         obj_conv.inner = untag_ptr(obj);
43320         obj_conv.is_owned = ptr_is_owned(obj);
43321         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43322         obj_conv.is_owned = false;
43323         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
43324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43326         CVec_u8Z_free(ret_var);
43327         return ret_arr;
43328 }
43329
43330 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
43331         LDKu8slice ser_ref;
43332         ser_ref.datalen = ser->arr_len;
43333         ser_ref.data = ser->elems;
43334         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
43335         *ret_conv = RouteHint_read(ser_ref);
43336         FREE(ser);
43337         return tag_ptr(ret_conv, true);
43338 }
43339
43340 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
43341         LDKRouteHintHop this_obj_conv;
43342         this_obj_conv.inner = untag_ptr(this_obj);
43343         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43345         RouteHintHop_free(this_obj_conv);
43346 }
43347
43348 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
43349         LDKRouteHintHop this_ptr_conv;
43350         this_ptr_conv.inner = untag_ptr(this_ptr);
43351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43353         this_ptr_conv.is_owned = false;
43354         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43355         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
43356         return ret_arr;
43357 }
43358
43359 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
43360         LDKRouteHintHop this_ptr_conv;
43361         this_ptr_conv.inner = untag_ptr(this_ptr);
43362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43364         this_ptr_conv.is_owned = false;
43365         LDKPublicKey val_ref;
43366         CHECK(val->arr_len == 33);
43367         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43368         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
43369 }
43370
43371 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
43372         LDKRouteHintHop this_ptr_conv;
43373         this_ptr_conv.inner = untag_ptr(this_ptr);
43374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43376         this_ptr_conv.is_owned = false;
43377         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
43378         return ret_conv;
43379 }
43380
43381 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43382         LDKRouteHintHop this_ptr_conv;
43383         this_ptr_conv.inner = untag_ptr(this_ptr);
43384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43386         this_ptr_conv.is_owned = false;
43387         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
43388 }
43389
43390 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
43391         LDKRouteHintHop this_ptr_conv;
43392         this_ptr_conv.inner = untag_ptr(this_ptr);
43393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43395         this_ptr_conv.is_owned = false;
43396         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
43397         uint64_t ret_ref = 0;
43398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43400         return ret_ref;
43401 }
43402
43403 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
43404         LDKRouteHintHop this_ptr_conv;
43405         this_ptr_conv.inner = untag_ptr(this_ptr);
43406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43408         this_ptr_conv.is_owned = false;
43409         LDKRoutingFees val_conv;
43410         val_conv.inner = untag_ptr(val);
43411         val_conv.is_owned = ptr_is_owned(val);
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43413         val_conv = RoutingFees_clone(&val_conv);
43414         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
43415 }
43416
43417 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
43418         LDKRouteHintHop this_ptr_conv;
43419         this_ptr_conv.inner = untag_ptr(this_ptr);
43420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43422         this_ptr_conv.is_owned = false;
43423         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
43424         return ret_conv;
43425 }
43426
43427 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
43428         LDKRouteHintHop this_ptr_conv;
43429         this_ptr_conv.inner = untag_ptr(this_ptr);
43430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43432         this_ptr_conv.is_owned = false;
43433         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43434 }
43435
43436 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
43437         LDKRouteHintHop this_ptr_conv;
43438         this_ptr_conv.inner = untag_ptr(this_ptr);
43439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43441         this_ptr_conv.is_owned = false;
43442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43443         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
43444         uint64_t ret_ref = tag_ptr(ret_copy, true);
43445         return ret_ref;
43446 }
43447
43448 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
43449         LDKRouteHintHop this_ptr_conv;
43450         this_ptr_conv.inner = untag_ptr(this_ptr);
43451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43453         this_ptr_conv.is_owned = false;
43454         void* val_ptr = untag_ptr(val);
43455         CHECK_ACCESS(val_ptr);
43456         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43457         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43458         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
43459 }
43460
43461 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
43462         LDKRouteHintHop this_ptr_conv;
43463         this_ptr_conv.inner = untag_ptr(this_ptr);
43464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43466         this_ptr_conv.is_owned = false;
43467         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43468         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
43469         uint64_t ret_ref = tag_ptr(ret_copy, true);
43470         return ret_ref;
43471 }
43472
43473 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
43474         LDKRouteHintHop this_ptr_conv;
43475         this_ptr_conv.inner = untag_ptr(this_ptr);
43476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43478         this_ptr_conv.is_owned = false;
43479         void* val_ptr = untag_ptr(val);
43480         CHECK_ACCESS(val_ptr);
43481         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43482         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43483         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
43484 }
43485
43486 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) {
43487         LDKPublicKey src_node_id_arg_ref;
43488         CHECK(src_node_id_arg->arr_len == 33);
43489         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
43490         LDKRoutingFees fees_arg_conv;
43491         fees_arg_conv.inner = untag_ptr(fees_arg);
43492         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
43493         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43494         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43495         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
43496         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
43497         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
43498         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
43499         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
43500         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
43501         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
43502         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
43503         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);
43504         uint64_t ret_ref = 0;
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43507         return ret_ref;
43508 }
43509
43510 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
43511         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
43512         uint64_t ret_ref = 0;
43513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43515         return ret_ref;
43516 }
43517 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
43518         LDKRouteHintHop arg_conv;
43519         arg_conv.inner = untag_ptr(arg);
43520         arg_conv.is_owned = ptr_is_owned(arg);
43521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43522         arg_conv.is_owned = false;
43523         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
43524         return ret_conv;
43525 }
43526
43527 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
43528         LDKRouteHintHop orig_conv;
43529         orig_conv.inner = untag_ptr(orig);
43530         orig_conv.is_owned = ptr_is_owned(orig);
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43532         orig_conv.is_owned = false;
43533         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
43534         uint64_t ret_ref = 0;
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43537         return ret_ref;
43538 }
43539
43540 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
43541         LDKRouteHintHop o_conv;
43542         o_conv.inner = untag_ptr(o);
43543         o_conv.is_owned = ptr_is_owned(o);
43544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43545         o_conv.is_owned = false;
43546         int64_t ret_conv = RouteHintHop_hash(&o_conv);
43547         return ret_conv;
43548 }
43549
43550 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
43551         LDKRouteHintHop a_conv;
43552         a_conv.inner = untag_ptr(a);
43553         a_conv.is_owned = ptr_is_owned(a);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43555         a_conv.is_owned = false;
43556         LDKRouteHintHop b_conv;
43557         b_conv.inner = untag_ptr(b);
43558         b_conv.is_owned = ptr_is_owned(b);
43559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43560         b_conv.is_owned = false;
43561         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
43562         return ret_conv;
43563 }
43564
43565 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
43566         LDKRouteHintHop obj_conv;
43567         obj_conv.inner = untag_ptr(obj);
43568         obj_conv.is_owned = ptr_is_owned(obj);
43569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43570         obj_conv.is_owned = false;
43571         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
43572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43574         CVec_u8Z_free(ret_var);
43575         return ret_arr;
43576 }
43577
43578 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
43579         LDKu8slice ser_ref;
43580         ser_ref.datalen = ser->arr_len;
43581         ser_ref.data = ser->elems;
43582         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
43583         *ret_conv = RouteHintHop_read(ser_ref);
43584         FREE(ser);
43585         return tag_ptr(ret_conv, true);
43586 }
43587
43588 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) {
43589         LDKPublicKey our_node_pubkey_ref;
43590         CHECK(our_node_pubkey->arr_len == 33);
43591         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
43592         LDKRouteParameters route_params_conv;
43593         route_params_conv.inner = untag_ptr(route_params);
43594         route_params_conv.is_owned = ptr_is_owned(route_params);
43595         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43596         route_params_conv.is_owned = false;
43597         LDKNetworkGraph network_graph_conv;
43598         network_graph_conv.inner = untag_ptr(network_graph);
43599         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43600         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43601         network_graph_conv.is_owned = false;
43602         LDKCVec_ChannelDetailsZ first_hops_constr;
43603         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
43604         if (first_hops != 0) {
43605                 first_hops_constr.datalen = first_hops->arr_len;
43606                 if (first_hops_constr.datalen > 0)
43607                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43608                 else
43609                         first_hops_constr.data = NULL;
43610                 uint64_t* first_hops_vals = first_hops->elems;
43611                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
43612                         uint64_t first_hops_conv_16 = first_hops_vals[q];
43613                         LDKChannelDetails first_hops_conv_16_conv;
43614                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
43615                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
43616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
43617                         first_hops_conv_16_conv.is_owned = false;
43618                         first_hops_constr.data[q] = first_hops_conv_16_conv;
43619                 }
43620                 FREE(first_hops);
43621                 first_hops_ptr = &first_hops_constr;
43622         }
43623         void* logger_ptr = untag_ptr(logger);
43624         CHECK_ACCESS(logger_ptr);
43625         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43626         if (logger_conv.free == LDKLogger_JCalls_free) {
43627                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43628                 LDKLogger_JCalls_cloned(&logger_conv);
43629         }
43630         void* scorer_ptr = untag_ptr(scorer);
43631         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
43632         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
43633         unsigned char random_seed_bytes_arr[32];
43634         CHECK(random_seed_bytes->arr_len == 32);
43635         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43636         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
43637         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
43638         *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);
43639         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
43640         return tag_ptr(ret_conv, true);
43641 }
43642
43643 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) {
43644         LDKPublicKey our_node_pubkey_ref;
43645         CHECK(our_node_pubkey->arr_len == 33);
43646         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
43647         LDKCVec_PublicKeyZ hops_constr;
43648         hops_constr.datalen = hops->arr_len;
43649         if (hops_constr.datalen > 0)
43650                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43651         else
43652                 hops_constr.data = NULL;
43653         int8_tArray* hops_vals = (void*) hops->elems;
43654         for (size_t m = 0; m < hops_constr.datalen; m++) {
43655                 int8_tArray hops_conv_12 = hops_vals[m];
43656                 LDKPublicKey hops_conv_12_ref;
43657                 CHECK(hops_conv_12->arr_len == 33);
43658                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
43659                 hops_constr.data[m] = hops_conv_12_ref;
43660         }
43661         FREE(hops);
43662         LDKRouteParameters route_params_conv;
43663         route_params_conv.inner = untag_ptr(route_params);
43664         route_params_conv.is_owned = ptr_is_owned(route_params);
43665         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43666         route_params_conv.is_owned = false;
43667         LDKNetworkGraph network_graph_conv;
43668         network_graph_conv.inner = untag_ptr(network_graph);
43669         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43670         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43671         network_graph_conv.is_owned = false;
43672         void* logger_ptr = untag_ptr(logger);
43673         CHECK_ACCESS(logger_ptr);
43674         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43675         if (logger_conv.free == LDKLogger_JCalls_free) {
43676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43677                 LDKLogger_JCalls_cloned(&logger_conv);
43678         }
43679         unsigned char random_seed_bytes_arr[32];
43680         CHECK(random_seed_bytes->arr_len == 32);
43681         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43682         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
43683         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
43684         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
43685         return tag_ptr(ret_conv, true);
43686 }
43687
43688 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
43689         if (!ptr_is_owned(this_ptr)) return;
43690         void* this_ptr_ptr = untag_ptr(this_ptr);
43691         CHECK_ACCESS(this_ptr_ptr);
43692         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
43693         FREE(untag_ptr(this_ptr));
43694         Score_free(this_ptr_conv);
43695 }
43696
43697 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
43698         if (!ptr_is_owned(this_ptr)) return;
43699         void* this_ptr_ptr = untag_ptr(this_ptr);
43700         CHECK_ACCESS(this_ptr_ptr);
43701         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
43702         FREE(untag_ptr(this_ptr));
43703         LockableScore_free(this_ptr_conv);
43704 }
43705
43706 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
43707         if (!ptr_is_owned(this_ptr)) return;
43708         void* this_ptr_ptr = untag_ptr(this_ptr);
43709         CHECK_ACCESS(this_ptr_ptr);
43710         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
43711         FREE(untag_ptr(this_ptr));
43712         WriteableScore_free(this_ptr_conv);
43713 }
43714
43715 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
43716         LDKMultiThreadedLockableScore this_obj_conv;
43717         this_obj_conv.inner = untag_ptr(this_obj);
43718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43720         MultiThreadedLockableScore_free(this_obj_conv);
43721 }
43722
43723 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
43724         LDKMultiThreadedScoreLock this_obj_conv;
43725         this_obj_conv.inner = untag_ptr(this_obj);
43726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43728         MultiThreadedScoreLock_free(this_obj_conv);
43729 }
43730
43731 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
43732         LDKMultiThreadedScoreLock this_arg_conv;
43733         this_arg_conv.inner = untag_ptr(this_arg);
43734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43736         this_arg_conv.is_owned = false;
43737         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43738         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
43739         return tag_ptr(ret_ret, true);
43740 }
43741
43742 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
43743         LDKMultiThreadedScoreLock obj_conv;
43744         obj_conv.inner = untag_ptr(obj);
43745         obj_conv.is_owned = ptr_is_owned(obj);
43746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43747         obj_conv.is_owned = false;
43748         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
43749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43751         CVec_u8Z_free(ret_var);
43752         return ret_arr;
43753 }
43754
43755 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
43756         LDKMultiThreadedLockableScore this_arg_conv;
43757         this_arg_conv.inner = untag_ptr(this_arg);
43758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43760         this_arg_conv.is_owned = false;
43761         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
43762         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
43763         return tag_ptr(ret_ret, true);
43764 }
43765
43766 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
43767         LDKMultiThreadedLockableScore obj_conv;
43768         obj_conv.inner = untag_ptr(obj);
43769         obj_conv.is_owned = ptr_is_owned(obj);
43770         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43771         obj_conv.is_owned = false;
43772         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
43773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43775         CVec_u8Z_free(ret_var);
43776         return ret_arr;
43777 }
43778
43779 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
43780         LDKMultiThreadedLockableScore this_arg_conv;
43781         this_arg_conv.inner = untag_ptr(this_arg);
43782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43784         this_arg_conv.is_owned = false;
43785         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
43786         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
43787         return tag_ptr(ret_ret, true);
43788 }
43789
43790 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
43791         void* score_ptr = untag_ptr(score);
43792         CHECK_ACCESS(score_ptr);
43793         LDKScore score_conv = *(LDKScore*)(score_ptr);
43794         if (score_conv.free == LDKScore_JCalls_free) {
43795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43796                 LDKScore_JCalls_cloned(&score_conv);
43797         }
43798         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
43799         uint64_t ret_ref = 0;
43800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43802         return ret_ref;
43803 }
43804
43805 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
43806         LDKChannelUsage this_obj_conv;
43807         this_obj_conv.inner = untag_ptr(this_obj);
43808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43810         ChannelUsage_free(this_obj_conv);
43811 }
43812
43813 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
43814         LDKChannelUsage this_ptr_conv;
43815         this_ptr_conv.inner = untag_ptr(this_ptr);
43816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43818         this_ptr_conv.is_owned = false;
43819         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
43820         return ret_conv;
43821 }
43822
43823 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
43824         LDKChannelUsage this_ptr_conv;
43825         this_ptr_conv.inner = untag_ptr(this_ptr);
43826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43828         this_ptr_conv.is_owned = false;
43829         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
43830 }
43831
43832 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
43833         LDKChannelUsage this_ptr_conv;
43834         this_ptr_conv.inner = untag_ptr(this_ptr);
43835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43837         this_ptr_conv.is_owned = false;
43838         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
43839         return ret_conv;
43840 }
43841
43842 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
43843         LDKChannelUsage this_ptr_conv;
43844         this_ptr_conv.inner = untag_ptr(this_ptr);
43845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43847         this_ptr_conv.is_owned = false;
43848         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
43849 }
43850
43851 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
43852         LDKChannelUsage this_ptr_conv;
43853         this_ptr_conv.inner = untag_ptr(this_ptr);
43854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43856         this_ptr_conv.is_owned = false;
43857         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
43858         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
43859         uint64_t ret_ref = tag_ptr(ret_copy, true);
43860         return ret_ref;
43861 }
43862
43863 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
43864         LDKChannelUsage this_ptr_conv;
43865         this_ptr_conv.inner = untag_ptr(this_ptr);
43866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43868         this_ptr_conv.is_owned = false;
43869         void* val_ptr = untag_ptr(val);
43870         CHECK_ACCESS(val_ptr);
43871         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
43872         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
43873         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
43874 }
43875
43876 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) {
43877         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
43878         CHECK_ACCESS(effective_capacity_arg_ptr);
43879         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
43880         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
43881         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
43882         uint64_t ret_ref = 0;
43883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43885         return ret_ref;
43886 }
43887
43888 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
43889         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
43890         uint64_t ret_ref = 0;
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43893         return ret_ref;
43894 }
43895 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
43896         LDKChannelUsage arg_conv;
43897         arg_conv.inner = untag_ptr(arg);
43898         arg_conv.is_owned = ptr_is_owned(arg);
43899         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43900         arg_conv.is_owned = false;
43901         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
43902         return ret_conv;
43903 }
43904
43905 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
43906         LDKChannelUsage orig_conv;
43907         orig_conv.inner = untag_ptr(orig);
43908         orig_conv.is_owned = ptr_is_owned(orig);
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43910         orig_conv.is_owned = false;
43911         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
43912         uint64_t ret_ref = 0;
43913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43915         return ret_ref;
43916 }
43917
43918 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
43919         LDKFixedPenaltyScorer this_obj_conv;
43920         this_obj_conv.inner = untag_ptr(this_obj);
43921         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43923         FixedPenaltyScorer_free(this_obj_conv);
43924 }
43925
43926 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
43927         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
43928         uint64_t ret_ref = 0;
43929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43931         return ret_ref;
43932 }
43933 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
43934         LDKFixedPenaltyScorer arg_conv;
43935         arg_conv.inner = untag_ptr(arg);
43936         arg_conv.is_owned = ptr_is_owned(arg);
43937         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43938         arg_conv.is_owned = false;
43939         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
43940         return ret_conv;
43941 }
43942
43943 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
43944         LDKFixedPenaltyScorer orig_conv;
43945         orig_conv.inner = untag_ptr(orig);
43946         orig_conv.is_owned = ptr_is_owned(orig);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43948         orig_conv.is_owned = false;
43949         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
43950         uint64_t ret_ref = 0;
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43953         return ret_ref;
43954 }
43955
43956 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
43957         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
43958         uint64_t ret_ref = 0;
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43961         return ret_ref;
43962 }
43963
43964 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
43965         LDKFixedPenaltyScorer this_arg_conv;
43966         this_arg_conv.inner = untag_ptr(this_arg);
43967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43969         this_arg_conv.is_owned = false;
43970         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43971         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
43972         return tag_ptr(ret_ret, true);
43973 }
43974
43975 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
43976         LDKFixedPenaltyScorer obj_conv;
43977         obj_conv.inner = untag_ptr(obj);
43978         obj_conv.is_owned = ptr_is_owned(obj);
43979         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43980         obj_conv.is_owned = false;
43981         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
43982         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43983         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43984         CVec_u8Z_free(ret_var);
43985         return ret_arr;
43986 }
43987
43988 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
43989         LDKu8slice ser_ref;
43990         ser_ref.datalen = ser->arr_len;
43991         ser_ref.data = ser->elems;
43992         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
43993         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
43994         FREE(ser);
43995         return tag_ptr(ret_conv, true);
43996 }
43997
43998 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
43999         LDKProbabilisticScorer this_obj_conv;
44000         this_obj_conv.inner = untag_ptr(this_obj);
44001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44003         ProbabilisticScorer_free(this_obj_conv);
44004 }
44005
44006 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
44007         LDKProbabilisticScoringParameters this_obj_conv;
44008         this_obj_conv.inner = untag_ptr(this_obj);
44009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44011         ProbabilisticScoringParameters_free(this_obj_conv);
44012 }
44013
44014 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
44015         LDKProbabilisticScoringParameters this_ptr_conv;
44016         this_ptr_conv.inner = untag_ptr(this_ptr);
44017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44019         this_ptr_conv.is_owned = false;
44020         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
44021         return ret_conv;
44022 }
44023
44024 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
44025         LDKProbabilisticScoringParameters this_ptr_conv;
44026         this_ptr_conv.inner = untag_ptr(this_ptr);
44027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44029         this_ptr_conv.is_owned = false;
44030         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
44031 }
44032
44033 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) {
44034         LDKProbabilisticScoringParameters this_ptr_conv;
44035         this_ptr_conv.inner = untag_ptr(this_ptr);
44036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44038         this_ptr_conv.is_owned = false;
44039         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
44040         return ret_conv;
44041 }
44042
44043 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) {
44044         LDKProbabilisticScoringParameters this_ptr_conv;
44045         this_ptr_conv.inner = untag_ptr(this_ptr);
44046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44048         this_ptr_conv.is_owned = false;
44049         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44050 }
44051
44052 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
44053         LDKProbabilisticScoringParameters this_ptr_conv;
44054         this_ptr_conv.inner = untag_ptr(this_ptr);
44055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44057         this_ptr_conv.is_owned = false;
44058         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
44059         return ret_conv;
44060 }
44061
44062 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) {
44063         LDKProbabilisticScoringParameters this_ptr_conv;
44064         this_ptr_conv.inner = untag_ptr(this_ptr);
44065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44067         this_ptr_conv.is_owned = false;
44068         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
44069 }
44070
44071 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
44072         LDKProbabilisticScoringParameters this_ptr_conv;
44073         this_ptr_conv.inner = untag_ptr(this_ptr);
44074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44076         this_ptr_conv.is_owned = false;
44077         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
44078         return ret_conv;
44079 }
44080
44081 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) {
44082         LDKProbabilisticScoringParameters this_ptr_conv;
44083         this_ptr_conv.inner = untag_ptr(this_ptr);
44084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44086         this_ptr_conv.is_owned = false;
44087         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
44088 }
44089
44090 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) {
44091         LDKProbabilisticScoringParameters this_ptr_conv;
44092         this_ptr_conv.inner = untag_ptr(this_ptr);
44093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44095         this_ptr_conv.is_owned = false;
44096         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
44097         return ret_conv;
44098 }
44099
44100 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) {
44101         LDKProbabilisticScoringParameters this_ptr_conv;
44102         this_ptr_conv.inner = untag_ptr(this_ptr);
44103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44105         this_ptr_conv.is_owned = false;
44106         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44107 }
44108
44109 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) {
44110         LDKProbabilisticScoringParameters this_ptr_conv;
44111         this_ptr_conv.inner = untag_ptr(this_ptr);
44112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44114         this_ptr_conv.is_owned = false;
44115         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
44116         return ret_conv;
44117 }
44118
44119 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) {
44120         LDKProbabilisticScoringParameters this_ptr_conv;
44121         this_ptr_conv.inner = untag_ptr(this_ptr);
44122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44124         this_ptr_conv.is_owned = false;
44125         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
44126 }
44127
44128 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) {
44129         LDKProbabilisticScoringParameters this_ptr_conv;
44130         this_ptr_conv.inner = untag_ptr(this_ptr);
44131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44133         this_ptr_conv.is_owned = false;
44134         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
44135         return ret_conv;
44136 }
44137
44138 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) {
44139         LDKProbabilisticScoringParameters this_ptr_conv;
44140         this_ptr_conv.inner = untag_ptr(this_ptr);
44141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44143         this_ptr_conv.is_owned = false;
44144         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44145 }
44146
44147 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) {
44148         LDKProbabilisticScoringParameters this_ptr_conv;
44149         this_ptr_conv.inner = untag_ptr(this_ptr);
44150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44152         this_ptr_conv.is_owned = false;
44153         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
44154         return ret_conv;
44155 }
44156
44157 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) {
44158         LDKProbabilisticScoringParameters this_ptr_conv;
44159         this_ptr_conv.inner = untag_ptr(this_ptr);
44160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44162         this_ptr_conv.is_owned = false;
44163         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
44164 }
44165
44166 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
44167         LDKProbabilisticScoringParameters this_ptr_conv;
44168         this_ptr_conv.inner = untag_ptr(this_ptr);
44169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44171         this_ptr_conv.is_owned = false;
44172         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
44173         return ret_conv;
44174 }
44175
44176 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) {
44177         LDKProbabilisticScoringParameters this_ptr_conv;
44178         this_ptr_conv.inner = untag_ptr(this_ptr);
44179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44181         this_ptr_conv.is_owned = false;
44182         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
44183 }
44184
44185 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
44186         LDKProbabilisticScoringParameters this_ptr_conv;
44187         this_ptr_conv.inner = untag_ptr(this_ptr);
44188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44190         this_ptr_conv.is_owned = false;
44191         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
44192         return ret_conv;
44193 }
44194
44195 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) {
44196         LDKProbabilisticScoringParameters this_ptr_conv;
44197         this_ptr_conv.inner = untag_ptr(this_ptr);
44198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44200         this_ptr_conv.is_owned = false;
44201         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
44202 }
44203
44204 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
44205         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
44206         uint64_t ret_ref = 0;
44207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44209         return ret_ref;
44210 }
44211 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
44212         LDKProbabilisticScoringParameters arg_conv;
44213         arg_conv.inner = untag_ptr(arg);
44214         arg_conv.is_owned = ptr_is_owned(arg);
44215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44216         arg_conv.is_owned = false;
44217         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
44218         return ret_conv;
44219 }
44220
44221 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
44222         LDKProbabilisticScoringParameters orig_conv;
44223         orig_conv.inner = untag_ptr(orig);
44224         orig_conv.is_owned = ptr_is_owned(orig);
44225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44226         orig_conv.is_owned = false;
44227         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
44228         uint64_t ret_ref = 0;
44229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44231         return ret_ref;
44232 }
44233
44234 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
44235         LDKProbabilisticScoringParameters params_conv;
44236         params_conv.inner = untag_ptr(params);
44237         params_conv.is_owned = ptr_is_owned(params);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
44239         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
44240         LDKNetworkGraph network_graph_conv;
44241         network_graph_conv.inner = untag_ptr(network_graph);
44242         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44243         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44244         network_graph_conv.is_owned = false;
44245         void* logger_ptr = untag_ptr(logger);
44246         CHECK_ACCESS(logger_ptr);
44247         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44248         if (logger_conv.free == LDKLogger_JCalls_free) {
44249                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44250                 LDKLogger_JCalls_cloned(&logger_conv);
44251         }
44252         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
44253         uint64_t ret_ref = 0;
44254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44256         return ret_ref;
44257 }
44258
44259 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
44260         LDKProbabilisticScorer this_arg_conv;
44261         this_arg_conv.inner = untag_ptr(this_arg);
44262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44264         this_arg_conv.is_owned = false;
44265         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
44266 }
44267
44268 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) {
44269         LDKProbabilisticScorer this_arg_conv;
44270         this_arg_conv.inner = untag_ptr(this_arg);
44271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44273         this_arg_conv.is_owned = false;
44274         LDKNodeId target_conv;
44275         target_conv.inner = untag_ptr(target);
44276         target_conv.is_owned = ptr_is_owned(target);
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
44278         target_conv.is_owned = false;
44279         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
44280         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
44281         uint64_t ret_ref = tag_ptr(ret_copy, true);
44282         return ret_ref;
44283 }
44284
44285 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
44286         LDKProbabilisticScorer this_arg_conv;
44287         this_arg_conv.inner = untag_ptr(this_arg);
44288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44290         this_arg_conv.is_owned = false;
44291         LDKNodeId node_id_conv;
44292         node_id_conv.inner = untag_ptr(node_id);
44293         node_id_conv.is_owned = ptr_is_owned(node_id);
44294         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44295         node_id_conv.is_owned = false;
44296         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
44297 }
44298
44299 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
44300         LDKProbabilisticScorer this_arg_conv;
44301         this_arg_conv.inner = untag_ptr(this_arg);
44302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44304         this_arg_conv.is_owned = false;
44305         LDKNodeId node_id_conv;
44306         node_id_conv.inner = untag_ptr(node_id);
44307         node_id_conv.is_owned = ptr_is_owned(node_id);
44308         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44309         node_id_conv.is_owned = false;
44310         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
44311 }
44312
44313 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) {
44314         LDKProbabilisticScorer this_arg_conv;
44315         this_arg_conv.inner = untag_ptr(this_arg);
44316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44318         this_arg_conv.is_owned = false;
44319         LDKNodeId node_id_conv;
44320         node_id_conv.inner = untag_ptr(node_id);
44321         node_id_conv.is_owned = ptr_is_owned(node_id);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44323         node_id_conv.is_owned = false;
44324         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
44325 }
44326
44327 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
44328         LDKProbabilisticScorer this_arg_conv;
44329         this_arg_conv.inner = untag_ptr(this_arg);
44330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44332         this_arg_conv.is_owned = false;
44333         LDKNodeId node_id_conv;
44334         node_id_conv.inner = untag_ptr(node_id);
44335         node_id_conv.is_owned = ptr_is_owned(node_id);
44336         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
44337         node_id_conv.is_owned = false;
44338         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
44339 }
44340
44341 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
44342         LDKProbabilisticScorer this_arg_conv;
44343         this_arg_conv.inner = untag_ptr(this_arg);
44344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44346         this_arg_conv.is_owned = false;
44347         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
44348 }
44349
44350 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
44351         LDKProbabilisticScoringParameters this_arg_conv;
44352         this_arg_conv.inner = untag_ptr(this_arg);
44353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44355         this_arg_conv.is_owned = false;
44356         LDKCVec_NodeIdZ node_ids_constr;
44357         node_ids_constr.datalen = node_ids->arr_len;
44358         if (node_ids_constr.datalen > 0)
44359                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
44360         else
44361                 node_ids_constr.data = NULL;
44362         uint64_t* node_ids_vals = node_ids->elems;
44363         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
44364                 uint64_t node_ids_conv_8 = node_ids_vals[i];
44365                 LDKNodeId node_ids_conv_8_conv;
44366                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
44367                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
44368                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
44369                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
44370                 node_ids_constr.data[i] = node_ids_conv_8_conv;
44371         }
44372         FREE(node_ids);
44373         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
44374 }
44375
44376 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
44377         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
44378         uint64_t ret_ref = 0;
44379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44381         return ret_ref;
44382 }
44383
44384 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
44385         LDKProbabilisticScorer this_arg_conv;
44386         this_arg_conv.inner = untag_ptr(this_arg);
44387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44389         this_arg_conv.is_owned = false;
44390         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
44391         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
44392         return tag_ptr(ret_ret, true);
44393 }
44394
44395 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
44396         LDKProbabilisticScorer obj_conv;
44397         obj_conv.inner = untag_ptr(obj);
44398         obj_conv.is_owned = ptr_is_owned(obj);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44400         obj_conv.is_owned = false;
44401         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
44402         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44403         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44404         CVec_u8Z_free(ret_var);
44405         return ret_arr;
44406 }
44407
44408 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) {
44409         LDKu8slice ser_ref;
44410         ser_ref.datalen = ser->arr_len;
44411         ser_ref.data = ser->elems;
44412         LDKProbabilisticScoringParameters arg_a_conv;
44413         arg_a_conv.inner = untag_ptr(arg_a);
44414         arg_a_conv.is_owned = ptr_is_owned(arg_a);
44415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
44416         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
44417         LDKNetworkGraph arg_b_conv;
44418         arg_b_conv.inner = untag_ptr(arg_b);
44419         arg_b_conv.is_owned = ptr_is_owned(arg_b);
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
44421         arg_b_conv.is_owned = false;
44422         void* arg_c_ptr = untag_ptr(arg_c);
44423         CHECK_ACCESS(arg_c_ptr);
44424         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
44425         if (arg_c_conv.free == LDKLogger_JCalls_free) {
44426                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44427                 LDKLogger_JCalls_cloned(&arg_c_conv);
44428         }
44429         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
44430         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
44431         FREE(ser);
44432         return tag_ptr(ret_conv, true);
44433 }
44434
44435 void  __attribute__((export_name("TS_BlindedRoute_free"))) TS_BlindedRoute_free(uint64_t this_obj) {
44436         LDKBlindedRoute this_obj_conv;
44437         this_obj_conv.inner = untag_ptr(this_obj);
44438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44440         BlindedRoute_free(this_obj_conv);
44441 }
44442
44443 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
44444         LDKBlindedHop this_obj_conv;
44445         this_obj_conv.inner = untag_ptr(this_obj);
44446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44448         BlindedHop_free(this_obj_conv);
44449 }
44450
44451 uint64_t  __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_new(ptrArray node_pks, uint64_t keys_manager) {
44452         LDKCVec_PublicKeyZ node_pks_constr;
44453         node_pks_constr.datalen = node_pks->arr_len;
44454         if (node_pks_constr.datalen > 0)
44455                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44456         else
44457                 node_pks_constr.data = NULL;
44458         int8_tArray* node_pks_vals = (void*) node_pks->elems;
44459         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
44460                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
44461                 LDKPublicKey node_pks_conv_12_ref;
44462                 CHECK(node_pks_conv_12->arr_len == 33);
44463                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
44464                 node_pks_constr.data[m] = node_pks_conv_12_ref;
44465         }
44466         FREE(node_pks);
44467         void* keys_manager_ptr = untag_ptr(keys_manager);
44468         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
44469         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
44470         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
44471         *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv);
44472         return tag_ptr(ret_conv, true);
44473 }
44474
44475 int8_tArray  __attribute__((export_name("TS_BlindedRoute_write"))) TS_BlindedRoute_write(uint64_t obj) {
44476         LDKBlindedRoute obj_conv;
44477         obj_conv.inner = untag_ptr(obj);
44478         obj_conv.is_owned = ptr_is_owned(obj);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44480         obj_conv.is_owned = false;
44481         LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv);
44482         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44483         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44484         CVec_u8Z_free(ret_var);
44485         return ret_arr;
44486 }
44487
44488 uint64_t  __attribute__((export_name("TS_BlindedRoute_read"))) TS_BlindedRoute_read(int8_tArray ser) {
44489         LDKu8slice ser_ref;
44490         ser_ref.datalen = ser->arr_len;
44491         ser_ref.data = ser->elems;
44492         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
44493         *ret_conv = BlindedRoute_read(ser_ref);
44494         FREE(ser);
44495         return tag_ptr(ret_conv, true);
44496 }
44497
44498 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
44499         LDKBlindedHop obj_conv;
44500         obj_conv.inner = untag_ptr(obj);
44501         obj_conv.is_owned = ptr_is_owned(obj);
44502         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44503         obj_conv.is_owned = false;
44504         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
44505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44507         CVec_u8Z_free(ret_var);
44508         return ret_arr;
44509 }
44510
44511 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
44512         LDKu8slice ser_ref;
44513         ser_ref.datalen = ser->arr_len;
44514         ser_ref.data = ser->elems;
44515         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
44516         *ret_conv = BlindedHop_read(ser_ref);
44517         FREE(ser);
44518         return tag_ptr(ret_conv, true);
44519 }
44520
44521 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
44522         LDKOnionMessenger this_obj_conv;
44523         this_obj_conv.inner = untag_ptr(this_obj);
44524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44526         OnionMessenger_free(this_obj_conv);
44527 }
44528
44529 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
44530         if (!ptr_is_owned(this_ptr)) return;
44531         void* this_ptr_ptr = untag_ptr(this_ptr);
44532         CHECK_ACCESS(this_ptr_ptr);
44533         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
44534         FREE(untag_ptr(this_ptr));
44535         Destination_free(this_ptr_conv);
44536 }
44537
44538 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
44539         LDKPublicKey a_ref;
44540         CHECK(a->arr_len == 33);
44541         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
44542         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
44543         *ret_copy = Destination_node(a_ref);
44544         uint64_t ret_ref = tag_ptr(ret_copy, true);
44545         return ret_ref;
44546 }
44547
44548 uint64_t  __attribute__((export_name("TS_Destination_blinded_route"))) TS_Destination_blinded_route(uint64_t a) {
44549         LDKBlindedRoute a_conv;
44550         a_conv.inner = untag_ptr(a);
44551         a_conv.is_owned = ptr_is_owned(a);
44552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44553         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
44554         
44555         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
44556         *ret_copy = Destination_blinded_route(a_conv);
44557         uint64_t ret_ref = tag_ptr(ret_copy, true);
44558         return ret_ref;
44559 }
44560
44561 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
44562         if (!ptr_is_owned(this_ptr)) return;
44563         void* this_ptr_ptr = untag_ptr(this_ptr);
44564         CHECK_ACCESS(this_ptr_ptr);
44565         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
44566         FREE(untag_ptr(this_ptr));
44567         SendError_free(this_ptr_conv);
44568 }
44569
44570 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
44571         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44572         *ret_copy = SendError_clone(arg);
44573         uint64_t ret_ref = tag_ptr(ret_copy, true);
44574         return ret_ref;
44575 }
44576 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
44577         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
44578         int64_t ret_conv = SendError_clone_ptr(arg_conv);
44579         return ret_conv;
44580 }
44581
44582 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
44583         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
44584         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44585         *ret_copy = SendError_clone(orig_conv);
44586         uint64_t ret_ref = tag_ptr(ret_copy, true);
44587         return ret_ref;
44588 }
44589
44590 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
44591         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
44592         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44593         *ret_copy = SendError_secp256k1(a_conv);
44594         uint64_t ret_ref = tag_ptr(ret_copy, true);
44595         return ret_ref;
44596 }
44597
44598 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
44599         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44600         *ret_copy = SendError_too_big_packet();
44601         uint64_t ret_ref = tag_ptr(ret_copy, true);
44602         return ret_ref;
44603 }
44604
44605 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
44606         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44607         *ret_copy = SendError_too_few_blinded_hops();
44608         uint64_t ret_ref = tag_ptr(ret_copy, true);
44609         return ret_ref;
44610 }
44611
44612 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
44613         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44614         *ret_copy = SendError_invalid_first_hop();
44615         uint64_t ret_ref = tag_ptr(ret_copy, true);
44616         return ret_ref;
44617 }
44618
44619 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
44620         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44621         *ret_copy = SendError_invalid_message();
44622         uint64_t ret_ref = tag_ptr(ret_copy, true);
44623         return ret_ref;
44624 }
44625
44626 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
44627         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
44628         *ret_copy = SendError_buffer_full();
44629         uint64_t ret_ref = tag_ptr(ret_copy, true);
44630         return ret_ref;
44631 }
44632
44633 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
44634         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
44635         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
44636         jboolean ret_conv = SendError_eq(a_conv, b_conv);
44637         return ret_conv;
44638 }
44639
44640 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
44641         if (!ptr_is_owned(this_ptr)) return;
44642         void* this_ptr_ptr = untag_ptr(this_ptr);
44643         CHECK_ACCESS(this_ptr_ptr);
44644         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
44645         FREE(untag_ptr(this_ptr));
44646         CustomOnionMessageHandler_free(this_ptr_conv);
44647 }
44648
44649 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger, uint64_t custom_handler) {
44650         void* keys_manager_ptr = untag_ptr(keys_manager);
44651         CHECK_ACCESS(keys_manager_ptr);
44652         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
44653         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
44654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44655                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
44656         }
44657         void* logger_ptr = untag_ptr(logger);
44658         CHECK_ACCESS(logger_ptr);
44659         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44660         if (logger_conv.free == LDKLogger_JCalls_free) {
44661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44662                 LDKLogger_JCalls_cloned(&logger_conv);
44663         }
44664         void* custom_handler_ptr = untag_ptr(custom_handler);
44665         CHECK_ACCESS(custom_handler_ptr);
44666         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
44667         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
44668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44669                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
44670         }
44671         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv);
44672         uint64_t ret_ref = 0;
44673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44675         return ret_ref;
44676 }
44677
44678 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) {
44679         LDKOnionMessenger this_arg_conv;
44680         this_arg_conv.inner = untag_ptr(this_arg);
44681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44683         this_arg_conv.is_owned = false;
44684         LDKCVec_PublicKeyZ intermediate_nodes_constr;
44685         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
44686         if (intermediate_nodes_constr.datalen > 0)
44687                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44688         else
44689                 intermediate_nodes_constr.data = NULL;
44690         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
44691         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
44692                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
44693                 LDKPublicKey intermediate_nodes_conv_12_ref;
44694                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
44695                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
44696                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
44697         }
44698         FREE(intermediate_nodes);
44699         void* destination_ptr = untag_ptr(destination);
44700         CHECK_ACCESS(destination_ptr);
44701         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
44702         // WARNING: we may need a move here but no clone is available for LDKDestination
44703         void* msg_ptr = untag_ptr(msg);
44704         CHECK_ACCESS(msg_ptr);
44705         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
44706         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
44707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44708                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
44709         }
44710         LDKBlindedRoute reply_path_conv;
44711         reply_path_conv.inner = untag_ptr(reply_path);
44712         reply_path_conv.is_owned = ptr_is_owned(reply_path);
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
44714         reply_path_conv.is_owned = false;
44715         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
44716         *ret_conv = OnionMessenger_send_custom_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, msg_conv, reply_path_conv);
44717         return tag_ptr(ret_conv, true);
44718 }
44719
44720 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
44721         LDKOnionMessenger this_arg_conv;
44722         this_arg_conv.inner = untag_ptr(this_arg);
44723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44725         this_arg_conv.is_owned = false;
44726         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
44727         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
44728         return tag_ptr(ret_ret, true);
44729 }
44730
44731 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
44732         LDKOnionMessenger this_arg_conv;
44733         this_arg_conv.inner = untag_ptr(this_arg);
44734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44736         this_arg_conv.is_owned = false;
44737         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
44738         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
44739         return tag_ptr(ret_ret, true);
44740 }
44741
44742 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
44743         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
44744         *ret_ret = CustomOnionMessageContents_clone(arg);
44745         return tag_ptr(ret_ret, true);
44746 }
44747 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
44748         void* arg_ptr = untag_ptr(arg);
44749         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
44750         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
44751         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
44752         return ret_conv;
44753 }
44754
44755 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
44756         void* orig_ptr = untag_ptr(orig);
44757         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
44758         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
44759         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
44760         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
44761         return tag_ptr(ret_ret, true);
44762 }
44763
44764 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
44765         if (!ptr_is_owned(this_ptr)) return;
44766         void* this_ptr_ptr = untag_ptr(this_ptr);
44767         CHECK_ACCESS(this_ptr_ptr);
44768         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
44769         FREE(untag_ptr(this_ptr));
44770         CustomOnionMessageContents_free(this_ptr_conv);
44771 }
44772
44773 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
44774         LDKRapidGossipSync this_obj_conv;
44775         this_obj_conv.inner = untag_ptr(this_obj);
44776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44778         RapidGossipSync_free(this_obj_conv);
44779 }
44780
44781 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
44782         LDKNetworkGraph network_graph_conv;
44783         network_graph_conv.inner = untag_ptr(network_graph);
44784         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44786         network_graph_conv.is_owned = false;
44787         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
44788         uint64_t ret_ref = 0;
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44791         return ret_ref;
44792 }
44793
44794 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
44795         LDKRapidGossipSync this_arg_conv;
44796         this_arg_conv.inner = untag_ptr(this_arg);
44797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44799         this_arg_conv.is_owned = false;
44800         LDKu8slice update_data_ref;
44801         update_data_ref.datalen = update_data->arr_len;
44802         update_data_ref.data = update_data->elems;
44803         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
44804         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
44805         FREE(update_data);
44806         return tag_ptr(ret_conv, true);
44807 }
44808
44809 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
44810         LDKRapidGossipSync this_arg_conv;
44811         this_arg_conv.inner = untag_ptr(this_arg);
44812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44814         this_arg_conv.is_owned = false;
44815         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
44816         return ret_conv;
44817 }
44818
44819 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
44820         if (!ptr_is_owned(this_ptr)) return;
44821         void* this_ptr_ptr = untag_ptr(this_ptr);
44822         CHECK_ACCESS(this_ptr_ptr);
44823         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
44824         FREE(untag_ptr(this_ptr));
44825         GraphSyncError_free(this_ptr_conv);
44826 }
44827
44828 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
44829         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44830         *ret_copy = GraphSyncError_clone(arg);
44831         uint64_t ret_ref = tag_ptr(ret_copy, true);
44832         return ret_ref;
44833 }
44834 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
44835         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
44836         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
44837         return ret_conv;
44838 }
44839
44840 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
44841         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
44842         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44843         *ret_copy = GraphSyncError_clone(orig_conv);
44844         uint64_t ret_ref = tag_ptr(ret_copy, true);
44845         return ret_ref;
44846 }
44847
44848 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
44849         void* a_ptr = untag_ptr(a);
44850         CHECK_ACCESS(a_ptr);
44851         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
44852         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
44853         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44854         *ret_copy = GraphSyncError_decode_error(a_conv);
44855         uint64_t ret_ref = tag_ptr(ret_copy, true);
44856         return ret_ref;
44857 }
44858
44859 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
44860         LDKLightningError a_conv;
44861         a_conv.inner = untag_ptr(a);
44862         a_conv.is_owned = ptr_is_owned(a);
44863         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44864         a_conv = LightningError_clone(&a_conv);
44865         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
44866         *ret_copy = GraphSyncError_lightning_error(a_conv);
44867         uint64_t ret_ref = tag_ptr(ret_copy, true);
44868         return ret_ref;
44869 }
44870
44871 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
44872         if (!ptr_is_owned(this_ptr)) return;
44873         void* this_ptr_ptr = untag_ptr(this_ptr);
44874         CHECK_ACCESS(this_ptr_ptr);
44875         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
44876         FREE(untag_ptr(this_ptr));
44877         ParseError_free(this_ptr_conv);
44878 }
44879
44880 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
44881         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44882         *ret_copy = ParseError_clone(arg);
44883         uint64_t ret_ref = tag_ptr(ret_copy, true);
44884         return ret_ref;
44885 }
44886 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
44887         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
44888         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
44889         return ret_conv;
44890 }
44891
44892 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
44893         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
44894         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44895         *ret_copy = ParseError_clone(orig_conv);
44896         uint64_t ret_ref = tag_ptr(ret_copy, true);
44897         return ret_ref;
44898 }
44899
44900 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
44901         void* a_ptr = untag_ptr(a);
44902         CHECK_ACCESS(a_ptr);
44903         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
44904         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
44905         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44906         *ret_copy = ParseError_bech32_error(a_conv);
44907         uint64_t ret_ref = tag_ptr(ret_copy, true);
44908         return ret_ref;
44909 }
44910
44911 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
44912         
44913         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44914         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
44915         uint64_t ret_ref = tag_ptr(ret_copy, true);
44916         return ret_ref;
44917 }
44918
44919 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
44920         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
44921         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44922         *ret_copy = ParseError_malformed_signature(a_conv);
44923         uint64_t ret_ref = tag_ptr(ret_copy, true);
44924         return ret_ref;
44925 }
44926
44927 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
44928         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44929         *ret_copy = ParseError_bad_prefix();
44930         uint64_t ret_ref = tag_ptr(ret_copy, true);
44931         return ret_ref;
44932 }
44933
44934 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
44935         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44936         *ret_copy = ParseError_unknown_currency();
44937         uint64_t ret_ref = tag_ptr(ret_copy, true);
44938         return ret_ref;
44939 }
44940
44941 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
44942         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44943         *ret_copy = ParseError_unknown_si_prefix();
44944         uint64_t ret_ref = tag_ptr(ret_copy, true);
44945         return ret_ref;
44946 }
44947
44948 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
44949         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44950         *ret_copy = ParseError_malformed_hrp();
44951         uint64_t ret_ref = tag_ptr(ret_copy, true);
44952         return ret_ref;
44953 }
44954
44955 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
44956         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44957         *ret_copy = ParseError_too_short_data_part();
44958         uint64_t ret_ref = tag_ptr(ret_copy, true);
44959         return ret_ref;
44960 }
44961
44962 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
44963         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44964         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
44965         uint64_t ret_ref = tag_ptr(ret_copy, true);
44966         return ret_ref;
44967 }
44968
44969 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
44970         
44971         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44972         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
44973         uint64_t ret_ref = tag_ptr(ret_copy, true);
44974         return ret_ref;
44975 }
44976
44977 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
44978         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44979         *ret_copy = ParseError_padding_error();
44980         uint64_t ret_ref = tag_ptr(ret_copy, true);
44981         return ret_ref;
44982 }
44983
44984 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
44985         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44986         *ret_copy = ParseError_integer_overflow_error();
44987         uint64_t ret_ref = tag_ptr(ret_copy, true);
44988         return ret_ref;
44989 }
44990
44991 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
44992         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
44993         *ret_copy = ParseError_invalid_seg_wit_program_length();
44994         uint64_t ret_ref = tag_ptr(ret_copy, true);
44995         return ret_ref;
44996 }
44997
44998 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
44999         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45000         *ret_copy = ParseError_invalid_pub_key_hash_length();
45001         uint64_t ret_ref = tag_ptr(ret_copy, true);
45002         return ret_ref;
45003 }
45004
45005 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
45006         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45007         *ret_copy = ParseError_invalid_script_hash_length();
45008         uint64_t ret_ref = tag_ptr(ret_copy, true);
45009         return ret_ref;
45010 }
45011
45012 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
45013         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45014         *ret_copy = ParseError_invalid_recovery_id();
45015         uint64_t ret_ref = tag_ptr(ret_copy, true);
45016         return ret_ref;
45017 }
45018
45019 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
45020         LDKStr a_conv = str_ref_to_owned_c(a);
45021         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45022         *ret_copy = ParseError_invalid_slice_length(a_conv);
45023         uint64_t ret_ref = tag_ptr(ret_copy, true);
45024         return ret_ref;
45025 }
45026
45027 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
45028         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45029         *ret_copy = ParseError_skip();
45030         uint64_t ret_ref = tag_ptr(ret_copy, true);
45031         return ret_ref;
45032 }
45033
45034 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
45035         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
45036         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
45037         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
45038         return ret_conv;
45039 }
45040
45041 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
45042         if (!ptr_is_owned(this_ptr)) return;
45043         void* this_ptr_ptr = untag_ptr(this_ptr);
45044         CHECK_ACCESS(this_ptr_ptr);
45045         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45046         FREE(untag_ptr(this_ptr));
45047         ParseOrSemanticError_free(this_ptr_conv);
45048 }
45049
45050 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45051         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45052         *ret_copy = ParseOrSemanticError_clone(arg);
45053         uint64_t ret_ref = tag_ptr(ret_copy, true);
45054         return ret_ref;
45055 }
45056 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
45057         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
45058         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45059         return ret_conv;
45060 }
45061
45062 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
45063         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
45064         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45065         *ret_copy = ParseOrSemanticError_clone(orig_conv);
45066         uint64_t ret_ref = tag_ptr(ret_copy, true);
45067         return ret_ref;
45068 }
45069
45070 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
45071         void* a_ptr = untag_ptr(a);
45072         CHECK_ACCESS(a_ptr);
45073         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45074         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
45075         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45076         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45077         uint64_t ret_ref = tag_ptr(ret_copy, true);
45078         return ret_ref;
45079 }
45080
45081 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
45082         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
45083         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45084         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45085         uint64_t ret_ref = tag_ptr(ret_copy, true);
45086         return ret_ref;
45087 }
45088
45089 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
45090         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
45091         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
45092         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
45093         return ret_conv;
45094 }
45095
45096 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
45097         LDKInvoice this_obj_conv;
45098         this_obj_conv.inner = untag_ptr(this_obj);
45099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45101         Invoice_free(this_obj_conv);
45102 }
45103
45104 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
45105         LDKInvoice a_conv;
45106         a_conv.inner = untag_ptr(a);
45107         a_conv.is_owned = ptr_is_owned(a);
45108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45109         a_conv.is_owned = false;
45110         LDKInvoice b_conv;
45111         b_conv.inner = untag_ptr(b);
45112         b_conv.is_owned = ptr_is_owned(b);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45114         b_conv.is_owned = false;
45115         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45116         return ret_conv;
45117 }
45118
45119 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45120         LDKInvoice ret_var = Invoice_clone(arg);
45121         uint64_t ret_ref = 0;
45122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45124         return ret_ref;
45125 }
45126 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
45127         LDKInvoice arg_conv;
45128         arg_conv.inner = untag_ptr(arg);
45129         arg_conv.is_owned = ptr_is_owned(arg);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45131         arg_conv.is_owned = false;
45132         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45133         return ret_conv;
45134 }
45135
45136 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
45137         LDKInvoice orig_conv;
45138         orig_conv.inner = untag_ptr(orig);
45139         orig_conv.is_owned = ptr_is_owned(orig);
45140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45141         orig_conv.is_owned = false;
45142         LDKInvoice ret_var = Invoice_clone(&orig_conv);
45143         uint64_t ret_ref = 0;
45144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45146         return ret_ref;
45147 }
45148
45149 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
45150         LDKInvoice o_conv;
45151         o_conv.inner = untag_ptr(o);
45152         o_conv.is_owned = ptr_is_owned(o);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45154         o_conv.is_owned = false;
45155         int64_t ret_conv = Invoice_hash(&o_conv);
45156         return ret_conv;
45157 }
45158
45159 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
45160         LDKSignedRawInvoice this_obj_conv;
45161         this_obj_conv.inner = untag_ptr(this_obj);
45162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45164         SignedRawInvoice_free(this_obj_conv);
45165 }
45166
45167 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
45168         LDKSignedRawInvoice a_conv;
45169         a_conv.inner = untag_ptr(a);
45170         a_conv.is_owned = ptr_is_owned(a);
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45172         a_conv.is_owned = false;
45173         LDKSignedRawInvoice b_conv;
45174         b_conv.inner = untag_ptr(b);
45175         b_conv.is_owned = ptr_is_owned(b);
45176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45177         b_conv.is_owned = false;
45178         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45179         return ret_conv;
45180 }
45181
45182 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45183         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45184         uint64_t ret_ref = 0;
45185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45187         return ret_ref;
45188 }
45189 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
45190         LDKSignedRawInvoice arg_conv;
45191         arg_conv.inner = untag_ptr(arg);
45192         arg_conv.is_owned = ptr_is_owned(arg);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45194         arg_conv.is_owned = false;
45195         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45196         return ret_conv;
45197 }
45198
45199 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
45200         LDKSignedRawInvoice orig_conv;
45201         orig_conv.inner = untag_ptr(orig);
45202         orig_conv.is_owned = ptr_is_owned(orig);
45203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45204         orig_conv.is_owned = false;
45205         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45206         uint64_t ret_ref = 0;
45207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45209         return ret_ref;
45210 }
45211
45212 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
45213         LDKSignedRawInvoice o_conv;
45214         o_conv.inner = untag_ptr(o);
45215         o_conv.is_owned = ptr_is_owned(o);
45216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45217         o_conv.is_owned = false;
45218         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
45219         return ret_conv;
45220 }
45221
45222 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
45223         LDKRawInvoice this_obj_conv;
45224         this_obj_conv.inner = untag_ptr(this_obj);
45225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45227         RawInvoice_free(this_obj_conv);
45228 }
45229
45230 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
45231         LDKRawInvoice this_ptr_conv;
45232         this_ptr_conv.inner = untag_ptr(this_ptr);
45233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45235         this_ptr_conv.is_owned = false;
45236         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45237         uint64_t ret_ref = 0;
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45240         return ret_ref;
45241 }
45242
45243 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
45244         LDKRawInvoice this_ptr_conv;
45245         this_ptr_conv.inner = untag_ptr(this_ptr);
45246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45248         this_ptr_conv.is_owned = false;
45249         LDKRawDataPart val_conv;
45250         val_conv.inner = untag_ptr(val);
45251         val_conv.is_owned = ptr_is_owned(val);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45253         val_conv = RawDataPart_clone(&val_conv);
45254         RawInvoice_set_data(&this_ptr_conv, val_conv);
45255 }
45256
45257 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
45258         LDKRawInvoice a_conv;
45259         a_conv.inner = untag_ptr(a);
45260         a_conv.is_owned = ptr_is_owned(a);
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45262         a_conv.is_owned = false;
45263         LDKRawInvoice b_conv;
45264         b_conv.inner = untag_ptr(b);
45265         b_conv.is_owned = ptr_is_owned(b);
45266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45267         b_conv.is_owned = false;
45268         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45269         return ret_conv;
45270 }
45271
45272 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45273         LDKRawInvoice ret_var = RawInvoice_clone(arg);
45274         uint64_t ret_ref = 0;
45275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45277         return ret_ref;
45278 }
45279 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
45280         LDKRawInvoice arg_conv;
45281         arg_conv.inner = untag_ptr(arg);
45282         arg_conv.is_owned = ptr_is_owned(arg);
45283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45284         arg_conv.is_owned = false;
45285         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
45286         return ret_conv;
45287 }
45288
45289 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
45290         LDKRawInvoice orig_conv;
45291         orig_conv.inner = untag_ptr(orig);
45292         orig_conv.is_owned = ptr_is_owned(orig);
45293         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45294         orig_conv.is_owned = false;
45295         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
45296         uint64_t ret_ref = 0;
45297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45299         return ret_ref;
45300 }
45301
45302 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
45303         LDKRawInvoice o_conv;
45304         o_conv.inner = untag_ptr(o);
45305         o_conv.is_owned = ptr_is_owned(o);
45306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45307         o_conv.is_owned = false;
45308         int64_t ret_conv = RawInvoice_hash(&o_conv);
45309         return ret_conv;
45310 }
45311
45312 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
45313         LDKRawDataPart this_obj_conv;
45314         this_obj_conv.inner = untag_ptr(this_obj);
45315         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45317         RawDataPart_free(this_obj_conv);
45318 }
45319
45320 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
45321         LDKRawDataPart this_ptr_conv;
45322         this_ptr_conv.inner = untag_ptr(this_ptr);
45323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45325         this_ptr_conv.is_owned = false;
45326         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
45327         uint64_t ret_ref = 0;
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45330         return ret_ref;
45331 }
45332
45333 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
45334         LDKRawDataPart this_ptr_conv;
45335         this_ptr_conv.inner = untag_ptr(this_ptr);
45336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45338         this_ptr_conv.is_owned = false;
45339         LDKPositiveTimestamp val_conv;
45340         val_conv.inner = untag_ptr(val);
45341         val_conv.is_owned = ptr_is_owned(val);
45342         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45343         val_conv = PositiveTimestamp_clone(&val_conv);
45344         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
45345 }
45346
45347 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
45348         LDKRawDataPart a_conv;
45349         a_conv.inner = untag_ptr(a);
45350         a_conv.is_owned = ptr_is_owned(a);
45351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45352         a_conv.is_owned = false;
45353         LDKRawDataPart b_conv;
45354         b_conv.inner = untag_ptr(b);
45355         b_conv.is_owned = ptr_is_owned(b);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45357         b_conv.is_owned = false;
45358         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
45359         return ret_conv;
45360 }
45361
45362 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
45363         LDKRawDataPart ret_var = RawDataPart_clone(arg);
45364         uint64_t ret_ref = 0;
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45367         return ret_ref;
45368 }
45369 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
45370         LDKRawDataPart arg_conv;
45371         arg_conv.inner = untag_ptr(arg);
45372         arg_conv.is_owned = ptr_is_owned(arg);
45373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45374         arg_conv.is_owned = false;
45375         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
45376         return ret_conv;
45377 }
45378
45379 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
45380         LDKRawDataPart orig_conv;
45381         orig_conv.inner = untag_ptr(orig);
45382         orig_conv.is_owned = ptr_is_owned(orig);
45383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45384         orig_conv.is_owned = false;
45385         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
45386         uint64_t ret_ref = 0;
45387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45389         return ret_ref;
45390 }
45391
45392 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
45393         LDKRawDataPart o_conv;
45394         o_conv.inner = untag_ptr(o);
45395         o_conv.is_owned = ptr_is_owned(o);
45396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45397         o_conv.is_owned = false;
45398         int64_t ret_conv = RawDataPart_hash(&o_conv);
45399         return ret_conv;
45400 }
45401
45402 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
45403         LDKPositiveTimestamp this_obj_conv;
45404         this_obj_conv.inner = untag_ptr(this_obj);
45405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45407         PositiveTimestamp_free(this_obj_conv);
45408 }
45409
45410 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
45411         LDKPositiveTimestamp a_conv;
45412         a_conv.inner = untag_ptr(a);
45413         a_conv.is_owned = ptr_is_owned(a);
45414         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45415         a_conv.is_owned = false;
45416         LDKPositiveTimestamp b_conv;
45417         b_conv.inner = untag_ptr(b);
45418         b_conv.is_owned = ptr_is_owned(b);
45419         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45420         b_conv.is_owned = false;
45421         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
45422         return ret_conv;
45423 }
45424
45425 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
45426         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
45427         uint64_t ret_ref = 0;
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45430         return ret_ref;
45431 }
45432 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
45433         LDKPositiveTimestamp arg_conv;
45434         arg_conv.inner = untag_ptr(arg);
45435         arg_conv.is_owned = ptr_is_owned(arg);
45436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45437         arg_conv.is_owned = false;
45438         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
45439         return ret_conv;
45440 }
45441
45442 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
45443         LDKPositiveTimestamp orig_conv;
45444         orig_conv.inner = untag_ptr(orig);
45445         orig_conv.is_owned = ptr_is_owned(orig);
45446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45447         orig_conv.is_owned = false;
45448         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
45449         uint64_t ret_ref = 0;
45450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45452         return ret_ref;
45453 }
45454
45455 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
45456         LDKPositiveTimestamp o_conv;
45457         o_conv.inner = untag_ptr(o);
45458         o_conv.is_owned = ptr_is_owned(o);
45459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45460         o_conv.is_owned = false;
45461         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
45462         return ret_conv;
45463 }
45464
45465 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
45466         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
45467         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
45468         return ret_conv;
45469 }
45470
45471 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
45472         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
45473         return ret_conv;
45474 }
45475
45476 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
45477         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
45478         return ret_conv;
45479 }
45480
45481 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
45482         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
45483         return ret_conv;
45484 }
45485
45486 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
45487         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
45488         return ret_conv;
45489 }
45490
45491 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
45492         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
45493         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
45494         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
45495         return ret_conv;
45496 }
45497
45498 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
45499         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
45500         int64_t ret_conv = SiPrefix_hash(o_conv);
45501         return ret_conv;
45502 }
45503
45504 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
45505         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
45506         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
45507         return ret_conv;
45508 }
45509
45510 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
45511         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
45512         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
45513         return ret_conv;
45514 }
45515
45516 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
45517         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
45518         return ret_conv;
45519 }
45520
45521 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
45522         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
45523         return ret_conv;
45524 }
45525
45526 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
45527         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
45528         return ret_conv;
45529 }
45530
45531 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
45532         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
45533         return ret_conv;
45534 }
45535
45536 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
45537         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
45538         return ret_conv;
45539 }
45540
45541 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
45542         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
45543         int64_t ret_conv = Currency_hash(o_conv);
45544         return ret_conv;
45545 }
45546
45547 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
45548         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
45549         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
45550         jboolean ret_conv = Currency_eq(a_conv, b_conv);
45551         return ret_conv;
45552 }
45553
45554 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
45555         LDKSha256 this_obj_conv;
45556         this_obj_conv.inner = untag_ptr(this_obj);
45557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45559         Sha256_free(this_obj_conv);
45560 }
45561
45562 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
45563         LDKSha256 ret_var = Sha256_clone(arg);
45564         uint64_t ret_ref = 0;
45565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45567         return ret_ref;
45568 }
45569 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
45570         LDKSha256 arg_conv;
45571         arg_conv.inner = untag_ptr(arg);
45572         arg_conv.is_owned = ptr_is_owned(arg);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45574         arg_conv.is_owned = false;
45575         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
45576         return ret_conv;
45577 }
45578
45579 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
45580         LDKSha256 orig_conv;
45581         orig_conv.inner = untag_ptr(orig);
45582         orig_conv.is_owned = ptr_is_owned(orig);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45584         orig_conv.is_owned = false;
45585         LDKSha256 ret_var = Sha256_clone(&orig_conv);
45586         uint64_t ret_ref = 0;
45587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45589         return ret_ref;
45590 }
45591
45592 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
45593         LDKSha256 o_conv;
45594         o_conv.inner = untag_ptr(o);
45595         o_conv.is_owned = ptr_is_owned(o);
45596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45597         o_conv.is_owned = false;
45598         int64_t ret_conv = Sha256_hash(&o_conv);
45599         return ret_conv;
45600 }
45601
45602 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
45603         LDKSha256 a_conv;
45604         a_conv.inner = untag_ptr(a);
45605         a_conv.is_owned = ptr_is_owned(a);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45607         a_conv.is_owned = false;
45608         LDKSha256 b_conv;
45609         b_conv.inner = untag_ptr(b);
45610         b_conv.is_owned = ptr_is_owned(b);
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45612         b_conv.is_owned = false;
45613         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
45614         return ret_conv;
45615 }
45616
45617 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
45618         LDKDescription this_obj_conv;
45619         this_obj_conv.inner = untag_ptr(this_obj);
45620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45622         Description_free(this_obj_conv);
45623 }
45624
45625 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
45626         LDKDescription ret_var = Description_clone(arg);
45627         uint64_t ret_ref = 0;
45628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45630         return ret_ref;
45631 }
45632 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
45633         LDKDescription arg_conv;
45634         arg_conv.inner = untag_ptr(arg);
45635         arg_conv.is_owned = ptr_is_owned(arg);
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45637         arg_conv.is_owned = false;
45638         int64_t ret_conv = Description_clone_ptr(&arg_conv);
45639         return ret_conv;
45640 }
45641
45642 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
45643         LDKDescription orig_conv;
45644         orig_conv.inner = untag_ptr(orig);
45645         orig_conv.is_owned = ptr_is_owned(orig);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45647         orig_conv.is_owned = false;
45648         LDKDescription ret_var = Description_clone(&orig_conv);
45649         uint64_t ret_ref = 0;
45650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45652         return ret_ref;
45653 }
45654
45655 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
45656         LDKDescription o_conv;
45657         o_conv.inner = untag_ptr(o);
45658         o_conv.is_owned = ptr_is_owned(o);
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45660         o_conv.is_owned = false;
45661         int64_t ret_conv = Description_hash(&o_conv);
45662         return ret_conv;
45663 }
45664
45665 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
45666         LDKDescription a_conv;
45667         a_conv.inner = untag_ptr(a);
45668         a_conv.is_owned = ptr_is_owned(a);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45670         a_conv.is_owned = false;
45671         LDKDescription b_conv;
45672         b_conv.inner = untag_ptr(b);
45673         b_conv.is_owned = ptr_is_owned(b);
45674         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45675         b_conv.is_owned = false;
45676         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
45677         return ret_conv;
45678 }
45679
45680 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
45681         LDKPayeePubKey this_obj_conv;
45682         this_obj_conv.inner = untag_ptr(this_obj);
45683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45685         PayeePubKey_free(this_obj_conv);
45686 }
45687
45688 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
45689         LDKPayeePubKey this_ptr_conv;
45690         this_ptr_conv.inner = untag_ptr(this_ptr);
45691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45693         this_ptr_conv.is_owned = false;
45694         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45695         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
45696         return ret_arr;
45697 }
45698
45699 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
45700         LDKPayeePubKey this_ptr_conv;
45701         this_ptr_conv.inner = untag_ptr(this_ptr);
45702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45704         this_ptr_conv.is_owned = false;
45705         LDKPublicKey val_ref;
45706         CHECK(val->arr_len == 33);
45707         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45708         PayeePubKey_set_a(&this_ptr_conv, val_ref);
45709 }
45710
45711 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
45712         LDKPublicKey a_arg_ref;
45713         CHECK(a_arg->arr_len == 33);
45714         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
45715         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
45716         uint64_t ret_ref = 0;
45717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45719         return ret_ref;
45720 }
45721
45722 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
45723         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
45724         uint64_t ret_ref = 0;
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45727         return ret_ref;
45728 }
45729 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
45730         LDKPayeePubKey arg_conv;
45731         arg_conv.inner = untag_ptr(arg);
45732         arg_conv.is_owned = ptr_is_owned(arg);
45733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45734         arg_conv.is_owned = false;
45735         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
45736         return ret_conv;
45737 }
45738
45739 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
45740         LDKPayeePubKey orig_conv;
45741         orig_conv.inner = untag_ptr(orig);
45742         orig_conv.is_owned = ptr_is_owned(orig);
45743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45744         orig_conv.is_owned = false;
45745         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
45746         uint64_t ret_ref = 0;
45747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45749         return ret_ref;
45750 }
45751
45752 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
45753         LDKPayeePubKey o_conv;
45754         o_conv.inner = untag_ptr(o);
45755         o_conv.is_owned = ptr_is_owned(o);
45756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45757         o_conv.is_owned = false;
45758         int64_t ret_conv = PayeePubKey_hash(&o_conv);
45759         return ret_conv;
45760 }
45761
45762 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
45763         LDKPayeePubKey a_conv;
45764         a_conv.inner = untag_ptr(a);
45765         a_conv.is_owned = ptr_is_owned(a);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45767         a_conv.is_owned = false;
45768         LDKPayeePubKey b_conv;
45769         b_conv.inner = untag_ptr(b);
45770         b_conv.is_owned = ptr_is_owned(b);
45771         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45772         b_conv.is_owned = false;
45773         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
45774         return ret_conv;
45775 }
45776
45777 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
45778         LDKExpiryTime this_obj_conv;
45779         this_obj_conv.inner = untag_ptr(this_obj);
45780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45782         ExpiryTime_free(this_obj_conv);
45783 }
45784
45785 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
45786         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
45787         uint64_t ret_ref = 0;
45788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45790         return ret_ref;
45791 }
45792 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
45793         LDKExpiryTime arg_conv;
45794         arg_conv.inner = untag_ptr(arg);
45795         arg_conv.is_owned = ptr_is_owned(arg);
45796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45797         arg_conv.is_owned = false;
45798         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
45799         return ret_conv;
45800 }
45801
45802 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
45803         LDKExpiryTime orig_conv;
45804         orig_conv.inner = untag_ptr(orig);
45805         orig_conv.is_owned = ptr_is_owned(orig);
45806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45807         orig_conv.is_owned = false;
45808         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
45809         uint64_t ret_ref = 0;
45810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45812         return ret_ref;
45813 }
45814
45815 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
45816         LDKExpiryTime o_conv;
45817         o_conv.inner = untag_ptr(o);
45818         o_conv.is_owned = ptr_is_owned(o);
45819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45820         o_conv.is_owned = false;
45821         int64_t ret_conv = ExpiryTime_hash(&o_conv);
45822         return ret_conv;
45823 }
45824
45825 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
45826         LDKExpiryTime a_conv;
45827         a_conv.inner = untag_ptr(a);
45828         a_conv.is_owned = ptr_is_owned(a);
45829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45830         a_conv.is_owned = false;
45831         LDKExpiryTime b_conv;
45832         b_conv.inner = untag_ptr(b);
45833         b_conv.is_owned = ptr_is_owned(b);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45835         b_conv.is_owned = false;
45836         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
45837         return ret_conv;
45838 }
45839
45840 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
45841         LDKMinFinalCltvExpiry this_obj_conv;
45842         this_obj_conv.inner = untag_ptr(this_obj);
45843         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45845         MinFinalCltvExpiry_free(this_obj_conv);
45846 }
45847
45848 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
45849         LDKMinFinalCltvExpiry this_ptr_conv;
45850         this_ptr_conv.inner = untag_ptr(this_ptr);
45851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45853         this_ptr_conv.is_owned = false;
45854         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
45855         return ret_conv;
45856 }
45857
45858 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
45859         LDKMinFinalCltvExpiry this_ptr_conv;
45860         this_ptr_conv.inner = untag_ptr(this_ptr);
45861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45863         this_ptr_conv.is_owned = false;
45864         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
45865 }
45866
45867 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
45868         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
45869         uint64_t ret_ref = 0;
45870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45872         return ret_ref;
45873 }
45874
45875 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
45876         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
45877         uint64_t ret_ref = 0;
45878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45880         return ret_ref;
45881 }
45882 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
45883         LDKMinFinalCltvExpiry arg_conv;
45884         arg_conv.inner = untag_ptr(arg);
45885         arg_conv.is_owned = ptr_is_owned(arg);
45886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45887         arg_conv.is_owned = false;
45888         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
45889         return ret_conv;
45890 }
45891
45892 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
45893         LDKMinFinalCltvExpiry orig_conv;
45894         orig_conv.inner = untag_ptr(orig);
45895         orig_conv.is_owned = ptr_is_owned(orig);
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45897         orig_conv.is_owned = false;
45898         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
45899         uint64_t ret_ref = 0;
45900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45902         return ret_ref;
45903 }
45904
45905 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
45906         LDKMinFinalCltvExpiry o_conv;
45907         o_conv.inner = untag_ptr(o);
45908         o_conv.is_owned = ptr_is_owned(o);
45909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45910         o_conv.is_owned = false;
45911         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
45912         return ret_conv;
45913 }
45914
45915 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
45916         LDKMinFinalCltvExpiry a_conv;
45917         a_conv.inner = untag_ptr(a);
45918         a_conv.is_owned = ptr_is_owned(a);
45919         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45920         a_conv.is_owned = false;
45921         LDKMinFinalCltvExpiry b_conv;
45922         b_conv.inner = untag_ptr(b);
45923         b_conv.is_owned = ptr_is_owned(b);
45924         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45925         b_conv.is_owned = false;
45926         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
45927         return ret_conv;
45928 }
45929
45930 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
45931         if (!ptr_is_owned(this_ptr)) return;
45932         void* this_ptr_ptr = untag_ptr(this_ptr);
45933         CHECK_ACCESS(this_ptr_ptr);
45934         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
45935         FREE(untag_ptr(this_ptr));
45936         Fallback_free(this_ptr_conv);
45937 }
45938
45939 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
45940         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45941         *ret_copy = Fallback_clone(arg);
45942         uint64_t ret_ref = tag_ptr(ret_copy, true);
45943         return ret_ref;
45944 }
45945 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
45946         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
45947         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
45948         return ret_conv;
45949 }
45950
45951 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
45952         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
45953         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45954         *ret_copy = Fallback_clone(orig_conv);
45955         uint64_t ret_ref = tag_ptr(ret_copy, true);
45956         return ret_ref;
45957 }
45958
45959 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
45960         
45961         LDKCVec_u8Z program_ref;
45962         program_ref.datalen = program->arr_len;
45963         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
45964         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
45965         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45966         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
45967         uint64_t ret_ref = tag_ptr(ret_copy, true);
45968         return ret_ref;
45969 }
45970
45971 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
45972         LDKTwentyBytes a_ref;
45973         CHECK(a->arr_len == 20);
45974         memcpy(a_ref.data, a->elems, 20); FREE(a);
45975         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45976         *ret_copy = Fallback_pub_key_hash(a_ref);
45977         uint64_t ret_ref = tag_ptr(ret_copy, true);
45978         return ret_ref;
45979 }
45980
45981 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
45982         LDKTwentyBytes a_ref;
45983         CHECK(a->arr_len == 20);
45984         memcpy(a_ref.data, a->elems, 20); FREE(a);
45985         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
45986         *ret_copy = Fallback_script_hash(a_ref);
45987         uint64_t ret_ref = tag_ptr(ret_copy, true);
45988         return ret_ref;
45989 }
45990
45991 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
45992         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
45993         int64_t ret_conv = Fallback_hash(o_conv);
45994         return ret_conv;
45995 }
45996
45997 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
45998         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
45999         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
46000         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
46001         return ret_conv;
46002 }
46003
46004 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
46005         LDKInvoiceSignature this_obj_conv;
46006         this_obj_conv.inner = untag_ptr(this_obj);
46007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46009         InvoiceSignature_free(this_obj_conv);
46010 }
46011
46012 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46013         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46014         uint64_t ret_ref = 0;
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46017         return ret_ref;
46018 }
46019 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
46020         LDKInvoiceSignature arg_conv;
46021         arg_conv.inner = untag_ptr(arg);
46022         arg_conv.is_owned = ptr_is_owned(arg);
46023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46024         arg_conv.is_owned = false;
46025         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46026         return ret_conv;
46027 }
46028
46029 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
46030         LDKInvoiceSignature orig_conv;
46031         orig_conv.inner = untag_ptr(orig);
46032         orig_conv.is_owned = ptr_is_owned(orig);
46033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46034         orig_conv.is_owned = false;
46035         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46036         uint64_t ret_ref = 0;
46037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46039         return ret_ref;
46040 }
46041
46042 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
46043         LDKInvoiceSignature o_conv;
46044         o_conv.inner = untag_ptr(o);
46045         o_conv.is_owned = ptr_is_owned(o);
46046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46047         o_conv.is_owned = false;
46048         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
46049         return ret_conv;
46050 }
46051
46052 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
46053         LDKInvoiceSignature a_conv;
46054         a_conv.inner = untag_ptr(a);
46055         a_conv.is_owned = ptr_is_owned(a);
46056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46057         a_conv.is_owned = false;
46058         LDKInvoiceSignature b_conv;
46059         b_conv.inner = untag_ptr(b);
46060         b_conv.is_owned = ptr_is_owned(b);
46061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46062         b_conv.is_owned = false;
46063         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46064         return ret_conv;
46065 }
46066
46067 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
46068         LDKPrivateRoute this_obj_conv;
46069         this_obj_conv.inner = untag_ptr(this_obj);
46070         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46072         PrivateRoute_free(this_obj_conv);
46073 }
46074
46075 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46076         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46077         uint64_t ret_ref = 0;
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46080         return ret_ref;
46081 }
46082 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
46083         LDKPrivateRoute arg_conv;
46084         arg_conv.inner = untag_ptr(arg);
46085         arg_conv.is_owned = ptr_is_owned(arg);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46087         arg_conv.is_owned = false;
46088         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46089         return ret_conv;
46090 }
46091
46092 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
46093         LDKPrivateRoute orig_conv;
46094         orig_conv.inner = untag_ptr(orig);
46095         orig_conv.is_owned = ptr_is_owned(orig);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46097         orig_conv.is_owned = false;
46098         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46099         uint64_t ret_ref = 0;
46100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46102         return ret_ref;
46103 }
46104
46105 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
46106         LDKPrivateRoute o_conv;
46107         o_conv.inner = untag_ptr(o);
46108         o_conv.is_owned = ptr_is_owned(o);
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46110         o_conv.is_owned = false;
46111         int64_t ret_conv = PrivateRoute_hash(&o_conv);
46112         return ret_conv;
46113 }
46114
46115 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
46116         LDKPrivateRoute a_conv;
46117         a_conv.inner = untag_ptr(a);
46118         a_conv.is_owned = ptr_is_owned(a);
46119         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46120         a_conv.is_owned = false;
46121         LDKPrivateRoute b_conv;
46122         b_conv.inner = untag_ptr(b);
46123         b_conv.is_owned = ptr_is_owned(b);
46124         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46125         b_conv.is_owned = false;
46126         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46127         return ret_conv;
46128 }
46129
46130 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
46131         LDKSignedRawInvoice this_arg_conv;
46132         this_arg_conv.inner = untag_ptr(this_arg);
46133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46135         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46136         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46137         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46138         return tag_ptr(ret_conv, true);
46139 }
46140
46141 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
46142         LDKSignedRawInvoice this_arg_conv;
46143         this_arg_conv.inner = untag_ptr(this_arg);
46144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46146         this_arg_conv.is_owned = false;
46147         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46148         uint64_t ret_ref = 0;
46149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46151         return ret_ref;
46152 }
46153
46154 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
46155         LDKSignedRawInvoice this_arg_conv;
46156         this_arg_conv.inner = untag_ptr(this_arg);
46157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46159         this_arg_conv.is_owned = false;
46160         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46161         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
46162         return ret_arr;
46163 }
46164
46165 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
46166         LDKSignedRawInvoice this_arg_conv;
46167         this_arg_conv.inner = untag_ptr(this_arg);
46168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46170         this_arg_conv.is_owned = false;
46171         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46172         uint64_t ret_ref = 0;
46173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46175         return ret_ref;
46176 }
46177
46178 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
46179         LDKSignedRawInvoice this_arg_conv;
46180         this_arg_conv.inner = untag_ptr(this_arg);
46181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46183         this_arg_conv.is_owned = false;
46184         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46185         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46186         return tag_ptr(ret_conv, true);
46187 }
46188
46189 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
46190         LDKSignedRawInvoice this_arg_conv;
46191         this_arg_conv.inner = untag_ptr(this_arg);
46192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46194         this_arg_conv.is_owned = false;
46195         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46196         return ret_conv;
46197 }
46198
46199 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
46200         LDKRawInvoice this_arg_conv;
46201         this_arg_conv.inner = untag_ptr(this_arg);
46202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46204         this_arg_conv.is_owned = false;
46205         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46206         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
46207         return ret_arr;
46208 }
46209
46210 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
46211         LDKRawInvoice this_arg_conv;
46212         this_arg_conv.inner = untag_ptr(this_arg);
46213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46215         this_arg_conv.is_owned = false;
46216         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46217         uint64_t ret_ref = 0;
46218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46220         return ret_ref;
46221 }
46222
46223 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
46224         LDKRawInvoice this_arg_conv;
46225         this_arg_conv.inner = untag_ptr(this_arg);
46226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46228         this_arg_conv.is_owned = false;
46229         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46230         uint64_t ret_ref = 0;
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46233         return ret_ref;
46234 }
46235
46236 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
46237         LDKRawInvoice this_arg_conv;
46238         this_arg_conv.inner = untag_ptr(this_arg);
46239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46241         this_arg_conv.is_owned = false;
46242         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46243         uint64_t ret_ref = 0;
46244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46246         return ret_ref;
46247 }
46248
46249 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
46250         LDKRawInvoice this_arg_conv;
46251         this_arg_conv.inner = untag_ptr(this_arg);
46252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46254         this_arg_conv.is_owned = false;
46255         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
46256         uint64_t ret_ref = 0;
46257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46259         return ret_ref;
46260 }
46261
46262 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
46263         LDKRawInvoice this_arg_conv;
46264         this_arg_conv.inner = untag_ptr(this_arg);
46265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46267         this_arg_conv.is_owned = false;
46268         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
46269         uint64_t ret_ref = 0;
46270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46272         return ret_ref;
46273 }
46274
46275 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
46276         LDKRawInvoice this_arg_conv;
46277         this_arg_conv.inner = untag_ptr(this_arg);
46278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46280         this_arg_conv.is_owned = false;
46281         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
46282         uint64_t ret_ref = 0;
46283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46285         return ret_ref;
46286 }
46287
46288 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
46289         LDKRawInvoice this_arg_conv;
46290         this_arg_conv.inner = untag_ptr(this_arg);
46291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46293         this_arg_conv.is_owned = false;
46294         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46295         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
46296         return ret_arr;
46297 }
46298
46299 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
46300         LDKRawInvoice this_arg_conv;
46301         this_arg_conv.inner = untag_ptr(this_arg);
46302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46304         this_arg_conv.is_owned = false;
46305         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
46306         uint64_t ret_ref = 0;
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46309         return ret_ref;
46310 }
46311
46312 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
46313         LDKRawInvoice this_arg_conv;
46314         this_arg_conv.inner = untag_ptr(this_arg);
46315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46317         this_arg_conv.is_owned = false;
46318         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
46319         uint64_tArray ret_arr = NULL;
46320         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46321         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46322         for (size_t o = 0; o < ret_var.datalen; o++) {
46323                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46324                 uint64_t ret_conv_14_ref = 0;
46325                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46326                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46327                 ret_arr_ptr[o] = ret_conv_14_ref;
46328         }
46329         
46330         FREE(ret_var.data);
46331         return ret_arr;
46332 }
46333
46334 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
46335         LDKRawInvoice this_arg_conv;
46336         this_arg_conv.inner = untag_ptr(this_arg);
46337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46339         this_arg_conv.is_owned = false;
46340         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46341         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
46342         uint64_t ret_ref = tag_ptr(ret_copy, true);
46343         return ret_ref;
46344 }
46345
46346 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
46347         LDKRawInvoice this_arg_conv;
46348         this_arg_conv.inner = untag_ptr(this_arg);
46349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46351         this_arg_conv.is_owned = false;
46352         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
46353         return ret_conv;
46354 }
46355
46356 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
46357         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46358         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
46359         return tag_ptr(ret_conv, true);
46360 }
46361
46362 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
46363         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46364         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
46365         return tag_ptr(ret_conv, true);
46366 }
46367
46368 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
46369         LDKPositiveTimestamp this_arg_conv;
46370         this_arg_conv.inner = untag_ptr(this_arg);
46371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46373         this_arg_conv.is_owned = false;
46374         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
46375         return ret_conv;
46376 }
46377
46378 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
46379         LDKPositiveTimestamp this_arg_conv;
46380         this_arg_conv.inner = untag_ptr(this_arg);
46381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46383         this_arg_conv.is_owned = false;
46384         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
46385         return ret_conv;
46386 }
46387
46388 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
46389         LDKInvoice this_arg_conv;
46390         this_arg_conv.inner = untag_ptr(this_arg);
46391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46393         this_arg_conv = Invoice_clone(&this_arg_conv);
46394         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
46395         uint64_t ret_ref = 0;
46396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46398         return ret_ref;
46399 }
46400
46401 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
46402         LDKInvoice this_arg_conv;
46403         this_arg_conv.inner = untag_ptr(this_arg);
46404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46406         this_arg_conv.is_owned = false;
46407         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
46408         *ret_conv = Invoice_check_signature(&this_arg_conv);
46409         return tag_ptr(ret_conv, true);
46410 }
46411
46412 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
46413         LDKSignedRawInvoice signed_invoice_conv;
46414         signed_invoice_conv.inner = untag_ptr(signed_invoice);
46415         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
46416         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
46417         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
46418         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
46419         *ret_conv = Invoice_from_signed(signed_invoice_conv);
46420         return tag_ptr(ret_conv, true);
46421 }
46422
46423 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
46424         LDKInvoice this_arg_conv;
46425         this_arg_conv.inner = untag_ptr(this_arg);
46426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46428         this_arg_conv.is_owned = false;
46429         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
46430         return ret_conv;
46431 }
46432
46433 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
46434         LDKInvoice this_arg_conv;
46435         this_arg_conv.inner = untag_ptr(this_arg);
46436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46438         this_arg_conv.is_owned = false;
46439         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46440         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
46441         return ret_arr;
46442 }
46443
46444 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
46445         LDKInvoice this_arg_conv;
46446         this_arg_conv.inner = untag_ptr(this_arg);
46447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46449         this_arg_conv.is_owned = false;
46450         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46451         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
46452         return ret_arr;
46453 }
46454
46455 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
46456         LDKInvoice this_arg_conv;
46457         this_arg_conv.inner = untag_ptr(this_arg);
46458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46460         this_arg_conv.is_owned = false;
46461         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46462         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
46463         return ret_arr;
46464 }
46465
46466 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
46467         LDKInvoice this_arg_conv;
46468         this_arg_conv.inner = untag_ptr(this_arg);
46469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46471         this_arg_conv.is_owned = false;
46472         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
46473         uint64_t ret_ref = 0;
46474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46476         return ret_ref;
46477 }
46478
46479 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
46480         LDKInvoice this_arg_conv;
46481         this_arg_conv.inner = untag_ptr(this_arg);
46482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46484         this_arg_conv.is_owned = false;
46485         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46486         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
46487         return ret_arr;
46488 }
46489
46490 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
46491         LDKInvoice this_arg_conv;
46492         this_arg_conv.inner = untag_ptr(this_arg);
46493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46495         this_arg_conv.is_owned = false;
46496         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
46497         return ret_conv;
46498 }
46499
46500 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
46501         LDKInvoice this_arg_conv;
46502         this_arg_conv.inner = untag_ptr(this_arg);
46503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46505         this_arg_conv.is_owned = false;
46506         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
46507         return ret_conv;
46508 }
46509
46510 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
46511         LDKInvoice this_arg_conv;
46512         this_arg_conv.inner = untag_ptr(this_arg);
46513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46515         this_arg_conv.is_owned = false;
46516         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
46517         return ret_conv;
46518 }
46519
46520 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
46521         LDKInvoice this_arg_conv;
46522         this_arg_conv.inner = untag_ptr(this_arg);
46523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46525         this_arg_conv.is_owned = false;
46526         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
46527         uint64_tArray ret_arr = NULL;
46528         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46529         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46530         for (size_t o = 0; o < ret_var.datalen; o++) {
46531                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46532                 uint64_t ret_conv_14_ref = 0;
46533                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46534                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46535                 ret_arr_ptr[o] = ret_conv_14_ref;
46536         }
46537         
46538         FREE(ret_var.data);
46539         return ret_arr;
46540 }
46541
46542 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
46543         LDKInvoice this_arg_conv;
46544         this_arg_conv.inner = untag_ptr(this_arg);
46545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46547         this_arg_conv.is_owned = false;
46548         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
46549         uint64_tArray ret_arr = NULL;
46550         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
46551         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
46552         for (size_t l = 0; l < ret_var.datalen; l++) {
46553                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
46554                 uint64_t ret_conv_11_ref = 0;
46555                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
46556                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
46557                 ret_arr_ptr[l] = ret_conv_11_ref;
46558         }
46559         
46560         FREE(ret_var.data);
46561         return ret_arr;
46562 }
46563
46564 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
46565         LDKInvoice this_arg_conv;
46566         this_arg_conv.inner = untag_ptr(this_arg);
46567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46569         this_arg_conv.is_owned = false;
46570         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
46571         return ret_conv;
46572 }
46573
46574 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
46575         LDKInvoice this_arg_conv;
46576         this_arg_conv.inner = untag_ptr(this_arg);
46577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46579         this_arg_conv.is_owned = false;
46580         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46581         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
46582         uint64_t ret_ref = tag_ptr(ret_copy, true);
46583         return ret_ref;
46584 }
46585
46586 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
46587         LDKStr description_conv = str_ref_to_owned_c(description);
46588         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
46589         *ret_conv = Description_new(description_conv);
46590         return tag_ptr(ret_conv, true);
46591 }
46592
46593 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
46594         LDKDescription this_arg_conv;
46595         this_arg_conv.inner = untag_ptr(this_arg);
46596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46598         this_arg_conv = Description_clone(&this_arg_conv);
46599         LDKStr ret_str = Description_into_inner(this_arg_conv);
46600         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46601         Str_free(ret_str);
46602         return ret_conv;
46603 }
46604
46605 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
46606         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
46607         uint64_t ret_ref = 0;
46608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46610         return ret_ref;
46611 }
46612
46613 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
46614         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
46615         uint64_t ret_ref = 0;
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46618         return ret_ref;
46619 }
46620
46621 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
46622         LDKExpiryTime this_arg_conv;
46623         this_arg_conv.inner = untag_ptr(this_arg);
46624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46626         this_arg_conv.is_owned = false;
46627         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
46628         return ret_conv;
46629 }
46630
46631 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
46632         LDKExpiryTime this_arg_conv;
46633         this_arg_conv.inner = untag_ptr(this_arg);
46634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46636         this_arg_conv.is_owned = false;
46637         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
46638         return ret_conv;
46639 }
46640
46641 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
46642         LDKRouteHint hops_conv;
46643         hops_conv.inner = untag_ptr(hops);
46644         hops_conv.is_owned = ptr_is_owned(hops);
46645         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
46646         hops_conv = RouteHint_clone(&hops_conv);
46647         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
46648         *ret_conv = PrivateRoute_new(hops_conv);
46649         return tag_ptr(ret_conv, true);
46650 }
46651
46652 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
46653         LDKPrivateRoute this_arg_conv;
46654         this_arg_conv.inner = untag_ptr(this_arg);
46655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46657         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
46658         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
46659         uint64_t ret_ref = 0;
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46662         return ret_ref;
46663 }
46664
46665 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
46666         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
46667         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
46668         return ret_conv;
46669 }
46670
46671 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
46672         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
46673         return ret_conv;
46674 }
46675
46676 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
46677         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
46678         return ret_conv;
46679 }
46680
46681 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
46682         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
46683         return ret_conv;
46684 }
46685
46686 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
46687         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
46688         return ret_conv;
46689 }
46690
46691 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
46692         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
46693         return ret_conv;
46694 }
46695
46696 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
46697         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
46698         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
46699         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
46700         return ret_conv;
46701 }
46702
46703 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
46704         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
46705         LDKStr ret_str = CreationError_to_str(o_conv);
46706         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46707         Str_free(ret_str);
46708         return ret_conv;
46709 }
46710
46711 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
46712         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
46713         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
46714         return ret_conv;
46715 }
46716
46717 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
46718         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
46719         return ret_conv;
46720 }
46721
46722 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
46723         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
46724         return ret_conv;
46725 }
46726
46727 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
46728         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
46729         return ret_conv;
46730 }
46731
46732 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
46733         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
46734         return ret_conv;
46735 }
46736
46737 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
46738         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
46739         return ret_conv;
46740 }
46741
46742 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
46743         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
46744         return ret_conv;
46745 }
46746
46747 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
46748         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
46749         return ret_conv;
46750 }
46751
46752 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
46753         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
46754         return ret_conv;
46755 }
46756
46757 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
46758         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
46759         return ret_conv;
46760 }
46761
46762 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
46763         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
46764         return ret_conv;
46765 }
46766
46767 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
46768         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
46769         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
46770         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
46771         return ret_conv;
46772 }
46773
46774 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
46775         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
46776         LDKStr ret_str = SemanticError_to_str(o_conv);
46777         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46778         Str_free(ret_str);
46779         return ret_conv;
46780 }
46781
46782 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
46783         if (!ptr_is_owned(this_ptr)) return;
46784         void* this_ptr_ptr = untag_ptr(this_ptr);
46785         CHECK_ACCESS(this_ptr_ptr);
46786         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
46787         FREE(untag_ptr(this_ptr));
46788         SignOrCreationError_free(this_ptr_conv);
46789 }
46790
46791 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
46792         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46793         *ret_copy = SignOrCreationError_clone(arg);
46794         uint64_t ret_ref = tag_ptr(ret_copy, true);
46795         return ret_ref;
46796 }
46797 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
46798         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
46799         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
46800         return ret_conv;
46801 }
46802
46803 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
46804         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
46805         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46806         *ret_copy = SignOrCreationError_clone(orig_conv);
46807         uint64_t ret_ref = tag_ptr(ret_copy, true);
46808         return ret_ref;
46809 }
46810
46811 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
46812         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46813         *ret_copy = SignOrCreationError_sign_error();
46814         uint64_t ret_ref = tag_ptr(ret_copy, true);
46815         return ret_ref;
46816 }
46817
46818 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
46819         LDKCreationError a_conv = LDKCreationError_from_js(a);
46820         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
46821         *ret_copy = SignOrCreationError_creation_error(a_conv);
46822         uint64_t ret_ref = tag_ptr(ret_copy, true);
46823         return ret_ref;
46824 }
46825
46826 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
46827         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
46828         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
46829         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
46830         return ret_conv;
46831 }
46832
46833 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
46834         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
46835         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
46836         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46837         Str_free(ret_str);
46838         return ret_conv;
46839 }
46840
46841 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
46842         LDKInvoicePayer this_obj_conv;
46843         this_obj_conv.inner = untag_ptr(this_obj);
46844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46846         InvoicePayer_free(this_obj_conv);
46847 }
46848
46849 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
46850         if (!ptr_is_owned(this_ptr)) return;
46851         void* this_ptr_ptr = untag_ptr(this_ptr);
46852         CHECK_ACCESS(this_ptr_ptr);
46853         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
46854         FREE(untag_ptr(this_ptr));
46855         Payer_free(this_ptr_conv);
46856 }
46857
46858 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
46859         if (!ptr_is_owned(this_ptr)) return;
46860         void* this_ptr_ptr = untag_ptr(this_ptr);
46861         CHECK_ACCESS(this_ptr_ptr);
46862         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
46863         FREE(untag_ptr(this_ptr));
46864         Router_free(this_ptr_conv);
46865 }
46866
46867 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
46868         if (!ptr_is_owned(this_ptr)) return;
46869         void* this_ptr_ptr = untag_ptr(this_ptr);
46870         CHECK_ACCESS(this_ptr_ptr);
46871         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
46872         FREE(untag_ptr(this_ptr));
46873         Retry_free(this_ptr_conv);
46874 }
46875
46876 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
46877         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46878         *ret_copy = Retry_clone(arg);
46879         uint64_t ret_ref = tag_ptr(ret_copy, true);
46880         return ret_ref;
46881 }
46882 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
46883         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
46884         int64_t ret_conv = Retry_clone_ptr(arg_conv);
46885         return ret_conv;
46886 }
46887
46888 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
46889         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
46890         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46891         *ret_copy = Retry_clone(orig_conv);
46892         uint64_t ret_ref = tag_ptr(ret_copy, true);
46893         return ret_ref;
46894 }
46895
46896 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
46897         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
46898         *ret_copy = Retry_attempts(a);
46899         uint64_t ret_ref = tag_ptr(ret_copy, true);
46900         return ret_ref;
46901 }
46902
46903 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
46904         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
46905         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
46906         jboolean ret_conv = Retry_eq(a_conv, b_conv);
46907         return ret_conv;
46908 }
46909
46910 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
46911         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
46912         int64_t ret_conv = Retry_hash(o_conv);
46913         return ret_conv;
46914 }
46915
46916 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
46917         if (!ptr_is_owned(this_ptr)) return;
46918         void* this_ptr_ptr = untag_ptr(this_ptr);
46919         CHECK_ACCESS(this_ptr_ptr);
46920         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
46921         FREE(untag_ptr(this_ptr));
46922         PaymentError_free(this_ptr_conv);
46923 }
46924
46925 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
46926         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46927         *ret_copy = PaymentError_clone(arg);
46928         uint64_t ret_ref = tag_ptr(ret_copy, true);
46929         return ret_ref;
46930 }
46931 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
46932         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
46933         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
46934         return ret_conv;
46935 }
46936
46937 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
46938         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
46939         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46940         *ret_copy = PaymentError_clone(orig_conv);
46941         uint64_t ret_ref = tag_ptr(ret_copy, true);
46942         return ret_ref;
46943 }
46944
46945 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
46946         LDKStr a_conv = str_ref_to_owned_c(a);
46947         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46948         *ret_copy = PaymentError_invoice(a_conv);
46949         uint64_t ret_ref = tag_ptr(ret_copy, true);
46950         return ret_ref;
46951 }
46952
46953 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
46954         LDKLightningError a_conv;
46955         a_conv.inner = untag_ptr(a);
46956         a_conv.is_owned = ptr_is_owned(a);
46957         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46958         a_conv = LightningError_clone(&a_conv);
46959         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46960         *ret_copy = PaymentError_routing(a_conv);
46961         uint64_t ret_ref = tag_ptr(ret_copy, true);
46962         return ret_ref;
46963 }
46964
46965 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
46966         void* a_ptr = untag_ptr(a);
46967         CHECK_ACCESS(a_ptr);
46968         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
46969         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
46970         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
46971         *ret_copy = PaymentError_sending(a_conv);
46972         uint64_t ret_ref = tag_ptr(ret_copy, true);
46973         return ret_ref;
46974 }
46975
46976 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) {
46977         void* payer_ptr = untag_ptr(payer);
46978         CHECK_ACCESS(payer_ptr);
46979         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
46980         if (payer_conv.free == LDKPayer_JCalls_free) {
46981                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46982                 LDKPayer_JCalls_cloned(&payer_conv);
46983         }
46984         void* router_ptr = untag_ptr(router);
46985         CHECK_ACCESS(router_ptr);
46986         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
46987         if (router_conv.free == LDKRouter_JCalls_free) {
46988                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46989                 LDKRouter_JCalls_cloned(&router_conv);
46990         }
46991         void* logger_ptr = untag_ptr(logger);
46992         CHECK_ACCESS(logger_ptr);
46993         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46994         if (logger_conv.free == LDKLogger_JCalls_free) {
46995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46996                 LDKLogger_JCalls_cloned(&logger_conv);
46997         }
46998         void* event_handler_ptr = untag_ptr(event_handler);
46999         CHECK_ACCESS(event_handler_ptr);
47000         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47001         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47003                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47004         }
47005         void* retry_ptr = untag_ptr(retry);
47006         CHECK_ACCESS(retry_ptr);
47007         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47008         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
47009         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
47010         uint64_t ret_ref = 0;
47011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47013         return ret_ref;
47014 }
47015
47016 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
47017         LDKInvoicePayer this_arg_conv;
47018         this_arg_conv.inner = untag_ptr(this_arg);
47019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47021         this_arg_conv.is_owned = false;
47022         LDKInvoice invoice_conv;
47023         invoice_conv.inner = untag_ptr(invoice);
47024         invoice_conv.is_owned = ptr_is_owned(invoice);
47025         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47026         invoice_conv.is_owned = false;
47027         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47028         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47029         return tag_ptr(ret_conv, true);
47030 }
47031
47032 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) {
47033         LDKInvoicePayer this_arg_conv;
47034         this_arg_conv.inner = untag_ptr(this_arg);
47035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47037         this_arg_conv.is_owned = false;
47038         LDKInvoice invoice_conv;
47039         invoice_conv.inner = untag_ptr(invoice);
47040         invoice_conv.is_owned = ptr_is_owned(invoice);
47041         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47042         invoice_conv.is_owned = false;
47043         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47044         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47045         return tag_ptr(ret_conv, true);
47046 }
47047
47048 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) {
47049         LDKInvoicePayer this_arg_conv;
47050         this_arg_conv.inner = untag_ptr(this_arg);
47051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47053         this_arg_conv.is_owned = false;
47054         LDKPublicKey pubkey_ref;
47055         CHECK(pubkey->arr_len == 33);
47056         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
47057         LDKThirtyTwoBytes payment_preimage_ref;
47058         CHECK(payment_preimage->arr_len == 32);
47059         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
47060         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47061         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47062         return tag_ptr(ret_conv, true);
47063 }
47064
47065 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
47066         LDKInvoicePayer this_arg_conv;
47067         this_arg_conv.inner = untag_ptr(this_arg);
47068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47070         this_arg_conv.is_owned = false;
47071         unsigned char payment_hash_arr[32];
47072         CHECK(payment_hash->arr_len == 32);
47073         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
47074         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47075         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47076 }
47077
47078 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
47079         LDKInvoicePayer this_arg_conv;
47080         this_arg_conv.inner = untag_ptr(this_arg);
47081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47083         this_arg_conv.is_owned = false;
47084         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47085         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47086         return tag_ptr(ret_ret, true);
47087 }
47088
47089 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
47090         LDKInFlightHtlcs this_obj_conv;
47091         this_obj_conv.inner = untag_ptr(this_obj);
47092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47094         InFlightHtlcs_free(this_obj_conv);
47095 }
47096
47097 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) {
47098         LDKInFlightHtlcs this_arg_conv;
47099         this_arg_conv.inner = untag_ptr(this_arg);
47100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47102         this_arg_conv.is_owned = false;
47103         LDKNodeId source_conv;
47104         source_conv.inner = untag_ptr(source);
47105         source_conv.is_owned = ptr_is_owned(source);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
47107         source_conv.is_owned = false;
47108         LDKNodeId target_conv;
47109         target_conv.inner = untag_ptr(target);
47110         target_conv.is_owned = ptr_is_owned(target);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47112         target_conv.is_owned = false;
47113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47114         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
47115         uint64_t ret_ref = tag_ptr(ret_copy, true);
47116         return ret_ref;
47117 }
47118
47119 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
47120         LDKInFlightHtlcs obj_conv;
47121         obj_conv.inner = untag_ptr(obj);
47122         obj_conv.is_owned = ptr_is_owned(obj);
47123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47124         obj_conv.is_owned = false;
47125         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
47126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47128         CVec_u8Z_free(ret_var);
47129         return ret_arr;
47130 }
47131
47132 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
47133         LDKu8slice ser_ref;
47134         ser_ref.datalen = ser->arr_len;
47135         ser_ref.data = ser->elems;
47136         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
47137         *ret_conv = InFlightHtlcs_read(ser_ref);
47138         FREE(ser);
47139         return tag_ptr(ret_conv, true);
47140 }
47141
47142 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) {
47143         LDKChannelManager channelmanager_conv;
47144         channelmanager_conv.inner = untag_ptr(channelmanager);
47145         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47146         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47147         channelmanager_conv.is_owned = false;
47148         void* keys_manager_ptr = untag_ptr(keys_manager);
47149         CHECK_ACCESS(keys_manager_ptr);
47150         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47151         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47152                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47153                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47154         }
47155         void* logger_ptr = untag_ptr(logger);
47156         CHECK_ACCESS(logger_ptr);
47157         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47158         if (logger_conv.free == LDKLogger_JCalls_free) {
47159                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47160                 LDKLogger_JCalls_cloned(&logger_conv);
47161         }
47162         LDKCurrency network_conv = LDKCurrency_from_js(network);
47163         void* amt_msat_ptr = untag_ptr(amt_msat);
47164         CHECK_ACCESS(amt_msat_ptr);
47165         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47166         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47167         LDKSha256 description_hash_conv;
47168         description_hash_conv.inner = untag_ptr(description_hash);
47169         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47170         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47171         description_hash_conv = Sha256_clone(&description_hash_conv);
47172         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47173         *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);
47174         return tag_ptr(ret_conv, true);
47175 }
47176
47177 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) {
47178         LDKChannelManager channelmanager_conv;
47179         channelmanager_conv.inner = untag_ptr(channelmanager);
47180         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47181         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47182         channelmanager_conv.is_owned = false;
47183         void* keys_manager_ptr = untag_ptr(keys_manager);
47184         CHECK_ACCESS(keys_manager_ptr);
47185         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47186         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47187                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47188                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47189         }
47190         void* logger_ptr = untag_ptr(logger);
47191         CHECK_ACCESS(logger_ptr);
47192         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47193         if (logger_conv.free == LDKLogger_JCalls_free) {
47194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47195                 LDKLogger_JCalls_cloned(&logger_conv);
47196         }
47197         LDKCurrency network_conv = LDKCurrency_from_js(network);
47198         void* amt_msat_ptr = untag_ptr(amt_msat);
47199         CHECK_ACCESS(amt_msat_ptr);
47200         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47201         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47202         LDKStr description_conv = str_ref_to_owned_c(description);
47203         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47204         *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);
47205         return tag_ptr(ret_conv, true);
47206 }
47207
47208 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
47209         LDKDefaultRouter this_obj_conv;
47210         this_obj_conv.inner = untag_ptr(this_obj);
47211         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47213         DefaultRouter_free(this_obj_conv);
47214 }
47215
47216 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) {
47217         LDKNetworkGraph network_graph_conv;
47218         network_graph_conv.inner = untag_ptr(network_graph);
47219         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47220         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47221         network_graph_conv.is_owned = false;
47222         void* logger_ptr = untag_ptr(logger);
47223         CHECK_ACCESS(logger_ptr);
47224         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47225         if (logger_conv.free == LDKLogger_JCalls_free) {
47226                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47227                 LDKLogger_JCalls_cloned(&logger_conv);
47228         }
47229         LDKThirtyTwoBytes random_seed_bytes_ref;
47230         CHECK(random_seed_bytes->arr_len == 32);
47231         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
47232         void* scorer_ptr = untag_ptr(scorer);
47233         CHECK_ACCESS(scorer_ptr);
47234         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
47235         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
47236                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47237                 LDKLockableScore_JCalls_cloned(&scorer_conv);
47238         }
47239         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
47240         uint64_t ret_ref = 0;
47241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47243         return ret_ref;
47244 }
47245
47246 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
47247         LDKDefaultRouter this_arg_conv;
47248         this_arg_conv.inner = untag_ptr(this_arg);
47249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47251         this_arg_conv.is_owned = false;
47252         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
47253         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
47254         return tag_ptr(ret_ret, true);
47255 }
47256
47257 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
47258         LDKChannelManager this_arg_conv;
47259         this_arg_conv.inner = untag_ptr(this_arg);
47260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47262         this_arg_conv.is_owned = false;
47263         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
47264         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
47265         return tag_ptr(ret_ret, true);
47266 }
47267
47268 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
47269         LDKStr s_conv = str_ref_to_owned_c(s);
47270         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
47271         *ret_conv = SiPrefix_from_str(s_conv);
47272         return tag_ptr(ret_conv, true);
47273 }
47274
47275 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
47276         LDKStr s_conv = str_ref_to_owned_c(s);
47277         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
47278         *ret_conv = Invoice_from_str(s_conv);
47279         return tag_ptr(ret_conv, true);
47280 }
47281
47282 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
47283         LDKStr s_conv = str_ref_to_owned_c(s);
47284         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
47285         *ret_conv = SignedRawInvoice_from_str(s_conv);
47286         return tag_ptr(ret_conv, true);
47287 }
47288
47289 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
47290         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
47291         LDKStr ret_str = ParseError_to_str(o_conv);
47292         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47293         Str_free(ret_str);
47294         return ret_conv;
47295 }
47296
47297 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
47298         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
47299         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
47300         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47301         Str_free(ret_str);
47302         return ret_conv;
47303 }
47304
47305 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
47306         LDKInvoice o_conv;
47307         o_conv.inner = untag_ptr(o);
47308         o_conv.is_owned = ptr_is_owned(o);
47309         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47310         o_conv.is_owned = false;
47311         LDKStr ret_str = Invoice_to_str(&o_conv);
47312         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47313         Str_free(ret_str);
47314         return ret_conv;
47315 }
47316
47317 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
47318         LDKSignedRawInvoice o_conv;
47319         o_conv.inner = untag_ptr(o);
47320         o_conv.is_owned = ptr_is_owned(o);
47321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47322         o_conv.is_owned = false;
47323         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
47324         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47325         Str_free(ret_str);
47326         return ret_conv;
47327 }
47328
47329 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
47330         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
47331         LDKStr ret_str = Currency_to_str(o_conv);
47332         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47333         Str_free(ret_str);
47334         return ret_conv;
47335 }
47336
47337 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
47338         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
47339         LDKStr ret_str = SiPrefix_to_str(o_conv);
47340         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
47341         Str_free(ret_str);
47342         return ret_conv;
47343 }
47344