Merge pull request #124 from TheBlueMatt/main
[ldk-java] / ts / bindings.c.body
1 #include "js-wasm.h"
2 #include <stdatomic.h>
3 #include <lightning.h>
4
5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
9
10 extern void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12         if (!expression) { abort(); }
13 }
14
15 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
16         return val == 0xdeadbeef0badf00dULL;
17 }
18
19
20 void *malloc(size_t size);
21 void free(void *ptr);
22
23 #define MALLOC(a, _) malloc(a)
24 #define do_MALLOC(a, _b, _c) malloc(a)
25 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
26 #define DO_ASSERT(a) (void)(a)
27 #define CHECK(a)
28 #define CHECK_ACCESS(p)
29 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
30
31 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
32 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
33 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
34 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
35
36 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
37
38 #define DECL_ARR_TYPE(ty, name) \
39         struct name##array { \
40                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
41                 ty elems[]; \
42         }; \
43         typedef struct name##array * name##Array; \
44         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
45                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
46                 arr->arr_len = arr_len; \
47                 return arr; \
48         }
49
50 DECL_ARR_TYPE(int64_t, int64_t);
51 DECL_ARR_TYPE(uint64_t, uint64_t);
52 DECL_ARR_TYPE(int8_t, int8_t);
53 DECL_ARR_TYPE(uint32_t, uint32_t);
54 DECL_ARR_TYPE(void*, ptr);
55 DECL_ARR_TYPE(char, char);
56 typedef charArray jstring;
57
58 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
59         charArray arr = init_charArray(len, __LINE__);
60         memcpy(arr->elems, chars, len);
61         return arr;
62 }
63 static inline LDKStr str_ref_to_owned_c(const jstring str) {
64         char* newchars = MALLOC(str->arr_len + 1, "String chars");
65         memcpy(newchars, str->elems, str->arr_len);
66         newchars[str->arr_len] = 0;
67         LDKStr res = {
68                 .chars = newchars,
69                 .len = str->arr_len,
70                 .chars_is_owned = true
71         };
72         return res;
73 }
74
75 typedef bool jboolean;
76
77 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
78         return (uint32_t)MALLOC(size, "JS-Called malloc");
79 }
80 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
81         FREE((void*)ptr);
82 }
83
84 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
85         const char *res = check_get_ldk_bindings_version();
86         if (res == NULL) return NULL;
87         return str_ref_to_ts(res, strlen(res));
88 }
89 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
90         const char *res = check_get_ldk_version();
91         if (res == NULL) return NULL;
92         return str_ref_to_ts(res, strlen(res));
93 }
94 #include "version.c"
95 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
96
97 static inline void* untag_ptr(uint64_t ptr) {
98         if (ptr < 4096) return (void*)ptr;
99         if (sizeof(void*) == 4) {
100                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
101                 return (void*)(uintptr_t)ptr;
102         } else {
103                 // For 64-bit systems, assume the top byte is used for tagging, then
104                 // use bit 9 ^ bit 10.
105                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
106                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
107 #ifdef LDK_DEBUG_BUILD
108                 // On debug builds we also use the 11th bit as a debug flag
109                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
110                 CHECK(tenth_bit != eleventh_bit);
111                 p ^= 1ULL << 53;
112 #endif
113                 return (void*)p;
114         }
115 }
116 static inline bool ptr_is_owned(uint64_t ptr) {
117         if(ptr < 4096) return true;
118         if (sizeof(void*) == 4) {
119                 return ptr & (1ULL << 32);
120         } else {
121                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
122                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
123 #ifdef LDK_DEBUG_BUILD
124                 // On debug builds we also use the 11th bit as a debug flag
125                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
126                 CHECK(tenth_bit != eleventh_bit);
127 #endif
128                 return (ninth_bit ^ tenth_bit) ? true : false;
129         }
130 }
131 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
132         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
133         if (sizeof(void*) == 4) {
134                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
135         } else {
136                 CHECK(sizeof(uintptr_t) == 8);
137                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
138                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
139 #ifdef LDK_DEBUG_BUILD
140                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
141                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
142                 CHECK(ninth_bit == tenth_bit);
143                 CHECK(ninth_bit == eleventh_bit);
144                 t ^= 1ULL << 53;
145 #endif
146                 CHECK(ptr_is_owned(t) == is_owned);
147                 CHECK(untag_ptr(t) == ptr);
148                 return t;
149         }
150 }
151
152 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
153         switch (ord) {
154                 case 0: return LDKAccessError_UnknownChain;
155                 case 1: return LDKAccessError_UnknownTx;
156         }
157         abort();
158 }
159 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
160         switch (val) {
161                 case LDKAccessError_UnknownChain: return 0;
162                 case LDKAccessError_UnknownTx: return 1;
163                 default: abort();
164         }
165 }
166 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
167         switch (ord) {
168                 case 0: return LDKCOption_NoneZ_Some;
169                 case 1: return LDKCOption_NoneZ_None;
170         }
171         abort();
172 }
173 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
174         switch (val) {
175                 case LDKCOption_NoneZ_Some: return 0;
176                 case LDKCOption_NoneZ_None: return 1;
177                 default: abort();
178         }
179 }
180 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
181         switch (ord) {
182                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
183                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
184                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
185         }
186         abort();
187 }
188 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
189         switch (val) {
190                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
191                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
192                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
193                 default: abort();
194         }
195 }
196 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
197         switch (ord) {
198                 case 0: return LDKConfirmationTarget_Background;
199                 case 1: return LDKConfirmationTarget_Normal;
200                 case 2: return LDKConfirmationTarget_HighPriority;
201         }
202         abort();
203 }
204 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
205         switch (val) {
206                 case LDKConfirmationTarget_Background: return 0;
207                 case LDKConfirmationTarget_Normal: return 1;
208                 case LDKConfirmationTarget_HighPriority: return 2;
209                 default: abort();
210         }
211 }
212 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
213         switch (ord) {
214                 case 0: return LDKCreationError_DescriptionTooLong;
215                 case 1: return LDKCreationError_RouteTooLong;
216                 case 2: return LDKCreationError_TimestampOutOfBounds;
217                 case 3: return LDKCreationError_InvalidAmount;
218                 case 4: return LDKCreationError_MissingRouteHints;
219         }
220         abort();
221 }
222 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
223         switch (val) {
224                 case LDKCreationError_DescriptionTooLong: return 0;
225                 case LDKCreationError_RouteTooLong: return 1;
226                 case LDKCreationError_TimestampOutOfBounds: return 2;
227                 case LDKCreationError_InvalidAmount: return 3;
228                 case LDKCreationError_MissingRouteHints: return 4;
229                 default: abort();
230         }
231 }
232 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
233         switch (ord) {
234                 case 0: return LDKCurrency_Bitcoin;
235                 case 1: return LDKCurrency_BitcoinTestnet;
236                 case 2: return LDKCurrency_Regtest;
237                 case 3: return LDKCurrency_Simnet;
238                 case 4: return LDKCurrency_Signet;
239         }
240         abort();
241 }
242 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
243         switch (val) {
244                 case LDKCurrency_Bitcoin: return 0;
245                 case LDKCurrency_BitcoinTestnet: return 1;
246                 case LDKCurrency_Regtest: return 2;
247                 case LDKCurrency_Simnet: return 3;
248                 case LDKCurrency_Signet: return 4;
249                 default: abort();
250         }
251 }
252 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
253         switch (ord) {
254                 case 0: return LDKHTLCClaim_OfferedTimeout;
255                 case 1: return LDKHTLCClaim_OfferedPreimage;
256                 case 2: return LDKHTLCClaim_AcceptedTimeout;
257                 case 3: return LDKHTLCClaim_AcceptedPreimage;
258                 case 4: return LDKHTLCClaim_Revocation;
259         }
260         abort();
261 }
262 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
263         switch (val) {
264                 case LDKHTLCClaim_OfferedTimeout: return 0;
265                 case LDKHTLCClaim_OfferedPreimage: return 1;
266                 case LDKHTLCClaim_AcceptedTimeout: return 2;
267                 case LDKHTLCClaim_AcceptedPreimage: return 3;
268                 case LDKHTLCClaim_Revocation: return 4;
269                 default: abort();
270         }
271 }
272 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
273         switch (ord) {
274                 case 0: return LDKIOError_NotFound;
275                 case 1: return LDKIOError_PermissionDenied;
276                 case 2: return LDKIOError_ConnectionRefused;
277                 case 3: return LDKIOError_ConnectionReset;
278                 case 4: return LDKIOError_ConnectionAborted;
279                 case 5: return LDKIOError_NotConnected;
280                 case 6: return LDKIOError_AddrInUse;
281                 case 7: return LDKIOError_AddrNotAvailable;
282                 case 8: return LDKIOError_BrokenPipe;
283                 case 9: return LDKIOError_AlreadyExists;
284                 case 10: return LDKIOError_WouldBlock;
285                 case 11: return LDKIOError_InvalidInput;
286                 case 12: return LDKIOError_InvalidData;
287                 case 13: return LDKIOError_TimedOut;
288                 case 14: return LDKIOError_WriteZero;
289                 case 15: return LDKIOError_Interrupted;
290                 case 16: return LDKIOError_Other;
291                 case 17: return LDKIOError_UnexpectedEof;
292         }
293         abort();
294 }
295 static inline int32_t LDKIOError_to_js(LDKIOError val) {
296         switch (val) {
297                 case LDKIOError_NotFound: return 0;
298                 case LDKIOError_PermissionDenied: return 1;
299                 case LDKIOError_ConnectionRefused: return 2;
300                 case LDKIOError_ConnectionReset: return 3;
301                 case LDKIOError_ConnectionAborted: return 4;
302                 case LDKIOError_NotConnected: return 5;
303                 case LDKIOError_AddrInUse: return 6;
304                 case LDKIOError_AddrNotAvailable: return 7;
305                 case LDKIOError_BrokenPipe: return 8;
306                 case LDKIOError_AlreadyExists: return 9;
307                 case LDKIOError_WouldBlock: return 10;
308                 case LDKIOError_InvalidInput: return 11;
309                 case LDKIOError_InvalidData: return 12;
310                 case LDKIOError_TimedOut: return 13;
311                 case LDKIOError_WriteZero: return 14;
312                 case LDKIOError_Interrupted: return 15;
313                 case LDKIOError_Other: return 16;
314                 case LDKIOError_UnexpectedEof: return 17;
315                 default: abort();
316         }
317 }
318 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
319         switch (ord) {
320                 case 0: return LDKLevel_Gossip;
321                 case 1: return LDKLevel_Trace;
322                 case 2: return LDKLevel_Debug;
323                 case 3: return LDKLevel_Info;
324                 case 4: return LDKLevel_Warn;
325                 case 5: return LDKLevel_Error;
326         }
327         abort();
328 }
329 static inline int32_t LDKLevel_to_js(LDKLevel val) {
330         switch (val) {
331                 case LDKLevel_Gossip: return 0;
332                 case LDKLevel_Trace: return 1;
333                 case LDKLevel_Debug: return 2;
334                 case LDKLevel_Info: return 3;
335                 case LDKLevel_Warn: return 4;
336                 case LDKLevel_Error: return 5;
337                 default: abort();
338         }
339 }
340 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
341         switch (ord) {
342                 case 0: return LDKNetwork_Bitcoin;
343                 case 1: return LDKNetwork_Testnet;
344                 case 2: return LDKNetwork_Regtest;
345                 case 3: return LDKNetwork_Signet;
346         }
347         abort();
348 }
349 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
350         switch (val) {
351                 case LDKNetwork_Bitcoin: return 0;
352                 case LDKNetwork_Testnet: return 1;
353                 case LDKNetwork_Regtest: return 2;
354                 case LDKNetwork_Signet: return 3;
355                 default: abort();
356         }
357 }
358 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
359         switch (ord) {
360                 case 0: return LDKRecipient_Node;
361                 case 1: return LDKRecipient_PhantomNode;
362         }
363         abort();
364 }
365 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
366         switch (val) {
367                 case LDKRecipient_Node: return 0;
368                 case LDKRecipient_PhantomNode: return 1;
369                 default: abort();
370         }
371 }
372 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
373         switch (ord) {
374                 case 0: return LDKSecp256k1Error_IncorrectSignature;
375                 case 1: return LDKSecp256k1Error_InvalidMessage;
376                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
377                 case 3: return LDKSecp256k1Error_InvalidSignature;
378                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
379                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
380                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
381                 case 7: return LDKSecp256k1Error_InvalidTweak;
382                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
383                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
384                 case 10: return LDKSecp256k1Error_InvalidParityValue;
385         }
386         abort();
387 }
388 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
389         switch (val) {
390                 case LDKSecp256k1Error_IncorrectSignature: return 0;
391                 case LDKSecp256k1Error_InvalidMessage: return 1;
392                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
393                 case LDKSecp256k1Error_InvalidSignature: return 3;
394                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
395                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
396                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
397                 case LDKSecp256k1Error_InvalidTweak: return 7;
398                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
399                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
400                 case LDKSecp256k1Error_InvalidParityValue: return 10;
401                 default: abort();
402         }
403 }
404 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
405         switch (ord) {
406                 case 0: return LDKSemanticError_NoPaymentHash;
407                 case 1: return LDKSemanticError_MultiplePaymentHashes;
408                 case 2: return LDKSemanticError_NoDescription;
409                 case 3: return LDKSemanticError_MultipleDescriptions;
410                 case 4: return LDKSemanticError_NoPaymentSecret;
411                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
412                 case 6: return LDKSemanticError_InvalidFeatures;
413                 case 7: return LDKSemanticError_InvalidRecoveryId;
414                 case 8: return LDKSemanticError_InvalidSignature;
415                 case 9: return LDKSemanticError_ImpreciseAmount;
416         }
417         abort();
418 }
419 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
420         switch (val) {
421                 case LDKSemanticError_NoPaymentHash: return 0;
422                 case LDKSemanticError_MultiplePaymentHashes: return 1;
423                 case LDKSemanticError_NoDescription: return 2;
424                 case LDKSemanticError_MultipleDescriptions: return 3;
425                 case LDKSemanticError_NoPaymentSecret: return 4;
426                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
427                 case LDKSemanticError_InvalidFeatures: return 6;
428                 case LDKSemanticError_InvalidRecoveryId: return 7;
429                 case LDKSemanticError_InvalidSignature: return 8;
430                 case LDKSemanticError_ImpreciseAmount: return 9;
431                 default: abort();
432         }
433 }
434 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
435         switch (ord) {
436                 case 0: return LDKSiPrefix_Milli;
437                 case 1: return LDKSiPrefix_Micro;
438                 case 2: return LDKSiPrefix_Nano;
439                 case 3: return LDKSiPrefix_Pico;
440         }
441         abort();
442 }
443 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
444         switch (val) {
445                 case LDKSiPrefix_Milli: return 0;
446                 case LDKSiPrefix_Micro: return 1;
447                 case LDKSiPrefix_Nano: return 2;
448                 case LDKSiPrefix_Pico: return 3;
449                 default: abort();
450         }
451 }
452 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
453         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
454         return ret;
455 }
456 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
457         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
458         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
459         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
460         return ret_arr;
461 }
462
463 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
464 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
465         if (!ptr_is_owned(thing)) return;
466         void* thing_ptr = untag_ptr(thing);
467         CHECK_ACCESS(thing_ptr);
468         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
469         FREE(untag_ptr(thing));
470         BigEndianScalar_free(thing_conv);
471 }
472
473 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
474         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
475         switch(obj->tag) {
476                 case LDKBech32Error_MissingSeparator: return 0;
477                 case LDKBech32Error_InvalidChecksum: return 1;
478                 case LDKBech32Error_InvalidLength: return 2;
479                 case LDKBech32Error_InvalidChar: return 3;
480                 case LDKBech32Error_InvalidData: return 4;
481                 case LDKBech32Error_InvalidPadding: return 5;
482                 case LDKBech32Error_MixedCase: return 6;
483                 default: abort();
484         }
485 }
486 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
487         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
488         assert(obj->tag == LDKBech32Error_InvalidChar);
489                         int32_t invalid_char_conv = obj->invalid_char;
490         return invalid_char_conv;
491 }
492 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
493         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
494         assert(obj->tag == LDKBech32Error_InvalidData);
495                         int8_t invalid_data_conv = obj->invalid_data;
496         return invalid_data_conv;
497 }
498 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
499         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
500         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
501         return ret;
502 }
503 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) {
504         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
505         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
508         CVec_u8Z_free(ret_var);
509         return ret_arr;
510 }
511
512 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) {
513         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
514         int64_t ret_conv = TxOut_get_value(thing_conv);
515         return ret_conv;
516 }
517
518 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
519         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
520         switch(obj->tag) {
521                 case LDKCOption_HTLCClaimZ_Some: return 0;
522                 case LDKCOption_HTLCClaimZ_None: return 1;
523                 default: abort();
524         }
525 }
526 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
527         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
528         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
529                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
530         return some_conv;
531 }
532 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
533 CHECK(owner->result_ok);
534         return *owner->contents.result;
535 }
536 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
537         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
538         CResult_NoneNoneZ_get_ok(owner_conv);
539 }
540
541 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
542 CHECK(!owner->result_ok);
543         return *owner->contents.err;
544 }
545 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
546         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
547         CResult_NoneNoneZ_get_err(owner_conv);
548 }
549
550 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
551         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
552         switch(obj->tag) {
553                 case LDKDecodeError_UnknownVersion: return 0;
554                 case LDKDecodeError_UnknownRequiredFeature: return 1;
555                 case LDKDecodeError_InvalidValue: return 2;
556                 case LDKDecodeError_ShortRead: return 3;
557                 case LDKDecodeError_BadLengthDescriptor: return 4;
558                 case LDKDecodeError_Io: return 5;
559                 case LDKDecodeError_UnsupportedCompression: return 6;
560                 default: abort();
561         }
562 }
563 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
564         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
565         assert(obj->tag == LDKDecodeError_Io);
566                         uint32_t io_conv = LDKIOError_to_js(obj->io);
567         return io_conv;
568 }
569 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
570         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
571         ret.is_owned = false;
572         return ret;
573 }
574 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
575         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
576         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
577         uint64_t ret_ref = 0;
578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
580         return ret_ref;
581 }
582
583 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
584 CHECK(!owner->result_ok);
585         return DecodeError_clone(&*owner->contents.err);
586 }
587 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
588         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
590         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
591         uint64_t ret_ref = tag_ptr(ret_copy, true);
592         return ret_ref;
593 }
594
595 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
596         LDKTxCreationKeys ret = *owner->contents.result;
597         ret.is_owned = false;
598         return ret;
599 }
600 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
601         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
602         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
603         uint64_t ret_ref = 0;
604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
606         return ret_ref;
607 }
608
609 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
610 CHECK(!owner->result_ok);
611         return DecodeError_clone(&*owner->contents.err);
612 }
613 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
614         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
615         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
616         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
617         uint64_t ret_ref = tag_ptr(ret_copy, true);
618         return ret_ref;
619 }
620
621 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
622         LDKChannelPublicKeys ret = *owner->contents.result;
623         ret.is_owned = false;
624         return ret;
625 }
626 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
627         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
628         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
629         uint64_t ret_ref = 0;
630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
632         return ret_ref;
633 }
634
635 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
636 CHECK(!owner->result_ok);
637         return DecodeError_clone(&*owner->contents.err);
638 }
639 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
640         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
642         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
643         uint64_t ret_ref = tag_ptr(ret_copy, true);
644         return ret_ref;
645 }
646
647 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
648         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
649         switch(obj->tag) {
650                 case LDKCOption_u32Z_Some: return 0;
651                 case LDKCOption_u32Z_None: return 1;
652                 default: abort();
653         }
654 }
655 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
656         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
657         assert(obj->tag == LDKCOption_u32Z_Some);
658                         int32_t some_conv = obj->some;
659         return some_conv;
660 }
661 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
662         LDKHTLCOutputInCommitment ret = *owner->contents.result;
663         ret.is_owned = false;
664         return ret;
665 }
666 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
667         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
668         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
669         uint64_t ret_ref = 0;
670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
672         return ret_ref;
673 }
674
675 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
676 CHECK(!owner->result_ok);
677         return DecodeError_clone(&*owner->contents.err);
678 }
679 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
680         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
681         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
682         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
683         uint64_t ret_ref = tag_ptr(ret_copy, true);
684         return ret_ref;
685 }
686
687 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
688         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
689         ret.is_owned = false;
690         return ret;
691 }
692 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
693         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
694         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
695         uint64_t ret_ref = 0;
696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
698         return ret_ref;
699 }
700
701 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
702 CHECK(!owner->result_ok);
703         return DecodeError_clone(&*owner->contents.err);
704 }
705 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
706         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
707         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
708         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
709         uint64_t ret_ref = tag_ptr(ret_copy, true);
710         return ret_ref;
711 }
712
713 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
714         LDKChannelTransactionParameters ret = *owner->contents.result;
715         ret.is_owned = false;
716         return ret;
717 }
718 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
719         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
720         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
721         uint64_t ret_ref = 0;
722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
724         return ret_ref;
725 }
726
727 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
728 CHECK(!owner->result_ok);
729         return DecodeError_clone(&*owner->contents.err);
730 }
731 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
732         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
733         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
734         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
735         uint64_t ret_ref = tag_ptr(ret_copy, true);
736         return ret_ref;
737 }
738
739 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
740         LDKHolderCommitmentTransaction ret = *owner->contents.result;
741         ret.is_owned = false;
742         return ret;
743 }
744 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
745         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
746         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
747         uint64_t ret_ref = 0;
748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
750         return ret_ref;
751 }
752
753 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
754 CHECK(!owner->result_ok);
755         return DecodeError_clone(&*owner->contents.err);
756 }
757 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
758         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
759         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
760         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
761         uint64_t ret_ref = tag_ptr(ret_copy, true);
762         return ret_ref;
763 }
764
765 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
766         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
767         ret.is_owned = false;
768         return ret;
769 }
770 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
771         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
772         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
773         uint64_t ret_ref = 0;
774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
776         return ret_ref;
777 }
778
779 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
780 CHECK(!owner->result_ok);
781         return DecodeError_clone(&*owner->contents.err);
782 }
783 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
784         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
785         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
786         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
787         uint64_t ret_ref = tag_ptr(ret_copy, true);
788         return ret_ref;
789 }
790
791 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
792         LDKTrustedClosingTransaction ret = *owner->contents.result;
793         ret.is_owned = false;
794         return ret;
795 }
796 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
797         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
798         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
799         uint64_t ret_ref = 0;
800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
802         return ret_ref;
803 }
804
805 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
806 CHECK(!owner->result_ok);
807         return *owner->contents.err;
808 }
809 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
810         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
811         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
812 }
813
814 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
815         LDKCommitmentTransaction ret = *owner->contents.result;
816         ret.is_owned = false;
817         return ret;
818 }
819 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
820         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
821         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
822         uint64_t ret_ref = 0;
823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
825         return ret_ref;
826 }
827
828 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
829 CHECK(!owner->result_ok);
830         return DecodeError_clone(&*owner->contents.err);
831 }
832 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
833         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
834         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
835         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
836         uint64_t ret_ref = tag_ptr(ret_copy, true);
837         return ret_ref;
838 }
839
840 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
841         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
842         ret.is_owned = false;
843         return ret;
844 }
845 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
846         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
847         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
848         uint64_t ret_ref = 0;
849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
851         return ret_ref;
852 }
853
854 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
855 CHECK(!owner->result_ok);
856         return *owner->contents.err;
857 }
858 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
859         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
860         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
861 }
862
863 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
864 CHECK(owner->result_ok);
865         return *owner->contents.result;
866 }
867 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
868         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
869         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
870         ptrArray ret_arr = NULL;
871         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
872         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
873         for (size_t m = 0; m < ret_var.datalen; m++) {
874                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
875                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
876                 ret_arr_ptr[m] = ret_conv_12_arr;
877         }
878         
879         return ret_arr;
880 }
881
882 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
883 CHECK(!owner->result_ok);
884         return *owner->contents.err;
885 }
886 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
887         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
888         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
889 }
890
891 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
892         LDKShutdownScript ret = *owner->contents.result;
893         ret.is_owned = false;
894         return ret;
895 }
896 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
897         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
898         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
899         uint64_t ret_ref = 0;
900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
902         return ret_ref;
903 }
904
905 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
906 CHECK(!owner->result_ok);
907         return DecodeError_clone(&*owner->contents.err);
908 }
909 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
910         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
912         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
913         uint64_t ret_ref = tag_ptr(ret_copy, true);
914         return ret_ref;
915 }
916
917 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
918         LDKShutdownScript ret = *owner->contents.result;
919         ret.is_owned = false;
920         return ret;
921 }
922 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
923         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
924         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
925         uint64_t ret_ref = 0;
926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
928         return ret_ref;
929 }
930
931 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
932         LDKInvalidShutdownScript ret = *owner->contents.err;
933         ret.is_owned = false;
934         return ret;
935 }
936 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
937         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
938         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
939         uint64_t ret_ref = 0;
940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
942         return ret_ref;
943 }
944
945 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
946         LDKBlindedPath ret = *owner->contents.result;
947         ret.is_owned = false;
948         return ret;
949 }
950 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
951         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
952         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
953         uint64_t ret_ref = 0;
954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
956         return ret_ref;
957 }
958
959 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
960 CHECK(!owner->result_ok);
961         return *owner->contents.err;
962 }
963 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
964         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
965         CResult_BlindedPathNoneZ_get_err(owner_conv);
966 }
967
968 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
969         LDKBlindedPath ret = *owner->contents.result;
970         ret.is_owned = false;
971         return ret;
972 }
973 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
974         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
975         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
976         uint64_t ret_ref = 0;
977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
979         return ret_ref;
980 }
981
982 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
983 CHECK(!owner->result_ok);
984         return DecodeError_clone(&*owner->contents.err);
985 }
986 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
987         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
989         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
990         uint64_t ret_ref = tag_ptr(ret_copy, true);
991         return ret_ref;
992 }
993
994 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
995         LDKBlindedHop ret = *owner->contents.result;
996         ret.is_owned = false;
997         return ret;
998 }
999 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
1000         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1001         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
1002         uint64_t ret_ref = 0;
1003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1005         return ret_ref;
1006 }
1007
1008 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1009 CHECK(!owner->result_ok);
1010         return DecodeError_clone(&*owner->contents.err);
1011 }
1012 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
1013         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1015         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1016         uint64_t ret_ref = tag_ptr(ret_copy, true);
1017         return ret_ref;
1018 }
1019
1020 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1021         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1022         for (size_t i = 0; i < ret.datalen; i++) {
1023                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1024         }
1025         return ret;
1026 }
1027 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1028         LDKRoute ret = *owner->contents.result;
1029         ret.is_owned = false;
1030         return ret;
1031 }
1032 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1033         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1034         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1035         uint64_t ret_ref = 0;
1036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1038         return ret_ref;
1039 }
1040
1041 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1042         LDKLightningError ret = *owner->contents.err;
1043         ret.is_owned = false;
1044         return ret;
1045 }
1046 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1047         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1048         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1049         uint64_t ret_ref = 0;
1050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1052         return ret_ref;
1053 }
1054
1055 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1056         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1057         for (size_t i = 0; i < ret.datalen; i++) {
1058                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1059         }
1060         return ret;
1061 }
1062 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1063         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1064         switch(obj->tag) {
1065                 case LDKCOption_u64Z_Some: return 0;
1066                 case LDKCOption_u64Z_None: return 1;
1067                 default: abort();
1068         }
1069 }
1070 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1071         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1072         assert(obj->tag == LDKCOption_u64Z_Some);
1073                         int64_t some_conv = obj->some;
1074         return some_conv;
1075 }
1076 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1077         LDKInFlightHtlcs ret = *owner->contents.result;
1078         ret.is_owned = false;
1079         return ret;
1080 }
1081 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1082         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1083         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1084         uint64_t ret_ref = 0;
1085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1087         return ret_ref;
1088 }
1089
1090 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1091 CHECK(!owner->result_ok);
1092         return DecodeError_clone(&*owner->contents.err);
1093 }
1094 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1095         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1097         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1098         uint64_t ret_ref = tag_ptr(ret_copy, true);
1099         return ret_ref;
1100 }
1101
1102 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1103         LDKRouteHop ret = *owner->contents.result;
1104         ret.is_owned = false;
1105         return ret;
1106 }
1107 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1108         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1109         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1110         uint64_t ret_ref = 0;
1111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1113         return ret_ref;
1114 }
1115
1116 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1117 CHECK(!owner->result_ok);
1118         return DecodeError_clone(&*owner->contents.err);
1119 }
1120 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1121         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1123         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1124         uint64_t ret_ref = tag_ptr(ret_copy, true);
1125         return ret_ref;
1126 }
1127
1128 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1129         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1130         for (size_t i = 0; i < ret.datalen; i++) {
1131                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1132         }
1133         return ret;
1134 }
1135 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1136         LDKRoute ret = *owner->contents.result;
1137         ret.is_owned = false;
1138         return ret;
1139 }
1140 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1141         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1142         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1143         uint64_t ret_ref = 0;
1144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1146         return ret_ref;
1147 }
1148
1149 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1150 CHECK(!owner->result_ok);
1151         return DecodeError_clone(&*owner->contents.err);
1152 }
1153 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1154         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1156         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1157         uint64_t ret_ref = tag_ptr(ret_copy, true);
1158         return ret_ref;
1159 }
1160
1161 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1162         LDKRouteParameters ret = *owner->contents.result;
1163         ret.is_owned = false;
1164         return ret;
1165 }
1166 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1167         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1168         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1169         uint64_t ret_ref = 0;
1170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1172         return ret_ref;
1173 }
1174
1175 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1176 CHECK(!owner->result_ok);
1177         return DecodeError_clone(&*owner->contents.err);
1178 }
1179 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1180         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1181         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1182         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1183         uint64_t ret_ref = tag_ptr(ret_copy, true);
1184         return ret_ref;
1185 }
1186
1187 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1188         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1189         for (size_t i = 0; i < ret.datalen; i++) {
1190                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1191         }
1192         return ret;
1193 }
1194 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1195         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1196         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1197         return ret;
1198 }
1199 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1200         LDKPaymentParameters ret = *owner->contents.result;
1201         ret.is_owned = false;
1202         return ret;
1203 }
1204 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1205         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1206         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1207         uint64_t ret_ref = 0;
1208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1210         return ret_ref;
1211 }
1212
1213 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1214 CHECK(!owner->result_ok);
1215         return DecodeError_clone(&*owner->contents.err);
1216 }
1217 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1218         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1220         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1221         uint64_t ret_ref = tag_ptr(ret_copy, true);
1222         return ret_ref;
1223 }
1224
1225 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1226         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1227         for (size_t i = 0; i < ret.datalen; i++) {
1228                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1229         }
1230         return ret;
1231 }
1232 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1233         LDKRouteHint ret = *owner->contents.result;
1234         ret.is_owned = false;
1235         return ret;
1236 }
1237 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1238         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1239         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1240         uint64_t ret_ref = 0;
1241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1243         return ret_ref;
1244 }
1245
1246 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1247 CHECK(!owner->result_ok);
1248         return DecodeError_clone(&*owner->contents.err);
1249 }
1250 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1251         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1252         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1253         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1254         uint64_t ret_ref = tag_ptr(ret_copy, true);
1255         return ret_ref;
1256 }
1257
1258 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1259         LDKRouteHintHop ret = *owner->contents.result;
1260         ret.is_owned = false;
1261         return ret;
1262 }
1263 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1264         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1265         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1266         uint64_t ret_ref = 0;
1267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1269         return ret_ref;
1270 }
1271
1272 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1273 CHECK(!owner->result_ok);
1274         return DecodeError_clone(&*owner->contents.err);
1275 }
1276 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1277         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1279         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1280         uint64_t ret_ref = tag_ptr(ret_copy, true);
1281         return ret_ref;
1282 }
1283
1284 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1285         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1286         switch(obj->tag) {
1287                 case LDKPaymentPurpose_InvoicePayment: return 0;
1288                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1289                 default: abort();
1290         }
1291 }
1292 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1293         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1294         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1295                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1296                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1297         return payment_preimage_arr;
1298 }
1299 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1300         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1301         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1302                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1303                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1304         return payment_secret_arr;
1305 }
1306 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1307         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1308         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1309                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1310                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1311         return spontaneous_payment_arr;
1312 }
1313 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1314 CHECK(owner->result_ok);
1315         return PaymentPurpose_clone(&*owner->contents.result);
1316 }
1317 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1318         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1319         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1320         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1321         uint64_t ret_ref = tag_ptr(ret_copy, true);
1322         return ret_ref;
1323 }
1324
1325 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1326 CHECK(!owner->result_ok);
1327         return DecodeError_clone(&*owner->contents.err);
1328 }
1329 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1330         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1331         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1332         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1333         uint64_t ret_ref = tag_ptr(ret_copy, true);
1334         return ret_ref;
1335 }
1336
1337 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1338         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1339         switch(obj->tag) {
1340                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1341                 case LDKClosureReason_HolderForceClosed: return 1;
1342                 case LDKClosureReason_CooperativeClosure: return 2;
1343                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1344                 case LDKClosureReason_FundingTimedOut: return 4;
1345                 case LDKClosureReason_ProcessingError: return 5;
1346                 case LDKClosureReason_DisconnectedPeer: return 6;
1347                 case LDKClosureReason_OutdatedChannelManager: return 7;
1348                 default: abort();
1349         }
1350 }
1351 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1352         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1353         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1354                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1355                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1356         return peer_msg_conv;
1357 }
1358 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1359         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1360         assert(obj->tag == LDKClosureReason_ProcessingError);
1361                         LDKStr err_str = obj->processing_error.err;
1362                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1363         return err_conv;
1364 }
1365 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1366         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1367         switch(obj->tag) {
1368                 case LDKCOption_ClosureReasonZ_Some: return 0;
1369                 case LDKCOption_ClosureReasonZ_None: return 1;
1370                 default: abort();
1371         }
1372 }
1373 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1374         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1375         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1376                         uint64_t some_ref = tag_ptr(&obj->some, false);
1377         return some_ref;
1378 }
1379 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1380 CHECK(owner->result_ok);
1381         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1382 }
1383 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1384         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1385         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1386         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1387         uint64_t ret_ref = tag_ptr(ret_copy, true);
1388         return ret_ref;
1389 }
1390
1391 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1392 CHECK(!owner->result_ok);
1393         return DecodeError_clone(&*owner->contents.err);
1394 }
1395 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1396         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1397         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1398         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1399         uint64_t ret_ref = tag_ptr(ret_copy, true);
1400         return ret_ref;
1401 }
1402
1403 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1404         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1405         switch(obj->tag) {
1406                 case LDKHTLCDestination_NextHopChannel: return 0;
1407                 case LDKHTLCDestination_UnknownNextHop: return 1;
1408                 case LDKHTLCDestination_InvalidForward: return 2;
1409                 case LDKHTLCDestination_FailedPayment: return 3;
1410                 default: abort();
1411         }
1412 }
1413 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1414         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1415         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1416                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1417                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1418         return node_id_arr;
1419 }
1420 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1421         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1422         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1423                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1424                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1425         return channel_id_arr;
1426 }
1427 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1428         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1429         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1430                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1431         return requested_forward_scid_conv;
1432 }
1433 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
1434         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1435         assert(obj->tag == LDKHTLCDestination_InvalidForward);
1436                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
1437         return requested_forward_scid_conv;
1438 }
1439 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1440         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1441         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1442                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1443                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1444         return payment_hash_arr;
1445 }
1446 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1447         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1448         switch(obj->tag) {
1449                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1450                 case LDKCOption_HTLCDestinationZ_None: return 1;
1451                 default: abort();
1452         }
1453 }
1454 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1455         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1456         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1457                         uint64_t some_ref = tag_ptr(&obj->some, false);
1458         return some_ref;
1459 }
1460 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1461 CHECK(owner->result_ok);
1462         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1463 }
1464 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1465         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1466         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1467         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1468         uint64_t ret_ref = tag_ptr(ret_copy, true);
1469         return ret_ref;
1470 }
1471
1472 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1473 CHECK(!owner->result_ok);
1474         return DecodeError_clone(&*owner->contents.err);
1475 }
1476 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1477         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1478         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1479         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1480         uint64_t ret_ref = tag_ptr(ret_copy, true);
1481         return ret_ref;
1482 }
1483
1484 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
1485         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1486         switch(obj->tag) {
1487                 case LDKCOption_u128Z_Some: return 0;
1488                 case LDKCOption_u128Z_None: return 1;
1489                 default: abort();
1490         }
1491 }
1492 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
1493         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1494         assert(obj->tag == LDKCOption_u128Z_Some);
1495                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
1496                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
1497         return some_arr;
1498 }
1499 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1500         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1501         switch(obj->tag) {
1502                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1503                 case LDKNetworkUpdate_ChannelFailure: return 1;
1504                 case LDKNetworkUpdate_NodeFailure: return 2;
1505                 default: abort();
1506         }
1507 }
1508 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1509         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1510         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1511                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1512                         uint64_t msg_ref = 0;
1513                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1514                         msg_ref = tag_ptr(msg_var.inner, false);
1515         return msg_ref;
1516 }
1517 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1518         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1519         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1520                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1521         return short_channel_id_conv;
1522 }
1523 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1524         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1525         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1526                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1527         return is_permanent_conv;
1528 }
1529 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1530         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1531         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1532                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1533                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1534         return node_id_arr;
1535 }
1536 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1537         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1538         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1539                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1540         return is_permanent_conv;
1541 }
1542 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1543         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1544         switch(obj->tag) {
1545                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1546                 case LDKCOption_NetworkUpdateZ_None: return 1;
1547                 default: abort();
1548         }
1549 }
1550 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1551         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1552         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1553                         uint64_t some_ref = tag_ptr(&obj->some, false);
1554         return some_ref;
1555 }
1556 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1557         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1558         switch(obj->tag) {
1559                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1560                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1561                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1562                 default: abort();
1563         }
1564 }
1565 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1566         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1567         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1568                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1569                         uint64_t outpoint_ref = 0;
1570                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1571                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1572         return outpoint_ref;
1573 }
1574 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1575         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1576         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1577                         LDKTxOut* output_ref = &obj->static_output.output;
1578         return tag_ptr(output_ref, false);
1579 }
1580 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1581         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1582         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1583                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1584                         uint64_t delayed_payment_output_ref = 0;
1585                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1586                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1587         return delayed_payment_output_ref;
1588 }
1589 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1590         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1591         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1592                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1593                         uint64_t static_payment_output_ref = 0;
1594                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1595                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1596         return static_payment_output_ref;
1597 }
1598 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1599         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1600         for (size_t i = 0; i < ret.datalen; i++) {
1601                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1602         }
1603         return ret;
1604 }
1605 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1606         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1607         switch(obj->tag) {
1608                 case LDKEvent_FundingGenerationReady: return 0;
1609                 case LDKEvent_PaymentClaimable: return 1;
1610                 case LDKEvent_PaymentClaimed: return 2;
1611                 case LDKEvent_PaymentSent: return 3;
1612                 case LDKEvent_PaymentFailed: return 4;
1613                 case LDKEvent_PaymentPathSuccessful: return 5;
1614                 case LDKEvent_PaymentPathFailed: return 6;
1615                 case LDKEvent_ProbeSuccessful: return 7;
1616                 case LDKEvent_ProbeFailed: return 8;
1617                 case LDKEvent_PendingHTLCsForwardable: return 9;
1618                 case LDKEvent_HTLCIntercepted: return 10;
1619                 case LDKEvent_SpendableOutputs: return 11;
1620                 case LDKEvent_PaymentForwarded: return 12;
1621                 case LDKEvent_ChannelReady: return 13;
1622                 case LDKEvent_ChannelClosed: return 14;
1623                 case LDKEvent_DiscardFunding: return 15;
1624                 case LDKEvent_OpenChannelRequest: return 16;
1625                 case LDKEvent_HTLCHandlingFailed: return 17;
1626                 default: abort();
1627         }
1628 }
1629 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1630         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1631         assert(obj->tag == LDKEvent_FundingGenerationReady);
1632                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1633                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1634         return temporary_channel_id_arr;
1635 }
1636 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1637         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1638         assert(obj->tag == LDKEvent_FundingGenerationReady);
1639                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1640                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1641         return counterparty_node_id_arr;
1642 }
1643 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1644         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1645         assert(obj->tag == LDKEvent_FundingGenerationReady);
1646                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1647         return channel_value_satoshis_conv;
1648 }
1649 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1650         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1651         assert(obj->tag == LDKEvent_FundingGenerationReady);
1652                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1653                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1654                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1655         return output_script_arr;
1656 }
1657 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1658         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1659         assert(obj->tag == LDKEvent_FundingGenerationReady);
1660                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
1661                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
1662         return user_channel_id_arr;
1663 }
1664 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
1665         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1666         assert(obj->tag == LDKEvent_PaymentClaimable);
1667                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1668                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
1669         return receiver_node_id_arr;
1670 }
1671 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
1672         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1673         assert(obj->tag == LDKEvent_PaymentClaimable);
1674                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1675                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
1676         return payment_hash_arr;
1677 }
1678 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
1679         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1680         assert(obj->tag == LDKEvent_PaymentClaimable);
1681                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
1682         return amount_msat_conv;
1683 }
1684 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
1685         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1686         assert(obj->tag == LDKEvent_PaymentClaimable);
1687                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
1688         return purpose_ref;
1689 }
1690 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
1691         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1692         assert(obj->tag == LDKEvent_PaymentClaimable);
1693                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
1694                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
1695         return via_channel_id_arr;
1696 }
1697 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
1698         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1699         assert(obj->tag == LDKEvent_PaymentClaimable);
1700                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
1701         return via_user_channel_id_ref;
1702 }
1703 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
1704         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1705         assert(obj->tag == LDKEvent_PaymentClaimed);
1706                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1707                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
1708         return receiver_node_id_arr;
1709 }
1710 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1711         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1712         assert(obj->tag == LDKEvent_PaymentClaimed);
1713                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1714                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1715         return payment_hash_arr;
1716 }
1717 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1718         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1719         assert(obj->tag == LDKEvent_PaymentClaimed);
1720                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1721         return amount_msat_conv;
1722 }
1723 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1724         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1725         assert(obj->tag == LDKEvent_PaymentClaimed);
1726                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1727         return purpose_ref;
1728 }
1729 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1730         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1731         assert(obj->tag == LDKEvent_PaymentSent);
1732                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1733                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1734         return payment_id_arr;
1735 }
1736 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1737         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1738         assert(obj->tag == LDKEvent_PaymentSent);
1739                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1740                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1741         return payment_preimage_arr;
1742 }
1743 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1744         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1745         assert(obj->tag == LDKEvent_PaymentSent);
1746                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1747                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1748         return payment_hash_arr;
1749 }
1750 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1751         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1752         assert(obj->tag == LDKEvent_PaymentSent);
1753                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1754         return fee_paid_msat_ref;
1755 }
1756 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1757         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1758         assert(obj->tag == LDKEvent_PaymentFailed);
1759                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1760                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1761         return payment_id_arr;
1762 }
1763 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1764         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1765         assert(obj->tag == LDKEvent_PaymentFailed);
1766                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1767                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1768         return payment_hash_arr;
1769 }
1770 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1771         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1772         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1773                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1774                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1775         return payment_id_arr;
1776 }
1777 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1778         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1779         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1780                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1781                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1782         return payment_hash_arr;
1783 }
1784 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1785         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1786         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1787                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1788                         uint64_tArray path_arr = NULL;
1789                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1790                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1791                         for (size_t k = 0; k < path_var.datalen; k++) {
1792                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1793                                 uint64_t path_conv_10_ref = 0;
1794                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1795                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1796                                 path_arr_ptr[k] = path_conv_10_ref;
1797                         }
1798                         
1799         return path_arr;
1800 }
1801 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1802         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1803         assert(obj->tag == LDKEvent_PaymentPathFailed);
1804                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1805                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1806         return payment_id_arr;
1807 }
1808 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1809         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1810         assert(obj->tag == LDKEvent_PaymentPathFailed);
1811                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1812                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1813         return payment_hash_arr;
1814 }
1815 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1816         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1817         assert(obj->tag == LDKEvent_PaymentPathFailed);
1818                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1819         return payment_failed_permanently_conv;
1820 }
1821 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1822         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1823         assert(obj->tag == LDKEvent_PaymentPathFailed);
1824                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1825         return network_update_ref;
1826 }
1827 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1828         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1829         assert(obj->tag == LDKEvent_PaymentPathFailed);
1830                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1831         return all_paths_failed_conv;
1832 }
1833 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1834         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1835         assert(obj->tag == LDKEvent_PaymentPathFailed);
1836                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1837                         uint64_tArray path_arr = NULL;
1838                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1839                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1840                         for (size_t k = 0; k < path_var.datalen; k++) {
1841                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1842                                 uint64_t path_conv_10_ref = 0;
1843                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1844                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1845                                 path_arr_ptr[k] = path_conv_10_ref;
1846                         }
1847                         
1848         return path_arr;
1849 }
1850 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1851         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1852         assert(obj->tag == LDKEvent_PaymentPathFailed);
1853                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1854         return short_channel_id_ref;
1855 }
1856 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1858         assert(obj->tag == LDKEvent_PaymentPathFailed);
1859                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1860                         uint64_t retry_ref = 0;
1861                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1862                         retry_ref = tag_ptr(retry_var.inner, false);
1863         return retry_ref;
1864 }
1865 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1866         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1867         assert(obj->tag == LDKEvent_ProbeSuccessful);
1868                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1869                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1870         return payment_id_arr;
1871 }
1872 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1873         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1874         assert(obj->tag == LDKEvent_ProbeSuccessful);
1875                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1876                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1877         return payment_hash_arr;
1878 }
1879 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1880         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1881         assert(obj->tag == LDKEvent_ProbeSuccessful);
1882                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1883                         uint64_tArray path_arr = NULL;
1884                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1885                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1886                         for (size_t k = 0; k < path_var.datalen; k++) {
1887                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1888                                 uint64_t path_conv_10_ref = 0;
1889                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1890                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1891                                 path_arr_ptr[k] = path_conv_10_ref;
1892                         }
1893                         
1894         return path_arr;
1895 }
1896 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1897         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1898         assert(obj->tag == LDKEvent_ProbeFailed);
1899                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1900                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1901         return payment_id_arr;
1902 }
1903 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1904         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1905         assert(obj->tag == LDKEvent_ProbeFailed);
1906                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1907                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1908         return payment_hash_arr;
1909 }
1910 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1911         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1912         assert(obj->tag == LDKEvent_ProbeFailed);
1913                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1914                         uint64_tArray path_arr = NULL;
1915                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1916                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1917                         for (size_t k = 0; k < path_var.datalen; k++) {
1918                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1919                                 uint64_t path_conv_10_ref = 0;
1920                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1921                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1922                                 path_arr_ptr[k] = path_conv_10_ref;
1923                         }
1924                         
1925         return path_arr;
1926 }
1927 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1928         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1929         assert(obj->tag == LDKEvent_ProbeFailed);
1930                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1931         return short_channel_id_ref;
1932 }
1933 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1934         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1935         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1936                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1937         return time_forwardable_conv;
1938 }
1939 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
1940         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1941         assert(obj->tag == LDKEvent_HTLCIntercepted);
1942                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
1943                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
1944         return intercept_id_arr;
1945 }
1946 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
1947         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1948         assert(obj->tag == LDKEvent_HTLCIntercepted);
1949                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
1950         return requested_next_hop_scid_conv;
1951 }
1952 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
1953         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1954         assert(obj->tag == LDKEvent_HTLCIntercepted);
1955                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1956                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
1957         return payment_hash_arr;
1958 }
1959 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
1960         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1961         assert(obj->tag == LDKEvent_HTLCIntercepted);
1962                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
1963         return inbound_amount_msat_conv;
1964 }
1965 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
1966         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1967         assert(obj->tag == LDKEvent_HTLCIntercepted);
1968                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
1969         return expected_outbound_amount_msat_conv;
1970 }
1971 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1972         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1973         assert(obj->tag == LDKEvent_SpendableOutputs);
1974                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1975                         uint64_tArray outputs_arr = NULL;
1976                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1977                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1978                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1979                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1980                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1981                         }
1982                         
1983         return outputs_arr;
1984 }
1985 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1986         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1987         assert(obj->tag == LDKEvent_PaymentForwarded);
1988                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1989                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1990         return prev_channel_id_arr;
1991 }
1992 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1993         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1994         assert(obj->tag == LDKEvent_PaymentForwarded);
1995                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1996                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1997         return next_channel_id_arr;
1998 }
1999 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2000         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2001         assert(obj->tag == LDKEvent_PaymentForwarded);
2002                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2003         return fee_earned_msat_ref;
2004 }
2005 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2006         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2007         assert(obj->tag == LDKEvent_PaymentForwarded);
2008                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2009         return claim_from_onchain_tx_conv;
2010 }
2011 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2012         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2013         assert(obj->tag == LDKEvent_ChannelReady);
2014                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2015                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2016         return channel_id_arr;
2017 }
2018 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2019         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2020         assert(obj->tag == LDKEvent_ChannelReady);
2021                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2022                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2023         return user_channel_id_arr;
2024 }
2025 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2026         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2027         assert(obj->tag == LDKEvent_ChannelReady);
2028                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2029                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2030         return counterparty_node_id_arr;
2031 }
2032 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2033         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2034         assert(obj->tag == LDKEvent_ChannelReady);
2035                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2036                         uint64_t channel_type_ref = 0;
2037                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2038                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2039         return channel_type_ref;
2040 }
2041 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2042         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2043         assert(obj->tag == LDKEvent_ChannelClosed);
2044                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2045                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2046         return channel_id_arr;
2047 }
2048 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2049         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2050         assert(obj->tag == LDKEvent_ChannelClosed);
2051                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2052                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2053         return user_channel_id_arr;
2054 }
2055 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2056         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2057         assert(obj->tag == LDKEvent_ChannelClosed);
2058                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2059         return reason_ref;
2060 }
2061 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2062         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2063         assert(obj->tag == LDKEvent_DiscardFunding);
2064                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2065                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2066         return channel_id_arr;
2067 }
2068 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2069         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2070         assert(obj->tag == LDKEvent_DiscardFunding);
2071                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2072                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2073                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2074         return transaction_arr;
2075 }
2076 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2077         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2078         assert(obj->tag == LDKEvent_OpenChannelRequest);
2079                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2080                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2081         return temporary_channel_id_arr;
2082 }
2083 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2084         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2085         assert(obj->tag == LDKEvent_OpenChannelRequest);
2086                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2087                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2088         return counterparty_node_id_arr;
2089 }
2090 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2091         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2092         assert(obj->tag == LDKEvent_OpenChannelRequest);
2093                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2094         return funding_satoshis_conv;
2095 }
2096 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2097         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2098         assert(obj->tag == LDKEvent_OpenChannelRequest);
2099                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2100         return push_msat_conv;
2101 }
2102 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2103         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2104         assert(obj->tag == LDKEvent_OpenChannelRequest);
2105                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2106                         uint64_t channel_type_ref = 0;
2107                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2108                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2109         return channel_type_ref;
2110 }
2111 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2112         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2113         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2114                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2115                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2116         return prev_channel_id_arr;
2117 }
2118 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2119         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2120         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2121                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2122         return failed_next_destination_ref;
2123 }
2124 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2125         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2126         switch(obj->tag) {
2127                 case LDKCOption_EventZ_Some: return 0;
2128                 case LDKCOption_EventZ_None: return 1;
2129                 default: abort();
2130         }
2131 }
2132 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2133         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2134         assert(obj->tag == LDKCOption_EventZ_Some);
2135                         uint64_t some_ref = tag_ptr(&obj->some, false);
2136         return some_ref;
2137 }
2138 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2139 CHECK(owner->result_ok);
2140         return COption_EventZ_clone(&*owner->contents.result);
2141 }
2142 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2143         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2144         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2145         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2146         uint64_t ret_ref = tag_ptr(ret_copy, true);
2147         return ret_ref;
2148 }
2149
2150 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2151 CHECK(!owner->result_ok);
2152         return DecodeError_clone(&*owner->contents.err);
2153 }
2154 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2155         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2156         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2157         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2158         uint64_t ret_ref = tag_ptr(ret_copy, true);
2159         return ret_ref;
2160 }
2161
2162 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2163         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2164         switch(obj->tag) {
2165                 case LDKErrorAction_DisconnectPeer: return 0;
2166                 case LDKErrorAction_IgnoreError: return 1;
2167                 case LDKErrorAction_IgnoreAndLog: return 2;
2168                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2169                 case LDKErrorAction_SendErrorMessage: return 4;
2170                 case LDKErrorAction_SendWarningMessage: return 5;
2171                 default: abort();
2172         }
2173 }
2174 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2175         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2176         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2177                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2178                         uint64_t msg_ref = 0;
2179                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2180                         msg_ref = tag_ptr(msg_var.inner, false);
2181         return msg_ref;
2182 }
2183 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2184         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2185         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2186                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2187         return ignore_and_log_conv;
2188 }
2189 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2190         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2191         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2192                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2193                         uint64_t msg_ref = 0;
2194                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2195                         msg_ref = tag_ptr(msg_var.inner, false);
2196         return msg_ref;
2197 }
2198 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2199         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2200         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2201                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2202                         uint64_t msg_ref = 0;
2203                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2204                         msg_ref = tag_ptr(msg_var.inner, false);
2205         return msg_ref;
2206 }
2207 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2208         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2209         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2210                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2211         return log_level_conv;
2212 }
2213 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2214         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2215         switch(obj->tag) {
2216                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2217                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2218                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2219                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2220                 case LDKMessageSendEvent_SendChannelReady: return 4;
2221                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2222                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2223                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2224                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2225                 case LDKMessageSendEvent_SendShutdown: return 9;
2226                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2227                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2228                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2229                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2230                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2231                 case LDKMessageSendEvent_HandleError: return 15;
2232                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2233                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2234                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2235                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2236                 default: abort();
2237         }
2238 }
2239 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2240         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2241         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2242                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2243                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2244         return node_id_arr;
2245 }
2246 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2247         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2248         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2249                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2250                         uint64_t msg_ref = 0;
2251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2252                         msg_ref = tag_ptr(msg_var.inner, false);
2253         return msg_ref;
2254 }
2255 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2256         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2257         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2258                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2259                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2260         return node_id_arr;
2261 }
2262 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2263         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2264         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2265                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2266                         uint64_t msg_ref = 0;
2267                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2268                         msg_ref = tag_ptr(msg_var.inner, false);
2269         return msg_ref;
2270 }
2271 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2272         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2273         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2274                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2275                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2276         return node_id_arr;
2277 }
2278 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2279         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2280         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2281                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2282                         uint64_t msg_ref = 0;
2283                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2284                         msg_ref = tag_ptr(msg_var.inner, false);
2285         return msg_ref;
2286 }
2287 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2288         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2289         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2290                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2291                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2292         return node_id_arr;
2293 }
2294 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2295         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2296         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2297                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2298                         uint64_t msg_ref = 0;
2299                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2300                         msg_ref = tag_ptr(msg_var.inner, false);
2301         return msg_ref;
2302 }
2303 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2304         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2305         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2306                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2307                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2308         return node_id_arr;
2309 }
2310 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2311         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2312         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2313                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2314                         uint64_t msg_ref = 0;
2315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2316                         msg_ref = tag_ptr(msg_var.inner, false);
2317         return msg_ref;
2318 }
2319 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2320         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2321         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2322                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2323                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2324         return node_id_arr;
2325 }
2326 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2327         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2328         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2329                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2330                         uint64_t msg_ref = 0;
2331                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2332                         msg_ref = tag_ptr(msg_var.inner, false);
2333         return msg_ref;
2334 }
2335 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2336         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2337         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2338                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2339                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2340         return node_id_arr;
2341 }
2342 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2343         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2344         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2345                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2346                         uint64_t updates_ref = 0;
2347                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2348                         updates_ref = tag_ptr(updates_var.inner, false);
2349         return updates_ref;
2350 }
2351 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2352         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2353         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2354                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2355                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2356         return node_id_arr;
2357 }
2358 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2359         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2360         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2361                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2362                         uint64_t msg_ref = 0;
2363                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2364                         msg_ref = tag_ptr(msg_var.inner, false);
2365         return msg_ref;
2366 }
2367 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2368         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2369         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2370                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2371                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2372         return node_id_arr;
2373 }
2374 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2375         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2376         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2377                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2378                         uint64_t msg_ref = 0;
2379                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2380                         msg_ref = tag_ptr(msg_var.inner, false);
2381         return msg_ref;
2382 }
2383 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2384         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2385         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2386                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2387                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2388         return node_id_arr;
2389 }
2390 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2391         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2392         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2393                         LDKShutdown msg_var = obj->send_shutdown.msg;
2394                         uint64_t msg_ref = 0;
2395                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2396                         msg_ref = tag_ptr(msg_var.inner, false);
2397         return msg_ref;
2398 }
2399 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2400         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2401         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2402                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2403                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2404         return node_id_arr;
2405 }
2406 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2407         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2408         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2409                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2410                         uint64_t msg_ref = 0;
2411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2412                         msg_ref = tag_ptr(msg_var.inner, false);
2413         return msg_ref;
2414 }
2415 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2416         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2417         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2418                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2419                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2420         return node_id_arr;
2421 }
2422 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2423         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2424         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2425                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2426                         uint64_t msg_ref = 0;
2427                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2428                         msg_ref = tag_ptr(msg_var.inner, false);
2429         return msg_ref;
2430 }
2431 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2432         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2433         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2434                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2435                         uint64_t update_msg_ref = 0;
2436                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2437                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2438         return update_msg_ref;
2439 }
2440 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2441         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2442         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2443                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2444                         uint64_t msg_ref = 0;
2445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2446                         msg_ref = tag_ptr(msg_var.inner, false);
2447         return msg_ref;
2448 }
2449 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2450         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2451         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2452                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2453                         uint64_t update_msg_ref = 0;
2454                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2455                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2456         return update_msg_ref;
2457 }
2458 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2459         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2460         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2461                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2462                         uint64_t msg_ref = 0;
2463                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2464                         msg_ref = tag_ptr(msg_var.inner, false);
2465         return msg_ref;
2466 }
2467 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2468         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2469         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2470                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2471                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2472         return node_id_arr;
2473 }
2474 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2475         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2476         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2477                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2478                         uint64_t msg_ref = 0;
2479                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2480                         msg_ref = tag_ptr(msg_var.inner, false);
2481         return msg_ref;
2482 }
2483 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2484         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2485         assert(obj->tag == LDKMessageSendEvent_HandleError);
2486                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2487                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2488         return node_id_arr;
2489 }
2490 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2491         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2492         assert(obj->tag == LDKMessageSendEvent_HandleError);
2493                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2494         return action_ref;
2495 }
2496 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2497         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2498         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2499                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2500                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2501         return node_id_arr;
2502 }
2503 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2504         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2505         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2506                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2507                         uint64_t msg_ref = 0;
2508                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2509                         msg_ref = tag_ptr(msg_var.inner, false);
2510         return msg_ref;
2511 }
2512 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2513         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2514         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2515                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2516                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2517         return node_id_arr;
2518 }
2519 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2520         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2521         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2522                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2523                         uint64_t msg_ref = 0;
2524                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2525                         msg_ref = tag_ptr(msg_var.inner, false);
2526         return msg_ref;
2527 }
2528 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2529         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2530         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2531                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2532                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2533         return node_id_arr;
2534 }
2535 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2536         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2537         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2538                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2539                         uint64_t msg_ref = 0;
2540                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2541                         msg_ref = tag_ptr(msg_var.inner, false);
2542         return msg_ref;
2543 }
2544 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2545         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2546         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2547                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2548                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2549         return node_id_arr;
2550 }
2551 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2552         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2553         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2554                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2555                         uint64_t msg_ref = 0;
2556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2557                         msg_ref = tag_ptr(msg_var.inner, false);
2558         return msg_ref;
2559 }
2560 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2561         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2562         for (size_t i = 0; i < ret.datalen; i++) {
2563                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2564         }
2565         return ret;
2566 }
2567 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2568 CHECK(owner->result_ok);
2569         return TxOut_clone(&*owner->contents.result);
2570 }
2571 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2572         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2573         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2574         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2575         return tag_ptr(ret_ref, true);
2576 }
2577
2578 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2579 CHECK(!owner->result_ok);
2580         return AccessError_clone(&*owner->contents.err);
2581 }
2582 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2583         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2584         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2585         return ret_conv;
2586 }
2587
2588 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2589         return owner->a;
2590 }
2591 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2592         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2593         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2594         return ret_conv;
2595 }
2596
2597 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2598         return owner->b;
2599 }
2600 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2601         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2602         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2605         return ret_arr;
2606 }
2607
2608 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2609         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2610         for (size_t i = 0; i < ret.datalen; i++) {
2611                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2612         }
2613         return ret;
2614 }
2615 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2616         return ThirtyTwoBytes_clone(&owner->a);
2617 }
2618 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
2619         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2620         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2621         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
2622         return ret_arr;
2623 }
2624
2625 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2626         return ThirtyTwoBytes_clone(&owner->b);
2627 }
2628 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
2629         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2630         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2631         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
2632         return ret_arr;
2633 }
2634
2635 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
2636         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
2637         for (size_t i = 0; i < ret.datalen; i++) {
2638                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
2639         }
2640         return ret;
2641 }
2642 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2643         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2644         switch(obj->tag) {
2645                 case LDKMonitorEvent_HTLCEvent: return 0;
2646                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2647                 case LDKMonitorEvent_Completed: return 2;
2648                 case LDKMonitorEvent_UpdateFailed: return 3;
2649                 default: abort();
2650         }
2651 }
2652 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2653         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2654         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2655                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2656                         uint64_t htlc_event_ref = 0;
2657                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2658                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2659         return htlc_event_ref;
2660 }
2661 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2662         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2663         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2664                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2665                         uint64_t commitment_tx_confirmed_ref = 0;
2666                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2667                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2668         return commitment_tx_confirmed_ref;
2669 }
2670 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2671         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2672         assert(obj->tag == LDKMonitorEvent_Completed);
2673                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2674                         uint64_t funding_txo_ref = 0;
2675                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2676                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2677         return funding_txo_ref;
2678 }
2679 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2680         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2681         assert(obj->tag == LDKMonitorEvent_Completed);
2682                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2683         return monitor_update_id_conv;
2684 }
2685 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2686         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2687         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2688                         LDKOutPoint update_failed_var = obj->update_failed;
2689                         uint64_t update_failed_ref = 0;
2690                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2691                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2692         return update_failed_ref;
2693 }
2694 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2695         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2696         for (size_t i = 0; i < ret.datalen; i++) {
2697                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2698         }
2699         return ret;
2700 }
2701 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2702         LDKOutPoint ret = owner->a;
2703         ret.is_owned = false;
2704         return ret;
2705 }
2706 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2707         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2708         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2709         uint64_t ret_ref = 0;
2710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2712         return ret_ref;
2713 }
2714
2715 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2716         return CVec_MonitorEventZ_clone(&owner->b);
2717 }
2718 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2719         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2720         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2721         uint64_tArray ret_arr = NULL;
2722         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2723         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2724         for (size_t o = 0; o < ret_var.datalen; o++) {
2725                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2726                 *ret_conv_14_copy = ret_var.data[o];
2727                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2728                 ret_arr_ptr[o] = ret_conv_14_ref;
2729         }
2730         
2731         FREE(ret_var.data);
2732         return ret_arr;
2733 }
2734
2735 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2736         return owner->c;
2737 }
2738 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2739         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2740         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2741         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2742         return ret_arr;
2743 }
2744
2745 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2746         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2747         for (size_t i = 0; i < ret.datalen; i++) {
2748                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2749         }
2750         return ret;
2751 }
2752 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2753         LDKFixedPenaltyScorer ret = *owner->contents.result;
2754         ret.is_owned = false;
2755         return ret;
2756 }
2757 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2758         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2759         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2760         uint64_t ret_ref = 0;
2761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2763         return ret_ref;
2764 }
2765
2766 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2767 CHECK(!owner->result_ok);
2768         return DecodeError_clone(&*owner->contents.err);
2769 }
2770 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2771         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2772         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2773         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2774         uint64_t ret_ref = tag_ptr(ret_copy, true);
2775         return ret_ref;
2776 }
2777
2778 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2779         return owner->a;
2780 }
2781 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2782         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2783         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2784         return ret_conv;
2785 }
2786
2787 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2788         return owner->b;
2789 }
2790 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2791         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2792         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2793         return ret_conv;
2794 }
2795
2796 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2797         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2798         switch(obj->tag) {
2799                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2800                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2801                 default: abort();
2802         }
2803 }
2804 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2805         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2806         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2807                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2808                         *some_conv = obj->some;
2809                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2810         return tag_ptr(some_conv, true);
2811 }
2812 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2813         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2814         for (size_t i = 0; i < ret.datalen; i++) {
2815                 ret.data[i] = NodeId_clone(&orig->data[i]);
2816         }
2817         return ret;
2818 }
2819 typedef struct LDKLogger_JCalls {
2820         atomic_size_t refcnt;
2821         uint32_t instance_ptr;
2822 } LDKLogger_JCalls;
2823 static void LDKLogger_JCalls_free(void* this_arg) {
2824         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2825         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2826                 FREE(j_calls);
2827         }
2828 }
2829 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2830         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2831         LDKRecord record_var = *record;
2832         uint64_t record_ref = 0;
2833         record_var = Record_clone(&record_var);
2834         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2835         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2836         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2837 }
2838 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2839         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2840         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2841 }
2842 static inline LDKLogger LDKLogger_init (JSValue o) {
2843         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2844         atomic_init(&calls->refcnt, 1);
2845         calls->instance_ptr = o;
2846
2847         LDKLogger ret = {
2848                 .this_arg = (void*) calls,
2849                 .log = log_LDKLogger_jcall,
2850                 .free = LDKLogger_JCalls_free,
2851         };
2852         return ret;
2853 }
2854 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2855         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2856         *res_ptr = LDKLogger_init(o);
2857         return tag_ptr(res_ptr, true);
2858 }
2859 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2860         LDKProbabilisticScorer ret = *owner->contents.result;
2861         ret.is_owned = false;
2862         return ret;
2863 }
2864 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2865         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2866         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2867         uint64_t ret_ref = 0;
2868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2870         return ret_ref;
2871 }
2872
2873 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2874 CHECK(!owner->result_ok);
2875         return DecodeError_clone(&*owner->contents.err);
2876 }
2877 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2878         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2879         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2880         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2881         uint64_t ret_ref = tag_ptr(ret_copy, true);
2882         return ret_ref;
2883 }
2884
2885 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2886         LDKInitFeatures ret = *owner->contents.result;
2887         ret.is_owned = false;
2888         return ret;
2889 }
2890 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2891         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2892         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2893         uint64_t ret_ref = 0;
2894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2896         return ret_ref;
2897 }
2898
2899 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2900 CHECK(!owner->result_ok);
2901         return DecodeError_clone(&*owner->contents.err);
2902 }
2903 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2904         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2905         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2906         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2907         uint64_t ret_ref = tag_ptr(ret_copy, true);
2908         return ret_ref;
2909 }
2910
2911 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2912         LDKChannelFeatures ret = *owner->contents.result;
2913         ret.is_owned = false;
2914         return ret;
2915 }
2916 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2917         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2918         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2919         uint64_t ret_ref = 0;
2920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2922         return ret_ref;
2923 }
2924
2925 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2926 CHECK(!owner->result_ok);
2927         return DecodeError_clone(&*owner->contents.err);
2928 }
2929 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2930         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2931         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2932         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2933         uint64_t ret_ref = tag_ptr(ret_copy, true);
2934         return ret_ref;
2935 }
2936
2937 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2938         LDKNodeFeatures ret = *owner->contents.result;
2939         ret.is_owned = false;
2940         return ret;
2941 }
2942 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2943         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2944         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2945         uint64_t ret_ref = 0;
2946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2948         return ret_ref;
2949 }
2950
2951 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2952 CHECK(!owner->result_ok);
2953         return DecodeError_clone(&*owner->contents.err);
2954 }
2955 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2956         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2958         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2959         uint64_t ret_ref = tag_ptr(ret_copy, true);
2960         return ret_ref;
2961 }
2962
2963 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2964         LDKInvoiceFeatures ret = *owner->contents.result;
2965         ret.is_owned = false;
2966         return ret;
2967 }
2968 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2969         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2970         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2971         uint64_t ret_ref = 0;
2972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2974         return ret_ref;
2975 }
2976
2977 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2978 CHECK(!owner->result_ok);
2979         return DecodeError_clone(&*owner->contents.err);
2980 }
2981 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2982         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2983         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2984         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2985         uint64_t ret_ref = tag_ptr(ret_copy, true);
2986         return ret_ref;
2987 }
2988
2989 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2990         LDKChannelTypeFeatures ret = *owner->contents.result;
2991         ret.is_owned = false;
2992         return ret;
2993 }
2994 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2995         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2996         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2997         uint64_t ret_ref = 0;
2998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3000         return ret_ref;
3001 }
3002
3003 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3004 CHECK(!owner->result_ok);
3005         return DecodeError_clone(&*owner->contents.err);
3006 }
3007 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3008         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3010         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3011         uint64_t ret_ref = tag_ptr(ret_copy, true);
3012         return ret_ref;
3013 }
3014
3015 static inline struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){
3016         LDKOfferFeatures ret = *owner->contents.result;
3017         ret.is_owned = false;
3018         return ret;
3019 }
3020 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3021         LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner);
3022         LDKOfferFeatures ret_var = CResult_OfferFeaturesDecodeErrorZ_get_ok(owner_conv);
3023         uint64_t ret_ref = 0;
3024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3026         return ret_ref;
3027 }
3028
3029 static inline struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){
3030 CHECK(!owner->result_ok);
3031         return DecodeError_clone(&*owner->contents.err);
3032 }
3033 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3034         LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner);
3035         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3036         *ret_copy = CResult_OfferFeaturesDecodeErrorZ_get_err(owner_conv);
3037         uint64_t ret_ref = tag_ptr(ret_copy, true);
3038         return ret_ref;
3039 }
3040
3041 static inline struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){
3042         LDKInvoiceRequestFeatures ret = *owner->contents.result;
3043         ret.is_owned = false;
3044         return ret;
3045 }
3046 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3047         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner);
3048         LDKInvoiceRequestFeatures ret_var = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(owner_conv);
3049         uint64_t ret_ref = 0;
3050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3052         return ret_ref;
3053 }
3054
3055 static inline struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){
3056 CHECK(!owner->result_ok);
3057         return DecodeError_clone(&*owner->contents.err);
3058 }
3059 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3060         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner);
3061         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3062         *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv);
3063         uint64_t ret_ref = tag_ptr(ret_copy, true);
3064         return ret_ref;
3065 }
3066
3067 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3068         LDKNodeId ret = *owner->contents.result;
3069         ret.is_owned = false;
3070         return ret;
3071 }
3072 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3073         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3074         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3075         uint64_t ret_ref = 0;
3076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3078         return ret_ref;
3079 }
3080
3081 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3082 CHECK(!owner->result_ok);
3083         return DecodeError_clone(&*owner->contents.err);
3084 }
3085 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3086         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3087         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3088         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3089         uint64_t ret_ref = tag_ptr(ret_copy, true);
3090         return ret_ref;
3091 }
3092
3093 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3094 CHECK(owner->result_ok);
3095         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3096 }
3097 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3098         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3099         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3100         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3101         uint64_t ret_ref = tag_ptr(ret_copy, true);
3102         return ret_ref;
3103 }
3104
3105 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3106 CHECK(!owner->result_ok);
3107         return DecodeError_clone(&*owner->contents.err);
3108 }
3109 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3110         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3111         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3112         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3113         uint64_t ret_ref = tag_ptr(ret_copy, true);
3114         return ret_ref;
3115 }
3116
3117 typedef struct LDKAccess_JCalls {
3118         atomic_size_t refcnt;
3119         uint32_t instance_ptr;
3120 } LDKAccess_JCalls;
3121 static void LDKAccess_JCalls_free(void* this_arg) {
3122         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3123         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3124                 FREE(j_calls);
3125         }
3126 }
3127 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3128         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3129         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3130         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3131         int64_t short_channel_id_conv = short_channel_id;
3132         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);
3133         void* ret_ptr = untag_ptr(ret);
3134         CHECK_ACCESS(ret_ptr);
3135         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3136         FREE(untag_ptr(ret));
3137         return ret_conv;
3138 }
3139 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3140         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3141         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3142 }
3143 static inline LDKAccess LDKAccess_init (JSValue o) {
3144         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3145         atomic_init(&calls->refcnt, 1);
3146         calls->instance_ptr = o;
3147
3148         LDKAccess ret = {
3149                 .this_arg = (void*) calls,
3150                 .get_utxo = get_utxo_LDKAccess_jcall,
3151                 .free = LDKAccess_JCalls_free,
3152         };
3153         return ret;
3154 }
3155 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3156         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3157         *res_ptr = LDKAccess_init(o);
3158         return tag_ptr(res_ptr, true);
3159 }
3160 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) {
3161         void* this_arg_ptr = untag_ptr(this_arg);
3162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3163         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3164         unsigned char genesis_hash_arr[32];
3165         CHECK(genesis_hash->arr_len == 32);
3166         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3167         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3168         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3169         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3170         return tag_ptr(ret_conv, true);
3171 }
3172
3173 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
3174         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3175         switch(obj->tag) {
3176                 case LDKCOption_AccessZ_Some: return 0;
3177                 case LDKCOption_AccessZ_None: return 1;
3178                 default: abort();
3179         }
3180 }
3181 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3182         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3183         assert(obj->tag == LDKCOption_AccessZ_Some);
3184                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3185                         *some_ret = obj->some;
3186                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3187                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3188                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3189                                 LDKAccess_JCalls_cloned(&(*some_ret));
3190                         }
3191         return tag_ptr(some_ret, true);
3192 }
3193 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3194 CHECK(owner->result_ok);
3195         return *owner->contents.result;
3196 }
3197 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3198         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3199         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3200         return ret_conv;
3201 }
3202
3203 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3204         LDKLightningError ret = *owner->contents.err;
3205         ret.is_owned = false;
3206         return ret;
3207 }
3208 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3209         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3210         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3211         uint64_t ret_ref = 0;
3212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3214         return ret_ref;
3215 }
3216
3217 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3218         LDKChannelAnnouncement ret = owner->a;
3219         ret.is_owned = false;
3220         return ret;
3221 }
3222 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3223         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3224         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3225         uint64_t ret_ref = 0;
3226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3228         return ret_ref;
3229 }
3230
3231 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3232         LDKChannelUpdate ret = owner->b;
3233         ret.is_owned = false;
3234         return ret;
3235 }
3236 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3237         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3238         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3239         uint64_t ret_ref = 0;
3240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3242         return ret_ref;
3243 }
3244
3245 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3246         LDKChannelUpdate ret = owner->c;
3247         ret.is_owned = false;
3248         return ret;
3249 }
3250 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3251         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3252         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3253         uint64_t ret_ref = 0;
3254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3256         return ret_ref;
3257 }
3258
3259 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3260         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3261         switch(obj->tag) {
3262                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3263                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3264                 default: abort();
3265         }
3266 }
3267 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3268         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3269         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3270                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3271                         *some_conv = obj->some;
3272                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3273         return tag_ptr(some_conv, true);
3274 }
3275 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3276 CHECK(owner->result_ok);
3277         return *owner->contents.result;
3278 }
3279 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3280         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3281         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3282 }
3283
3284 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3285         LDKLightningError ret = *owner->contents.err;
3286         ret.is_owned = false;
3287         return ret;
3288 }
3289 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3290         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3291         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3292         uint64_t ret_ref = 0;
3293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3295         return ret_ref;
3296 }
3297
3298 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3299         LDKChannelUpdateInfo ret = *owner->contents.result;
3300         ret.is_owned = false;
3301         return ret;
3302 }
3303 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3304         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3305         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3306         uint64_t ret_ref = 0;
3307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3309         return ret_ref;
3310 }
3311
3312 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3313 CHECK(!owner->result_ok);
3314         return DecodeError_clone(&*owner->contents.err);
3315 }
3316 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3317         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3318         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3319         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3320         uint64_t ret_ref = tag_ptr(ret_copy, true);
3321         return ret_ref;
3322 }
3323
3324 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3325         LDKChannelInfo ret = *owner->contents.result;
3326         ret.is_owned = false;
3327         return ret;
3328 }
3329 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3330         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3331         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3332         uint64_t ret_ref = 0;
3333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3335         return ret_ref;
3336 }
3337
3338 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3339 CHECK(!owner->result_ok);
3340         return DecodeError_clone(&*owner->contents.err);
3341 }
3342 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3343         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3344         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3345         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3346         uint64_t ret_ref = tag_ptr(ret_copy, true);
3347         return ret_ref;
3348 }
3349
3350 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3351         LDKRoutingFees ret = *owner->contents.result;
3352         ret.is_owned = false;
3353         return ret;
3354 }
3355 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3356         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3357         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3358         uint64_t ret_ref = 0;
3359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3361         return ret_ref;
3362 }
3363
3364 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3365 CHECK(!owner->result_ok);
3366         return DecodeError_clone(&*owner->contents.err);
3367 }
3368 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3369         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3370         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3371         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3372         uint64_t ret_ref = tag_ptr(ret_copy, true);
3373         return ret_ref;
3374 }
3375
3376 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3377         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3378         switch(obj->tag) {
3379                 case LDKNetAddress_IPv4: return 0;
3380                 case LDKNetAddress_IPv6: return 1;
3381                 case LDKNetAddress_OnionV2: return 2;
3382                 case LDKNetAddress_OnionV3: return 3;
3383                 case LDKNetAddress_Hostname: return 4;
3384                 default: abort();
3385         }
3386 }
3387 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3388         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3389         assert(obj->tag == LDKNetAddress_IPv4);
3390                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3391                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3392         return addr_arr;
3393 }
3394 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3395         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3396         assert(obj->tag == LDKNetAddress_IPv4);
3397                         int16_t port_conv = obj->i_pv4.port;
3398         return port_conv;
3399 }
3400 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3401         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3402         assert(obj->tag == LDKNetAddress_IPv6);
3403                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3404                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3405         return addr_arr;
3406 }
3407 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3408         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3409         assert(obj->tag == LDKNetAddress_IPv6);
3410                         int16_t port_conv = obj->i_pv6.port;
3411         return port_conv;
3412 }
3413 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3414         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3415         assert(obj->tag == LDKNetAddress_OnionV2);
3416                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3417                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3418         return onion_v2_arr;
3419 }
3420 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3421         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3422         assert(obj->tag == LDKNetAddress_OnionV3);
3423                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3424                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3425         return ed25519_pubkey_arr;
3426 }
3427 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3428         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3429         assert(obj->tag == LDKNetAddress_OnionV3);
3430                         int16_t checksum_conv = obj->onion_v3.checksum;
3431         return checksum_conv;
3432 }
3433 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3434         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3435         assert(obj->tag == LDKNetAddress_OnionV3);
3436                         int8_t version_conv = obj->onion_v3.version;
3437         return version_conv;
3438 }
3439 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3440         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3441         assert(obj->tag == LDKNetAddress_OnionV3);
3442                         int16_t port_conv = obj->onion_v3.port;
3443         return port_conv;
3444 }
3445 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3446         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3447         assert(obj->tag == LDKNetAddress_Hostname);
3448                         LDKHostname hostname_var = obj->hostname.hostname;
3449                         uint64_t hostname_ref = 0;
3450                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3451                         hostname_ref = tag_ptr(hostname_var.inner, false);
3452         return hostname_ref;
3453 }
3454 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3455         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3456         assert(obj->tag == LDKNetAddress_Hostname);
3457                         int16_t port_conv = obj->hostname.port;
3458         return port_conv;
3459 }
3460 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3461         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3462         for (size_t i = 0; i < ret.datalen; i++) {
3463                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3464         }
3465         return ret;
3466 }
3467 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3468         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3469         ret.is_owned = false;
3470         return ret;
3471 }
3472 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3473         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3474         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3475         uint64_t ret_ref = 0;
3476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3478         return ret_ref;
3479 }
3480
3481 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3482 CHECK(!owner->result_ok);
3483         return DecodeError_clone(&*owner->contents.err);
3484 }
3485 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3486         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3488         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3489         uint64_t ret_ref = tag_ptr(ret_copy, true);
3490         return ret_ref;
3491 }
3492
3493 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3494         LDKNodeAlias ret = *owner->contents.result;
3495         ret.is_owned = false;
3496         return ret;
3497 }
3498 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3499         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3500         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3501         uint64_t ret_ref = 0;
3502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3504         return ret_ref;
3505 }
3506
3507 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3508 CHECK(!owner->result_ok);
3509         return DecodeError_clone(&*owner->contents.err);
3510 }
3511 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3512         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3513         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3514         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3515         uint64_t ret_ref = tag_ptr(ret_copy, true);
3516         return ret_ref;
3517 }
3518
3519 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3520         LDKNodeInfo ret = *owner->contents.result;
3521         ret.is_owned = false;
3522         return ret;
3523 }
3524 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3525         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3526         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3527         uint64_t ret_ref = 0;
3528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3530         return ret_ref;
3531 }
3532
3533 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3534 CHECK(!owner->result_ok);
3535         return DecodeError_clone(&*owner->contents.err);
3536 }
3537 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3538         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3539         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3540         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3541         uint64_t ret_ref = tag_ptr(ret_copy, true);
3542         return ret_ref;
3543 }
3544
3545 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3546         LDKNetworkGraph ret = *owner->contents.result;
3547         ret.is_owned = false;
3548         return ret;
3549 }
3550 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3551         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3552         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3553         uint64_t ret_ref = 0;
3554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3556         return ret_ref;
3557 }
3558
3559 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3560 CHECK(!owner->result_ok);
3561         return DecodeError_clone(&*owner->contents.err);
3562 }
3563 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3564         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3565         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3566         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3567         uint64_t ret_ref = tag_ptr(ret_copy, true);
3568         return ret_ref;
3569 }
3570
3571 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3572         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3573         switch(obj->tag) {
3574                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3575                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3576                 default: abort();
3577         }
3578 }
3579 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3580         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3581         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3582                         LDKCVec_NetAddressZ some_var = obj->some;
3583                         uint64_tArray some_arr = NULL;
3584                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3585                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3586                         for (size_t m = 0; m < some_var.datalen; m++) {
3587                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3588                                 some_arr_ptr[m] = some_conv_12_ref;
3589                         }
3590                         
3591         return some_arr;
3592 }
3593 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3594         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3595         ret.is_owned = false;
3596         return ret;
3597 }
3598 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3599         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3600         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3601         uint64_t ret_ref = 0;
3602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3604         return ret_ref;
3605 }
3606
3607 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3608 CHECK(!owner->result_ok);
3609         return DecodeError_clone(&*owner->contents.err);
3610 }
3611 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3612         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3613         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3614         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3615         uint64_t ret_ref = tag_ptr(ret_copy, true);
3616         return ret_ref;
3617 }
3618
3619 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3620         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3621         ret.is_owned = false;
3622         return ret;
3623 }
3624 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3625         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3626         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3627         uint64_t ret_ref = 0;
3628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3630         return ret_ref;
3631 }
3632
3633 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3634 CHECK(!owner->result_ok);
3635         return DecodeError_clone(&*owner->contents.err);
3636 }
3637 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3638         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3639         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3640         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3641         uint64_t ret_ref = tag_ptr(ret_copy, true);
3642         return ret_ref;
3643 }
3644
3645 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3646 CHECK(owner->result_ok);
3647         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3648 }
3649 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3650         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3651         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3652         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3653         uint64_t ret_ref = tag_ptr(ret_copy, true);
3654         return ret_ref;
3655 }
3656
3657 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3658 CHECK(!owner->result_ok);
3659         return DecodeError_clone(&*owner->contents.err);
3660 }
3661 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3662         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3664         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3665         uint64_t ret_ref = tag_ptr(ret_copy, true);
3666         return ret_ref;
3667 }
3668
3669 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3670         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3671         for (size_t i = 0; i < ret.datalen; i++) {
3672                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3673         }
3674         return ret;
3675 }
3676 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3677         return owner->a;
3678 }
3679 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3680         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3681         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3682         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3683         return ret_arr;
3684 }
3685
3686 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3687         return owner->b;
3688 }
3689 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3690         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3691         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3692         ptrArray ret_arr = NULL;
3693         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3694         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3695         for (size_t m = 0; m < ret_var.datalen; m++) {
3696                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3697                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3698                 ret_arr_ptr[m] = ret_conv_12_arr;
3699         }
3700         
3701         return ret_arr;
3702 }
3703
3704 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3705 CHECK(owner->result_ok);
3706         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3707 }
3708 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3709         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3710         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3711         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3712         return tag_ptr(ret_conv, true);
3713 }
3714
3715 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3716 CHECK(!owner->result_ok);
3717         return *owner->contents.err;
3718 }
3719 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3720         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3721         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3722 }
3723
3724 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3725 CHECK(owner->result_ok);
3726         return *owner->contents.result;
3727 }
3728 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3729         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3730         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3731         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3732         return ret_arr;
3733 }
3734
3735 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3736 CHECK(!owner->result_ok);
3737         return *owner->contents.err;
3738 }
3739 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3740         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3741         CResult_SignatureNoneZ_get_err(owner_conv);
3742 }
3743
3744 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3745         return owner->a;
3746 }
3747 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3748         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3749         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3750         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3751         return ret_arr;
3752 }
3753
3754 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3755         return owner->b;
3756 }
3757 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3758         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3759         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3760         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3761         return ret_arr;
3762 }
3763
3764 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3765 CHECK(owner->result_ok);
3766         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3767 }
3768 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3769         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3770         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3771         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3772         return tag_ptr(ret_conv, true);
3773 }
3774
3775 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3776 CHECK(!owner->result_ok);
3777         return *owner->contents.err;
3778 }
3779 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3780         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3781         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3782 }
3783
3784 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3785 CHECK(owner->result_ok);
3786         return *owner->contents.result;
3787 }
3788 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3789         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3790         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3791         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3792         return ret_arr;
3793 }
3794
3795 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3796 CHECK(!owner->result_ok);
3797         return *owner->contents.err;
3798 }
3799 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3800         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3801         CResult_SecretKeyNoneZ_get_err(owner_conv);
3802 }
3803
3804 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3805 CHECK(owner->result_ok);
3806         return *owner->contents.result;
3807 }
3808 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3809         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3810         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3811         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3812         return ret_arr;
3813 }
3814
3815 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3816 CHECK(!owner->result_ok);
3817         return *owner->contents.err;
3818 }
3819 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
3820         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3821         CResult_PublicKeyNoneZ_get_err(owner_conv);
3822 }
3823
3824 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3825         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3826         switch(obj->tag) {
3827                 case LDKCOption_ScalarZ_Some: return 0;
3828                 case LDKCOption_ScalarZ_None: return 1;
3829                 default: abort();
3830         }
3831 }
3832 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3833         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3834         assert(obj->tag == LDKCOption_ScalarZ_Some);
3835                         LDKBigEndianScalar* some_ref = &obj->some;
3836         return tag_ptr(some_ref, false);
3837 }
3838 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3839 CHECK(owner->result_ok);
3840         return ThirtyTwoBytes_clone(&*owner->contents.result);
3841 }
3842 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3843         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3844         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3845         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3846         return ret_arr;
3847 }
3848
3849 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3850 CHECK(!owner->result_ok);
3851         return *owner->contents.err;
3852 }
3853 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3854         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3855         CResult_SharedSecretNoneZ_get_err(owner_conv);
3856 }
3857
3858 typedef struct LDKBaseSign_JCalls {
3859         atomic_size_t refcnt;
3860         uint32_t instance_ptr;
3861 } LDKBaseSign_JCalls;
3862 static void LDKBaseSign_JCalls_free(void* this_arg) {
3863         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3864         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3865                 FREE(j_calls);
3866         }
3867 }
3868 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3869         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3870         int64_t idx_conv = idx;
3871         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3872         LDKPublicKey ret_ref;
3873         CHECK(ret->arr_len == 33);
3874         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3875         return ret_ref;
3876 }
3877 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3878         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3879         int64_t idx_conv = idx;
3880         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3881         LDKThirtyTwoBytes ret_ref;
3882         CHECK(ret->arr_len == 32);
3883         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3884         return ret_ref;
3885 }
3886 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3887         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3888         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3889         uint64_t holder_tx_ref = 0;
3890         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3891         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3892         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3893         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3894         ptrArray preimages_arr = NULL;
3895         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3896         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3897         for (size_t m = 0; m < preimages_var.datalen; m++) {
3898                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3899                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3900                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3901         }
3902         
3903         FREE(preimages_var.data);
3904         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3905         void* ret_ptr = untag_ptr(ret);
3906         CHECK_ACCESS(ret_ptr);
3907         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3908         FREE(untag_ptr(ret));
3909         return ret_conv;
3910 }
3911 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3912         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3913         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3914         LDKThirtyTwoBytes ret_ref;
3915         CHECK(ret->arr_len == 32);
3916         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3917         return ret_ref;
3918 }
3919 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3920         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3921         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3922         uint64_t commitment_tx_ref = 0;
3923         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3924         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3925         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3926         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3927         ptrArray preimages_arr = NULL;
3928         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3929         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3930         for (size_t m = 0; m < preimages_var.datalen; m++) {
3931                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3932                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3933                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3934         }
3935         
3936         FREE(preimages_var.data);
3937         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3938         void* ret_ptr = untag_ptr(ret);
3939         CHECK_ACCESS(ret_ptr);
3940         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3941         FREE(untag_ptr(ret));
3942         return ret_conv;
3943 }
3944 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3945         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3946         int64_t idx_conv = idx;
3947         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3948         memcpy(secret_arr->elems, *secret, 32);
3949         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3950         void* ret_ptr = untag_ptr(ret);
3951         CHECK_ACCESS(ret_ptr);
3952         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3953         FREE(untag_ptr(ret));
3954         return ret_conv;
3955 }
3956 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3957         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3958         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3959         uint64_t commitment_tx_ref = 0;
3960         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3961         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3962         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3963         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3964         void* ret_ptr = untag_ptr(ret);
3965         CHECK_ACCESS(ret_ptr);
3966         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3967         FREE(untag_ptr(ret));
3968         return ret_conv;
3969 }
3970 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]) {
3971         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3972         LDKTransaction justice_tx_var = justice_tx;
3973         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3974         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3975         Transaction_free(justice_tx_var);
3976         uint32_t input_conv = input;
3977         int64_t amount_conv = amount;
3978         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3979         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3980         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);
3981         void* ret_ptr = untag_ptr(ret);
3982         CHECK_ACCESS(ret_ptr);
3983         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3984         FREE(untag_ptr(ret));
3985         return ret_conv;
3986 }
3987 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) {
3988         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3989         LDKTransaction justice_tx_var = justice_tx;
3990         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3991         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3992         Transaction_free(justice_tx_var);
3993         uint32_t input_conv = input;
3994         int64_t amount_conv = amount;
3995         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3996         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3997         LDKHTLCOutputInCommitment htlc_var = *htlc;
3998         uint64_t htlc_ref = 0;
3999         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4000         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4001         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4002         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);
4003         void* ret_ptr = untag_ptr(ret);
4004         CHECK_ACCESS(ret_ptr);
4005         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4006         FREE(untag_ptr(ret));
4007         return ret_conv;
4008 }
4009 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) {
4010         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4011         LDKTransaction htlc_tx_var = htlc_tx;
4012         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4013         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4014         Transaction_free(htlc_tx_var);
4015         uint32_t input_conv = input;
4016         int64_t amount_conv = amount;
4017         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4018         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4019         LDKHTLCOutputInCommitment htlc_var = *htlc;
4020         uint64_t htlc_ref = 0;
4021         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4022         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4023         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4024         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);
4025         void* ret_ptr = untag_ptr(ret);
4026         CHECK_ACCESS(ret_ptr);
4027         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4028         FREE(untag_ptr(ret));
4029         return ret_conv;
4030 }
4031 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4032         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4033         LDKClosingTransaction closing_tx_var = *closing_tx;
4034         uint64_t closing_tx_ref = 0;
4035         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4036         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4037         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4038         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
4039         void* ret_ptr = untag_ptr(ret);
4040         CHECK_ACCESS(ret_ptr);
4041         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4042         FREE(untag_ptr(ret));
4043         return ret_conv;
4044 }
4045 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4046         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4047         LDKTransaction anchor_tx_var = anchor_tx;
4048         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4049         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4050         Transaction_free(anchor_tx_var);
4051         uint32_t input_conv = input;
4052         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4053         void* ret_ptr = untag_ptr(ret);
4054         CHECK_ACCESS(ret_ptr);
4055         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4056         FREE(untag_ptr(ret));
4057         return ret_conv;
4058 }
4059 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4060         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4061         LDKUnsignedChannelAnnouncement msg_var = *msg;
4062         uint64_t msg_ref = 0;
4063         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4064         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4065         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4066         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
4067         void* ret_ptr = untag_ptr(ret);
4068         CHECK_ACCESS(ret_ptr);
4069         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4070         FREE(untag_ptr(ret));
4071         return ret_conv;
4072 }
4073 void provide_channel_parameters_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4074         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4075         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4076         uint64_t channel_parameters_ref = 0;
4077         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4078         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4079         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4080         js_invoke_function_buuuuu(j_calls->instance_ptr, 15, channel_parameters_ref, 0, 0, 0, 0, 0);
4081 }
4082 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
4083         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
4084         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4085 }
4086 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
4087         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4088         atomic_init(&calls->refcnt, 1);
4089         calls->instance_ptr = o;
4090
4091         LDKChannelPublicKeys pubkeys_conv;
4092         pubkeys_conv.inner = untag_ptr(pubkeys);
4093         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4094         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4095
4096         LDKBaseSign ret = {
4097                 .this_arg = (void*) calls,
4098                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4099                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4100                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4101                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4102                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4103                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4104                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4105                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4106                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4107                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4108                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4109                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall,
4110                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4111                 .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall,
4112                 .free = LDKBaseSign_JCalls_free,
4113                 .pubkeys = pubkeys_conv,
4114                 .set_pubkeys = NULL,
4115         };
4116         return ret;
4117 }
4118 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
4119         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4120         *res_ptr = LDKBaseSign_init(o, pubkeys);
4121         return tag_ptr(res_ptr, true);
4122 }
4123 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4124         void* this_arg_ptr = untag_ptr(this_arg);
4125         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4126         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4127         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4128         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4129         return ret_arr;
4130 }
4131
4132 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4133         void* this_arg_ptr = untag_ptr(this_arg);
4134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4135         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4136         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4137         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4138         return ret_arr;
4139 }
4140
4141 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) {
4142         void* this_arg_ptr = untag_ptr(this_arg);
4143         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4144         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4145         LDKHolderCommitmentTransaction holder_tx_conv;
4146         holder_tx_conv.inner = untag_ptr(holder_tx);
4147         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4148         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4149         holder_tx_conv.is_owned = false;
4150         LDKCVec_PaymentPreimageZ preimages_constr;
4151         preimages_constr.datalen = preimages->arr_len;
4152         if (preimages_constr.datalen > 0)
4153                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4154         else
4155                 preimages_constr.data = NULL;
4156         int8_tArray* preimages_vals = (void*) preimages->elems;
4157         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4158                 int8_tArray preimages_conv_12 = preimages_vals[m];
4159                 LDKThirtyTwoBytes preimages_conv_12_ref;
4160                 CHECK(preimages_conv_12->arr_len == 32);
4161                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4162                 preimages_constr.data[m] = preimages_conv_12_ref;
4163         }
4164         FREE(preimages);
4165         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4166         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4167         return tag_ptr(ret_conv, true);
4168 }
4169
4170 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
4171         void* this_arg_ptr = untag_ptr(this_arg);
4172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4173         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4174         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4175         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4176         return ret_arr;
4177 }
4178
4179 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) {
4180         void* this_arg_ptr = untag_ptr(this_arg);
4181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4182         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4183         LDKCommitmentTransaction commitment_tx_conv;
4184         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4185         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4186         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4187         commitment_tx_conv.is_owned = false;
4188         LDKCVec_PaymentPreimageZ preimages_constr;
4189         preimages_constr.datalen = preimages->arr_len;
4190         if (preimages_constr.datalen > 0)
4191                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4192         else
4193                 preimages_constr.data = NULL;
4194         int8_tArray* preimages_vals = (void*) preimages->elems;
4195         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4196                 int8_tArray preimages_conv_12 = preimages_vals[m];
4197                 LDKThirtyTwoBytes preimages_conv_12_ref;
4198                 CHECK(preimages_conv_12->arr_len == 32);
4199                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4200                 preimages_constr.data[m] = preimages_conv_12_ref;
4201         }
4202         FREE(preimages);
4203         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4204         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4205         return tag_ptr(ret_conv, true);
4206 }
4207
4208 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) {
4209         void* this_arg_ptr = untag_ptr(this_arg);
4210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4211         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4212         unsigned char secret_arr[32];
4213         CHECK(secret->arr_len == 32);
4214         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4215         unsigned char (*secret_ref)[32] = &secret_arr;
4216         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4217         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4218         return tag_ptr(ret_conv, true);
4219 }
4220
4221 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) {
4222         void* this_arg_ptr = untag_ptr(this_arg);
4223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4224         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4225         LDKHolderCommitmentTransaction commitment_tx_conv;
4226         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4227         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4228         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4229         commitment_tx_conv.is_owned = false;
4230         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4231         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4232         return tag_ptr(ret_conv, true);
4233 }
4234
4235 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) {
4236         void* this_arg_ptr = untag_ptr(this_arg);
4237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4238         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4239         LDKTransaction justice_tx_ref;
4240         justice_tx_ref.datalen = justice_tx->arr_len;
4241         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4242         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4243         justice_tx_ref.data_is_owned = true;
4244         unsigned char per_commitment_key_arr[32];
4245         CHECK(per_commitment_key->arr_len == 32);
4246         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4247         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4248         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4249         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4250         return tag_ptr(ret_conv, true);
4251 }
4252
4253 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) {
4254         void* this_arg_ptr = untag_ptr(this_arg);
4255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4256         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4257         LDKTransaction justice_tx_ref;
4258         justice_tx_ref.datalen = justice_tx->arr_len;
4259         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4260         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4261         justice_tx_ref.data_is_owned = true;
4262         unsigned char per_commitment_key_arr[32];
4263         CHECK(per_commitment_key->arr_len == 32);
4264         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4265         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4266         LDKHTLCOutputInCommitment htlc_conv;
4267         htlc_conv.inner = untag_ptr(htlc);
4268         htlc_conv.is_owned = ptr_is_owned(htlc);
4269         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4270         htlc_conv.is_owned = false;
4271         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4272         *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);
4273         return tag_ptr(ret_conv, true);
4274 }
4275
4276 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) {
4277         void* this_arg_ptr = untag_ptr(this_arg);
4278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4279         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4280         LDKTransaction htlc_tx_ref;
4281         htlc_tx_ref.datalen = htlc_tx->arr_len;
4282         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4283         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4284         htlc_tx_ref.data_is_owned = true;
4285         LDKPublicKey per_commitment_point_ref;
4286         CHECK(per_commitment_point->arr_len == 33);
4287         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4288         LDKHTLCOutputInCommitment htlc_conv;
4289         htlc_conv.inner = untag_ptr(htlc);
4290         htlc_conv.is_owned = ptr_is_owned(htlc);
4291         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4292         htlc_conv.is_owned = false;
4293         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4294         *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);
4295         return tag_ptr(ret_conv, true);
4296 }
4297
4298 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4299         void* this_arg_ptr = untag_ptr(this_arg);
4300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4301         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4302         LDKClosingTransaction closing_tx_conv;
4303         closing_tx_conv.inner = untag_ptr(closing_tx);
4304         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4305         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4306         closing_tx_conv.is_owned = false;
4307         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4308         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4309         return tag_ptr(ret_conv, true);
4310 }
4311
4312 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) {
4313         void* this_arg_ptr = untag_ptr(this_arg);
4314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4315         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4316         LDKTransaction anchor_tx_ref;
4317         anchor_tx_ref.datalen = anchor_tx->arr_len;
4318         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4319         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4320         anchor_tx_ref.data_is_owned = true;
4321         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4322         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4323         return tag_ptr(ret_conv, true);
4324 }
4325
4326 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4327         void* this_arg_ptr = untag_ptr(this_arg);
4328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4329         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4330         LDKUnsignedChannelAnnouncement msg_conv;
4331         msg_conv.inner = untag_ptr(msg);
4332         msg_conv.is_owned = ptr_is_owned(msg);
4333         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4334         msg_conv.is_owned = false;
4335         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4336         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4337         return tag_ptr(ret_conv, true);
4338 }
4339
4340 void  __attribute__((export_name("TS_BaseSign_provide_channel_parameters"))) TS_BaseSign_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4341         void* this_arg_ptr = untag_ptr(this_arg);
4342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4343         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4344         LDKChannelTransactionParameters channel_parameters_conv;
4345         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4346         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4347         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4348         channel_parameters_conv.is_owned = false;
4349         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4350 }
4351
4352 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4353         if (this_arg->set_pubkeys != NULL)
4354                 this_arg->set_pubkeys(this_arg);
4355         return this_arg->pubkeys;
4356 }
4357 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4358         void* this_arg_ptr = untag_ptr(this_arg);
4359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4360         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4361         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4362         uint64_t ret_ref = 0;
4363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4365         return ret_ref;
4366 }
4367
4368 typedef struct LDKSign_JCalls {
4369         atomic_size_t refcnt;
4370         uint32_t instance_ptr;
4371         LDKBaseSign_JCalls* BaseSign;
4372 } LDKSign_JCalls;
4373 static void LDKSign_JCalls_free(void* this_arg) {
4374         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4375         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4376                 FREE(j_calls);
4377         }
4378 }
4379 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4380         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4381         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4382         LDKCVec_u8Z ret_ref;
4383         ret_ref.datalen = ret->arr_len;
4384         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4385         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4386         return ret_ref;
4387 }
4388 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4389         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4390         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4391         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4392 }
4393 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4394         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4395         atomic_init(&calls->refcnt, 1);
4396         calls->instance_ptr = o;
4397
4398         LDKChannelPublicKeys pubkeys_conv;
4399         pubkeys_conv.inner = untag_ptr(pubkeys);
4400         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4401         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4402
4403         LDKSign ret = {
4404                 .this_arg = (void*) calls,
4405                 .write = write_LDKSign_jcall,
4406                 .cloned = LDKSign_JCalls_cloned,
4407                 .free = LDKSign_JCalls_free,
4408                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4409         };
4410         calls->BaseSign = ret.BaseSign.this_arg;
4411         return ret;
4412 }
4413 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4414         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4415         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4416         return tag_ptr(res_ptr, true);
4417 }
4418 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4419         void* this_arg_ptr = untag_ptr(this_arg);
4420         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4421         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4422         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4425         CVec_u8Z_free(ret_var);
4426         return ret_arr;
4427 }
4428
4429 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4430 CHECK(owner->result_ok);
4431         return Sign_clone(&*owner->contents.result);
4432 }
4433 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4434         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4435         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4436         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4437         return tag_ptr(ret_ret, true);
4438 }
4439
4440 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4441 CHECK(!owner->result_ok);
4442         return DecodeError_clone(&*owner->contents.err);
4443 }
4444 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4445         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4446         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4447         *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv);
4448         uint64_t ret_ref = tag_ptr(ret_copy, true);
4449         return ret_ref;
4450 }
4451
4452 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4453 CHECK(owner->result_ok);
4454         return *owner->contents.result;
4455 }
4456 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4457         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4458         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4459         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4460         return ret_arr;
4461 }
4462
4463 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4464 CHECK(!owner->result_ok);
4465         return *owner->contents.err;
4466 }
4467 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4468         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4469         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4470 }
4471
4472 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4473         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4474         for (size_t i = 0; i < ret.datalen; i++) {
4475                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4476         }
4477         return ret;
4478 }
4479 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4480 CHECK(owner->result_ok);
4481         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4482 }
4483 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4484         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4485         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4486         ptrArray ret_arr = NULL;
4487         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4488         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4489         for (size_t m = 0; m < ret_var.datalen; m++) {
4490                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4491                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4492                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4493                 CVec_u8Z_free(ret_conv_12_var);
4494                 ret_arr_ptr[m] = ret_conv_12_arr;
4495         }
4496         
4497         FREE(ret_var.data);
4498         return ret_arr;
4499 }
4500
4501 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4502 CHECK(!owner->result_ok);
4503         return *owner->contents.err;
4504 }
4505 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4506         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4507         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4508 }
4509
4510 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4511         LDKInMemorySigner ret = *owner->contents.result;
4512         ret.is_owned = false;
4513         return ret;
4514 }
4515 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4516         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4517         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4518         uint64_t ret_ref = 0;
4519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4521         return ret_ref;
4522 }
4523
4524 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4525 CHECK(!owner->result_ok);
4526         return DecodeError_clone(&*owner->contents.err);
4527 }
4528 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4529         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4531         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4532         uint64_t ret_ref = tag_ptr(ret_copy, true);
4533         return ret_ref;
4534 }
4535
4536 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4537         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4538         for (size_t i = 0; i < ret.datalen; i++) {
4539                 ret.data[i] = TxOut_clone(&orig->data[i]);
4540         }
4541         return ret;
4542 }
4543 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4544 CHECK(owner->result_ok);
4545         return *owner->contents.result;
4546 }
4547 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4548         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4549         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4550         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4551         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4552         return ret_arr;
4553 }
4554
4555 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4556 CHECK(!owner->result_ok);
4557         return *owner->contents.err;
4558 }
4559 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4560         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4561         CResult_TransactionNoneZ_get_err(owner_conv);
4562 }
4563
4564 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4565         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4566         switch(obj->tag) {
4567                 case LDKCOption_u16Z_Some: return 0;
4568                 case LDKCOption_u16Z_None: return 1;
4569                 default: abort();
4570         }
4571 }
4572 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4573         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4574         assert(obj->tag == LDKCOption_u16Z_Some);
4575                         int16_t some_conv = obj->some;
4576         return some_conv;
4577 }
4578 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4579         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4580         switch(obj->tag) {
4581                 case LDKAPIError_APIMisuseError: return 0;
4582                 case LDKAPIError_FeeRateTooHigh: return 1;
4583                 case LDKAPIError_InvalidRoute: return 2;
4584                 case LDKAPIError_ChannelUnavailable: return 3;
4585                 case LDKAPIError_MonitorUpdateInProgress: return 4;
4586                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4587                 default: abort();
4588         }
4589 }
4590 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4591         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4592         assert(obj->tag == LDKAPIError_APIMisuseError);
4593                         LDKStr err_str = obj->api_misuse_error.err;
4594                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4595         return err_conv;
4596 }
4597 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4598         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4599         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4600                         LDKStr err_str = obj->fee_rate_too_high.err;
4601                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4602         return err_conv;
4603 }
4604 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4605         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4606         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4607                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4608         return feerate_conv;
4609 }
4610 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
4611         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4612         assert(obj->tag == LDKAPIError_InvalidRoute);
4613                         LDKStr err_str = obj->invalid_route.err;
4614                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4615         return err_conv;
4616 }
4617 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4618         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4619         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4620                         LDKStr err_str = obj->channel_unavailable.err;
4621                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4622         return err_conv;
4623 }
4624 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4625         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4626         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4627                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4628                         uint64_t script_ref = 0;
4629                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4630                         script_ref = tag_ptr(script_var.inner, false);
4631         return script_ref;
4632 }
4633 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4634 CHECK(owner->result_ok);
4635         return *owner->contents.result;
4636 }
4637 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4638         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4639         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4640 }
4641
4642 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4643 CHECK(!owner->result_ok);
4644         return APIError_clone(&*owner->contents.err);
4645 }
4646 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4647         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4648         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4649         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4650         uint64_t ret_ref = tag_ptr(ret_copy, true);
4651         return ret_ref;
4652 }
4653
4654 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4655         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4656         for (size_t i = 0; i < ret.datalen; i++) {
4657                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4658         }
4659         return ret;
4660 }
4661 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4662         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4663         for (size_t i = 0; i < ret.datalen; i++) {
4664                 ret.data[i] = APIError_clone(&orig->data[i]);
4665         }
4666         return ret;
4667 }
4668 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4669 CHECK(owner->result_ok);
4670         return ThirtyTwoBytes_clone(&*owner->contents.result);
4671 }
4672 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4673         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4675         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4676         return ret_arr;
4677 }
4678
4679 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4680 CHECK(!owner->result_ok);
4681         return APIError_clone(&*owner->contents.err);
4682 }
4683 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4684         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4685         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4686         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4687         uint64_t ret_ref = tag_ptr(ret_copy, true);
4688         return ret_ref;
4689 }
4690
4691 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4692         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4693         switch(obj->tag) {
4694                 case LDKPaymentSendFailure_ParameterError: return 0;
4695                 case LDKPaymentSendFailure_PathParameterError: return 1;
4696                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4697                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4698                 case LDKPaymentSendFailure_PartialFailure: return 4;
4699                 default: abort();
4700         }
4701 }
4702 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4703         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4704         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4705                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4706         return parameter_error_ref;
4707 }
4708 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4709         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4710         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4711                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4712                         uint64_tArray path_parameter_error_arr = NULL;
4713                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4714                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4715                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4716                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4717                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4718                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4719                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4720                         }
4721                         
4722         return path_parameter_error_arr;
4723 }
4724 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4725         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4726         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4727                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4728                         uint64_tArray all_failed_resend_safe_arr = NULL;
4729                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4730                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4731                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4732                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4733                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4734                         }
4735                         
4736         return all_failed_resend_safe_arr;
4737 }
4738 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4739         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4740         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4741                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4742                         uint64_tArray results_arr = NULL;
4743                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4744                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4745                         for (size_t w = 0; w < results_var.datalen; w++) {
4746                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4747                                 *results_conv_22_conv = results_var.data[w];
4748                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4749                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4750                         }
4751                         
4752         return results_arr;
4753 }
4754 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4755         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4756         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4757                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4758                         uint64_t failed_paths_retry_ref = 0;
4759                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4760                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4761         return failed_paths_retry_ref;
4762 }
4763 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4764         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4765         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4766                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4767                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4768         return payment_id_arr;
4769 }
4770 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4771 CHECK(owner->result_ok);
4772         return *owner->contents.result;
4773 }
4774 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4775         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4776         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4777 }
4778
4779 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4780 CHECK(!owner->result_ok);
4781         return PaymentSendFailure_clone(&*owner->contents.err);
4782 }
4783 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4784         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4785         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4786         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4787         uint64_t ret_ref = tag_ptr(ret_copy, true);
4788         return ret_ref;
4789 }
4790
4791 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4792 CHECK(owner->result_ok);
4793         return ThirtyTwoBytes_clone(&*owner->contents.result);
4794 }
4795 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
4796         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4797         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4798         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4799         return ret_arr;
4800 }
4801
4802 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4803 CHECK(!owner->result_ok);
4804         return PaymentSendFailure_clone(&*owner->contents.err);
4805 }
4806 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
4807         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4808         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4809         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
4810         uint64_t ret_ref = tag_ptr(ret_copy, true);
4811         return ret_ref;
4812 }
4813
4814 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4815         return ThirtyTwoBytes_clone(&owner->a);
4816 }
4817 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4818         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4819         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4820         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4821         return ret_arr;
4822 }
4823
4824 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4825         return ThirtyTwoBytes_clone(&owner->b);
4826 }
4827 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4828         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4829         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4830         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4831         return ret_arr;
4832 }
4833
4834 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4835 CHECK(owner->result_ok);
4836         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4837 }
4838 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4839         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4840         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4841         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4842         return tag_ptr(ret_conv, true);
4843 }
4844
4845 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4846 CHECK(!owner->result_ok);
4847         return PaymentSendFailure_clone(&*owner->contents.err);
4848 }
4849 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4850         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4851         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4852         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4853         uint64_t ret_ref = tag_ptr(ret_copy, true);
4854         return ret_ref;
4855 }
4856
4857 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4858         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4859         for (size_t i = 0; i < ret.datalen; i++) {
4860                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4861         }
4862         return ret;
4863 }
4864 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4865         return ThirtyTwoBytes_clone(&owner->a);
4866 }
4867 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4868         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4869         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4870         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4871         return ret_arr;
4872 }
4873
4874 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4875         return ThirtyTwoBytes_clone(&owner->b);
4876 }
4877 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4878         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4880         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4881         return ret_arr;
4882 }
4883
4884 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4885 CHECK(owner->result_ok);
4886         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4887 }
4888 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4889         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4890         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4891         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4892         return tag_ptr(ret_conv, true);
4893 }
4894
4895 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4896 CHECK(!owner->result_ok);
4897         return *owner->contents.err;
4898 }
4899 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4900         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4901         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4902 }
4903
4904 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4905 CHECK(owner->result_ok);
4906         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4907 }
4908 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4909         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4910         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4911         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4912         return tag_ptr(ret_conv, true);
4913 }
4914
4915 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4916 CHECK(!owner->result_ok);
4917         return APIError_clone(&*owner->contents.err);
4918 }
4919 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4920         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4921         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4922         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4923         uint64_t ret_ref = tag_ptr(ret_copy, true);
4924         return ret_ref;
4925 }
4926
4927 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4928 CHECK(owner->result_ok);
4929         return ThirtyTwoBytes_clone(&*owner->contents.result);
4930 }
4931 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4932         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4933         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4934         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4935         return ret_arr;
4936 }
4937
4938 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4939 CHECK(!owner->result_ok);
4940         return *owner->contents.err;
4941 }
4942 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4943         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4944         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4945 }
4946
4947 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4948 CHECK(owner->result_ok);
4949         return ThirtyTwoBytes_clone(&*owner->contents.result);
4950 }
4951 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4952         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4953         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4954         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4955         return ret_arr;
4956 }
4957
4958 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4959 CHECK(!owner->result_ok);
4960         return APIError_clone(&*owner->contents.err);
4961 }
4962 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4963         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4964         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4965         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4966         uint64_t ret_ref = tag_ptr(ret_copy, true);
4967         return ret_ref;
4968 }
4969
4970 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4971 CHECK(owner->result_ok);
4972         return ThirtyTwoBytes_clone(&*owner->contents.result);
4973 }
4974 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4975         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4976         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4977         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4978         return ret_arr;
4979 }
4980
4981 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4982 CHECK(!owner->result_ok);
4983         return APIError_clone(&*owner->contents.err);
4984 }
4985 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4986         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4987         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4988         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4989         uint64_t ret_ref = tag_ptr(ret_copy, true);
4990         return ret_ref;
4991 }
4992
4993 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4994         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4995         ret.is_owned = false;
4996         return ret;
4997 }
4998 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4999         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5000         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5001         uint64_t ret_ref = 0;
5002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5004         return ret_ref;
5005 }
5006
5007 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5008 CHECK(!owner->result_ok);
5009         return DecodeError_clone(&*owner->contents.err);
5010 }
5011 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5012         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5013         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5014         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5015         uint64_t ret_ref = tag_ptr(ret_copy, true);
5016         return ret_ref;
5017 }
5018
5019 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5020         LDKChannelCounterparty ret = *owner->contents.result;
5021         ret.is_owned = false;
5022         return ret;
5023 }
5024 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5025         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5026         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5027         uint64_t ret_ref = 0;
5028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5030         return ret_ref;
5031 }
5032
5033 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5034 CHECK(!owner->result_ok);
5035         return DecodeError_clone(&*owner->contents.err);
5036 }
5037 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5038         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5040         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5041         uint64_t ret_ref = tag_ptr(ret_copy, true);
5042         return ret_ref;
5043 }
5044
5045 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5046         LDKChannelDetails ret = *owner->contents.result;
5047         ret.is_owned = false;
5048         return ret;
5049 }
5050 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5051         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5052         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5053         uint64_t ret_ref = 0;
5054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5056         return ret_ref;
5057 }
5058
5059 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5060 CHECK(!owner->result_ok);
5061         return DecodeError_clone(&*owner->contents.err);
5062 }
5063 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5064         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5066         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5067         uint64_t ret_ref = tag_ptr(ret_copy, true);
5068         return ret_ref;
5069 }
5070
5071 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5072         LDKPhantomRouteHints ret = *owner->contents.result;
5073         ret.is_owned = false;
5074         return ret;
5075 }
5076 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5077         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5078         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5079         uint64_t ret_ref = 0;
5080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5082         return ret_ref;
5083 }
5084
5085 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5086 CHECK(!owner->result_ok);
5087         return DecodeError_clone(&*owner->contents.err);
5088 }
5089 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5090         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5092         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5093         uint64_t ret_ref = tag_ptr(ret_copy, true);
5094         return ret_ref;
5095 }
5096
5097 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5098         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5099         for (size_t i = 0; i < ret.datalen; i++) {
5100                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5101         }
5102         return ret;
5103 }
5104 typedef struct LDKWatch_JCalls {
5105         atomic_size_t refcnt;
5106         uint32_t instance_ptr;
5107 } LDKWatch_JCalls;
5108 static void LDKWatch_JCalls_free(void* this_arg) {
5109         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5110         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5111                 FREE(j_calls);
5112         }
5113 }
5114 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5115         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5116         LDKOutPoint funding_txo_var = funding_txo;
5117         uint64_t funding_txo_ref = 0;
5118         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5119         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5120         LDKChannelMonitor monitor_var = monitor;
5121         uint64_t monitor_ref = 0;
5122         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5123         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5124         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5125         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5126         return ret_conv;
5127 }
5128 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5129         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5130         LDKOutPoint funding_txo_var = funding_txo;
5131         uint64_t funding_txo_ref = 0;
5132         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5133         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5134         LDKChannelMonitorUpdate update_var = update;
5135         uint64_t update_ref = 0;
5136         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5137         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5138         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5139         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5140         return ret_conv;
5141 }
5142 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5143         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5144         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5145         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5146         ret_constr.datalen = ret->arr_len;
5147         if (ret_constr.datalen > 0)
5148                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5149         else
5150                 ret_constr.data = NULL;
5151         uint64_t* ret_vals = ret->elems;
5152         for (size_t x = 0; x < ret_constr.datalen; x++) {
5153                 uint64_t ret_conv_49 = ret_vals[x];
5154                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5155                 CHECK_ACCESS(ret_conv_49_ptr);
5156                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5157                 FREE(untag_ptr(ret_conv_49));
5158                 ret_constr.data[x] = ret_conv_49_conv;
5159         }
5160         FREE(ret);
5161         return ret_constr;
5162 }
5163 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5164         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5165         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5166 }
5167 static inline LDKWatch LDKWatch_init (JSValue o) {
5168         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5169         atomic_init(&calls->refcnt, 1);
5170         calls->instance_ptr = o;
5171
5172         LDKWatch ret = {
5173                 .this_arg = (void*) calls,
5174                 .watch_channel = watch_channel_LDKWatch_jcall,
5175                 .update_channel = update_channel_LDKWatch_jcall,
5176                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5177                 .free = LDKWatch_JCalls_free,
5178         };
5179         return ret;
5180 }
5181 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5182         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5183         *res_ptr = LDKWatch_init(o);
5184         return tag_ptr(res_ptr, true);
5185 }
5186 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5187         void* this_arg_ptr = untag_ptr(this_arg);
5188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5189         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5190         LDKOutPoint funding_txo_conv;
5191         funding_txo_conv.inner = untag_ptr(funding_txo);
5192         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5193         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5194         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5195         LDKChannelMonitor monitor_conv;
5196         monitor_conv.inner = untag_ptr(monitor);
5197         monitor_conv.is_owned = ptr_is_owned(monitor);
5198         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5199         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5200         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5201         return ret_conv;
5202 }
5203
5204 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5205         void* this_arg_ptr = untag_ptr(this_arg);
5206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5207         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5208         LDKOutPoint funding_txo_conv;
5209         funding_txo_conv.inner = untag_ptr(funding_txo);
5210         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5211         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5212         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5213         LDKChannelMonitorUpdate update_conv;
5214         update_conv.inner = untag_ptr(update);
5215         update_conv.is_owned = ptr_is_owned(update);
5216         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5217         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5218         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv));
5219         return ret_conv;
5220 }
5221
5222 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5223         void* this_arg_ptr = untag_ptr(this_arg);
5224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5225         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5226         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5227         uint64_tArray ret_arr = NULL;
5228         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5229         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5230         for (size_t x = 0; x < ret_var.datalen; x++) {
5231                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5232                 *ret_conv_49_conv = ret_var.data[x];
5233                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5234         }
5235         
5236         FREE(ret_var.data);
5237         return ret_arr;
5238 }
5239
5240 typedef struct LDKBroadcasterInterface_JCalls {
5241         atomic_size_t refcnt;
5242         uint32_t instance_ptr;
5243 } LDKBroadcasterInterface_JCalls;
5244 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5245         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5246         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5247                 FREE(j_calls);
5248         }
5249 }
5250 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5251         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5252         LDKTransaction tx_var = tx;
5253         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5254         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5255         Transaction_free(tx_var);
5256         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5257 }
5258 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5259         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5260         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5261 }
5262 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5263         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5264         atomic_init(&calls->refcnt, 1);
5265         calls->instance_ptr = o;
5266
5267         LDKBroadcasterInterface ret = {
5268                 .this_arg = (void*) calls,
5269                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5270                 .free = LDKBroadcasterInterface_JCalls_free,
5271         };
5272         return ret;
5273 }
5274 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5275         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5276         *res_ptr = LDKBroadcasterInterface_init(o);
5277         return tag_ptr(res_ptr, true);
5278 }
5279 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5280         void* this_arg_ptr = untag_ptr(this_arg);
5281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5282         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5283         LDKTransaction tx_ref;
5284         tx_ref.datalen = tx->arr_len;
5285         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5286         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5287         tx_ref.data_is_owned = true;
5288         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5289 }
5290
5291 typedef struct LDKKeysInterface_JCalls {
5292         atomic_size_t refcnt;
5293         uint32_t instance_ptr;
5294 } LDKKeysInterface_JCalls;
5295 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5296         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5297         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5298                 FREE(j_calls);
5299         }
5300 }
5301 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5302         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5303         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5304         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, recipient_conv, 0, 0, 0, 0, 0);
5305         void* ret_ptr = untag_ptr(ret);
5306         CHECK_ACCESS(ret_ptr);
5307         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5308         FREE(untag_ptr(ret));
5309         return ret_conv;
5310 }
5311 LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5312         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5313         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5314         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, recipient_conv, 0, 0, 0, 0, 0);
5315         void* ret_ptr = untag_ptr(ret);
5316         CHECK_ACCESS(ret_ptr);
5317         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5318         FREE(untag_ptr(ret));
5319         return ret_conv;
5320 }
5321 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5322         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5323         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5324         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5325         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5326         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5327         *tweak_copy = tweak;
5328         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5329         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 23, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5330         void* ret_ptr = untag_ptr(ret);
5331         CHECK_ACCESS(ret_ptr);
5332         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5333         FREE(untag_ptr(ret));
5334         return ret_conv;
5335 }
5336 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5337         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5338         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
5339         LDKCVec_u8Z ret_ref;
5340         ret_ref.datalen = ret->arr_len;
5341         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5342         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5343         return ret_ref;
5344 }
5345 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5346         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5347         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5348         LDKShutdownScript ret_conv;
5349         ret_conv.inner = untag_ptr(ret);
5350         ret_conv.is_owned = ptr_is_owned(ret);
5351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5352         return ret_conv;
5353 }
5354 LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5355         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5356         jboolean inbound_conv = inbound;
5357         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5358         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5359         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5360         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 26, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
5361         LDKThirtyTwoBytes ret_ref;
5362         CHECK(ret->arr_len == 32);
5363         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5364         return ret_ref;
5365 }
5366 LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5367         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5368         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5369         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5370         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5371         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
5372         void* ret_ptr = untag_ptr(ret);
5373         CHECK_ACCESS(ret_ptr);
5374         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5375         FREE(untag_ptr(ret));
5376         return ret_conv;
5377 }
5378 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5379         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5380         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, 0, 0, 0, 0, 0, 0);
5381         LDKThirtyTwoBytes ret_ref;
5382         CHECK(ret->arr_len == 32);
5383         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5384         return ret_ref;
5385 }
5386 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5387         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5388         LDKu8slice reader_var = reader;
5389         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5390         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5391         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5392         void* ret_ptr = untag_ptr(ret);
5393         CHECK_ACCESS(ret_ptr);
5394         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5395         FREE(untag_ptr(ret));
5396         return ret_conv;
5397 }
5398 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient receipient) {
5399         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5400         LDKu8slice hrp_bytes_var = hrp_bytes;
5401         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5402         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5403         LDKCVec_U5Z invoice_data_var = invoice_data;
5404         ptrArray invoice_data_arr = NULL;
5405         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5406         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5407         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5408                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5409                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5410         }
5411         
5412         FREE(invoice_data_var.data);
5413         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5414         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0);
5415         void* ret_ptr = untag_ptr(ret);
5416         CHECK_ACCESS(ret_ptr);
5417         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5418         FREE(untag_ptr(ret));
5419         return ret_conv;
5420 }
5421 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5422         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5423         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5424         LDKThirtyTwoBytes ret_ref;
5425         CHECK(ret->arr_len == 32);
5426         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5427         return ret_ref;
5428 }
5429 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5430         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5431         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5432 }
5433 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5434         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5435         atomic_init(&calls->refcnt, 1);
5436         calls->instance_ptr = o;
5437
5438         LDKKeysInterface ret = {
5439                 .this_arg = (void*) calls,
5440                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5441                 .get_node_id = get_node_id_LDKKeysInterface_jcall,
5442                 .ecdh = ecdh_LDKKeysInterface_jcall,
5443                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5444                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5445                 .generate_channel_keys_id = generate_channel_keys_id_LDKKeysInterface_jcall,
5446                 .derive_channel_signer = derive_channel_signer_LDKKeysInterface_jcall,
5447                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5448                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5449                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5450                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5451                 .free = LDKKeysInterface_JCalls_free,
5452         };
5453         return ret;
5454 }
5455 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5456         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5457         *res_ptr = LDKKeysInterface_init(o);
5458         return tag_ptr(res_ptr, true);
5459 }
5460 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5461         void* this_arg_ptr = untag_ptr(this_arg);
5462         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5463         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5464         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5465         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5466         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5467         return tag_ptr(ret_conv, true);
5468 }
5469
5470 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_id"))) TS_KeysInterface_get_node_id(uint64_t this_arg, uint32_t recipient) {
5471         void* this_arg_ptr = untag_ptr(this_arg);
5472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5473         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5474         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5475         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5476         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5477         return tag_ptr(ret_conv, true);
5478 }
5479
5480 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) {
5481         void* this_arg_ptr = untag_ptr(this_arg);
5482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5483         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5484         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5485         LDKPublicKey other_key_ref;
5486         CHECK(other_key->arr_len == 33);
5487         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5488         void* tweak_ptr = untag_ptr(tweak);
5489         CHECK_ACCESS(tweak_ptr);
5490         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5491         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5492         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5493         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5494         return tag_ptr(ret_conv, true);
5495 }
5496
5497 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5498         void* this_arg_ptr = untag_ptr(this_arg);
5499         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5500         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5501         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5502         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5503         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5504         CVec_u8Z_free(ret_var);
5505         return ret_arr;
5506 }
5507
5508 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5509         void* this_arg_ptr = untag_ptr(this_arg);
5510         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5511         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5512         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5513         uint64_t ret_ref = 0;
5514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5516         return ret_ref;
5517 }
5518
5519 int8_tArray  __attribute__((export_name("TS_KeysInterface_generate_channel_keys_id"))) TS_KeysInterface_generate_channel_keys_id(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
5520         void* this_arg_ptr = untag_ptr(this_arg);
5521         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5522         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5523         LDKU128 user_channel_id_ref;
5524         CHECK(user_channel_id->arr_len == 16);
5525         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5526         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5527         memcpy(ret_arr->elems, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data, 32);
5528         return ret_arr;
5529 }
5530
5531 uint64_t  __attribute__((export_name("TS_KeysInterface_derive_channel_signer"))) TS_KeysInterface_derive_channel_signer(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
5532         void* this_arg_ptr = untag_ptr(this_arg);
5533         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5534         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5535         LDKThirtyTwoBytes channel_keys_id_ref;
5536         CHECK(channel_keys_id->arr_len == 32);
5537         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5538         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5539         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5540         return tag_ptr(ret_ret, true);
5541 }
5542
5543 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5544         void* this_arg_ptr = untag_ptr(this_arg);
5545         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5546         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5547         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5548         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5549         return ret_arr;
5550 }
5551
5552 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5553         void* this_arg_ptr = untag_ptr(this_arg);
5554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5555         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5556         LDKu8slice reader_ref;
5557         reader_ref.datalen = reader->arr_len;
5558         reader_ref.data = reader->elems;
5559         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5560         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5561         FREE(reader);
5562         return tag_ptr(ret_conv, true);
5563 }
5564
5565 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) {
5566         void* this_arg_ptr = untag_ptr(this_arg);
5567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5568         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5569         LDKu8slice hrp_bytes_ref;
5570         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5571         hrp_bytes_ref.data = hrp_bytes->elems;
5572         LDKCVec_U5Z invoice_data_constr;
5573         invoice_data_constr.datalen = invoice_data->arr_len;
5574         if (invoice_data_constr.datalen > 0)
5575                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5576         else
5577                 invoice_data_constr.data = NULL;
5578         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5579         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5580                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5581                 
5582                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5583         }
5584         FREE(invoice_data);
5585         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5586         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5587         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5588         FREE(hrp_bytes);
5589         return tag_ptr(ret_conv, true);
5590 }
5591
5592 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5593         void* this_arg_ptr = untag_ptr(this_arg);
5594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5595         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5596         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5597         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5598         return ret_arr;
5599 }
5600
5601 typedef struct LDKFeeEstimator_JCalls {
5602         atomic_size_t refcnt;
5603         uint32_t instance_ptr;
5604 } LDKFeeEstimator_JCalls;
5605 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5606         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5607         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5608                 FREE(j_calls);
5609         }
5610 }
5611 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5612         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5613         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5614         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
5615 }
5616 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5617         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5618         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5619 }
5620 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5621         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5622         atomic_init(&calls->refcnt, 1);
5623         calls->instance_ptr = o;
5624
5625         LDKFeeEstimator ret = {
5626                 .this_arg = (void*) calls,
5627                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5628                 .free = LDKFeeEstimator_JCalls_free,
5629         };
5630         return ret;
5631 }
5632 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5633         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5634         *res_ptr = LDKFeeEstimator_init(o);
5635         return tag_ptr(res_ptr, true);
5636 }
5637 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) {
5638         void* this_arg_ptr = untag_ptr(this_arg);
5639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5640         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5641         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5642         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5643         return ret_conv;
5644 }
5645
5646 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5647         return ThirtyTwoBytes_clone(&owner->a);
5648 }
5649 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5650         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5651         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5652         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5653         return ret_arr;
5654 }
5655
5656 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5657         LDKChannelManager ret = owner->b;
5658         ret.is_owned = false;
5659         return ret;
5660 }
5661 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5662         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5663         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5664         uint64_t ret_ref = 0;
5665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5667         return ret_ref;
5668 }
5669
5670 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5671 CHECK(owner->result_ok);
5672         return &*owner->contents.result;
5673 }
5674 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5675         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5676         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5677         return ret_ret;
5678 }
5679
5680 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5681 CHECK(!owner->result_ok);
5682         return DecodeError_clone(&*owner->contents.err);
5683 }
5684 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5685         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5686         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5687         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5688         uint64_t ret_ref = tag_ptr(ret_copy, true);
5689         return ret_ref;
5690 }
5691
5692 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5693         LDKChannelConfig ret = *owner->contents.result;
5694         ret.is_owned = false;
5695         return ret;
5696 }
5697 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5698         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5699         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5700         uint64_t ret_ref = 0;
5701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5703         return ret_ref;
5704 }
5705
5706 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5707 CHECK(!owner->result_ok);
5708         return DecodeError_clone(&*owner->contents.err);
5709 }
5710 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5711         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5712         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5713         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5714         uint64_t ret_ref = tag_ptr(ret_copy, true);
5715         return ret_ref;
5716 }
5717
5718 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5719         LDKOutPoint ret = *owner->contents.result;
5720         ret.is_owned = false;
5721         return ret;
5722 }
5723 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5724         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5725         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5726         uint64_t ret_ref = 0;
5727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5729         return ret_ref;
5730 }
5731
5732 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5733 CHECK(!owner->result_ok);
5734         return DecodeError_clone(&*owner->contents.err);
5735 }
5736 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5737         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5739         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5740         uint64_t ret_ref = tag_ptr(ret_copy, true);
5741         return ret_ref;
5742 }
5743
5744 typedef struct LDKType_JCalls {
5745         atomic_size_t refcnt;
5746         uint32_t instance_ptr;
5747 } LDKType_JCalls;
5748 static void LDKType_JCalls_free(void* this_arg) {
5749         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5750         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5751                 FREE(j_calls);
5752         }
5753 }
5754 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5755         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5756         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5757 }
5758 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5759         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5760         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5761         LDKStr ret_conv = str_ref_to_owned_c(ret);
5762         return ret_conv;
5763 }
5764 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5765         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5766         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
5767         LDKCVec_u8Z ret_ref;
5768         ret_ref.datalen = ret->arr_len;
5769         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5770         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5771         return ret_ref;
5772 }
5773 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5774         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5775         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5776 }
5777 static inline LDKType LDKType_init (JSValue o) {
5778         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5779         atomic_init(&calls->refcnt, 1);
5780         calls->instance_ptr = o;
5781
5782         LDKType ret = {
5783                 .this_arg = (void*) calls,
5784                 .type_id = type_id_LDKType_jcall,
5785                 .debug_str = debug_str_LDKType_jcall,
5786                 .write = write_LDKType_jcall,
5787                 .cloned = LDKType_JCalls_cloned,
5788                 .free = LDKType_JCalls_free,
5789         };
5790         return ret;
5791 }
5792 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5793         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5794         *res_ptr = LDKType_init(o);
5795         return tag_ptr(res_ptr, true);
5796 }
5797 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5798         void* this_arg_ptr = untag_ptr(this_arg);
5799         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5800         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5801         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5802         return ret_conv;
5803 }
5804
5805 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5806         void* this_arg_ptr = untag_ptr(this_arg);
5807         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5808         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5809         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5810         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5811         Str_free(ret_str);
5812         return ret_conv;
5813 }
5814
5815 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5816         void* this_arg_ptr = untag_ptr(this_arg);
5817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5818         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5819         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5820         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5821         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5822         CVec_u8Z_free(ret_var);
5823         return ret_arr;
5824 }
5825
5826 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5827         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5828         switch(obj->tag) {
5829                 case LDKCOption_TypeZ_Some: return 0;
5830                 case LDKCOption_TypeZ_None: return 1;
5831                 default: abort();
5832         }
5833 }
5834 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5835         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5836         assert(obj->tag == LDKCOption_TypeZ_Some);
5837                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5838                         *some_ret = Type_clone(&obj->some);
5839         return tag_ptr(some_ret, true);
5840 }
5841 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5842 CHECK(owner->result_ok);
5843         return COption_TypeZ_clone(&*owner->contents.result);
5844 }
5845 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5846         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5847         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5848         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5849         uint64_t ret_ref = tag_ptr(ret_copy, true);
5850         return ret_ref;
5851 }
5852
5853 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5854 CHECK(!owner->result_ok);
5855         return DecodeError_clone(&*owner->contents.err);
5856 }
5857 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5858         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5860         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5861         uint64_t ret_ref = tag_ptr(ret_copy, true);
5862         return ret_ref;
5863 }
5864
5865 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5866         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5867         switch(obj->tag) {
5868                 case LDKPaymentError_Invoice: return 0;
5869                 case LDKPaymentError_Routing: return 1;
5870                 case LDKPaymentError_Sending: return 2;
5871                 default: abort();
5872         }
5873 }
5874 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5875         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5876         assert(obj->tag == LDKPaymentError_Invoice);
5877                         LDKStr invoice_str = obj->invoice;
5878                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5879         return invoice_conv;
5880 }
5881 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5882         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5883         assert(obj->tag == LDKPaymentError_Routing);
5884                         LDKLightningError routing_var = obj->routing;
5885                         uint64_t routing_ref = 0;
5886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5887                         routing_ref = tag_ptr(routing_var.inner, false);
5888         return routing_ref;
5889 }
5890 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5891         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5892         assert(obj->tag == LDKPaymentError_Sending);
5893                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5894         return sending_ref;
5895 }
5896 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5897 CHECK(owner->result_ok);
5898         return ThirtyTwoBytes_clone(&*owner->contents.result);
5899 }
5900 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5901         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5902         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5903         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5904         return ret_arr;
5905 }
5906
5907 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5908 CHECK(!owner->result_ok);
5909         return PaymentError_clone(&*owner->contents.err);
5910 }
5911 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5912         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5913         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5914         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5915         uint64_t ret_ref = tag_ptr(ret_copy, true);
5916         return ret_ref;
5917 }
5918
5919 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
5920 CHECK(owner->result_ok);
5921         return *owner->contents.result;
5922 }
5923 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
5924         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
5925         CResult_NonePaymentErrorZ_get_ok(owner_conv);
5926 }
5927
5928 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
5929 CHECK(!owner->result_ok);
5930         return PaymentError_clone(&*owner->contents.err);
5931 }
5932 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
5933         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
5934         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5935         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
5936         uint64_t ret_ref = tag_ptr(ret_copy, true);
5937         return ret_ref;
5938 }
5939
5940 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5941 CHECK(owner->result_ok);
5942         return *owner->contents.result;
5943 }
5944 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
5945         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5946         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5947         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5948         return ret_conv;
5949 }
5950
5951 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5952 CHECK(!owner->result_ok);
5953         return *owner->contents.err;
5954 }
5955 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
5956         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5957         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5958         return ret_conv;
5959 }
5960
5961 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5962 CHECK(owner->result_ok);
5963         return *owner->contents.result;
5964 }
5965 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
5966         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5967         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5968         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
5969         return ret_arr;
5970 }
5971
5972 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5973 CHECK(!owner->result_ok);
5974         return *owner->contents.err;
5975 }
5976 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
5977         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5978         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
5979         return ret_conv;
5980 }
5981
5982 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5983         LDKChannelMonitorUpdate ret = *owner->contents.result;
5984         ret.is_owned = false;
5985         return ret;
5986 }
5987 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
5988         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5989         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5990         uint64_t ret_ref = 0;
5991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5993         return ret_ref;
5994 }
5995
5996 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5997 CHECK(!owner->result_ok);
5998         return DecodeError_clone(&*owner->contents.err);
5999 }
6000 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6001         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6002         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6003         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6004         uint64_t ret_ref = tag_ptr(ret_copy, true);
6005         return ret_ref;
6006 }
6007
6008 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6009         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6010         switch(obj->tag) {
6011                 case LDKCOption_MonitorEventZ_Some: return 0;
6012                 case LDKCOption_MonitorEventZ_None: return 1;
6013                 default: abort();
6014         }
6015 }
6016 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6017         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6018         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6019                         uint64_t some_ref = tag_ptr(&obj->some, false);
6020         return some_ref;
6021 }
6022 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6023 CHECK(owner->result_ok);
6024         return COption_MonitorEventZ_clone(&*owner->contents.result);
6025 }
6026 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6027         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6028         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6029         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6030         uint64_t ret_ref = tag_ptr(ret_copy, true);
6031         return ret_ref;
6032 }
6033
6034 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6035 CHECK(!owner->result_ok);
6036         return DecodeError_clone(&*owner->contents.err);
6037 }
6038 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6039         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6041         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6042         uint64_t ret_ref = tag_ptr(ret_copy, true);
6043         return ret_ref;
6044 }
6045
6046 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6047         LDKHTLCUpdate ret = *owner->contents.result;
6048         ret.is_owned = false;
6049         return ret;
6050 }
6051 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6052         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6053         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6054         uint64_t ret_ref = 0;
6055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6057         return ret_ref;
6058 }
6059
6060 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6061 CHECK(!owner->result_ok);
6062         return DecodeError_clone(&*owner->contents.err);
6063 }
6064 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6065         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6067         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6068         uint64_t ret_ref = tag_ptr(ret_copy, true);
6069         return ret_ref;
6070 }
6071
6072 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6073         LDKOutPoint ret = owner->a;
6074         ret.is_owned = false;
6075         return ret;
6076 }
6077 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6078         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6079         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6080         uint64_t ret_ref = 0;
6081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6083         return ret_ref;
6084 }
6085
6086 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6087         return CVec_u8Z_clone(&owner->b);
6088 }
6089 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6090         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6091         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6092         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6093         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6094         CVec_u8Z_free(ret_var);
6095         return ret_arr;
6096 }
6097
6098 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6099         return owner->a;
6100 }
6101 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6102         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6103         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6104         return ret_conv;
6105 }
6106
6107 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6108         return CVec_u8Z_clone(&owner->b);
6109 }
6110 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6111         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6112         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6113         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6114         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6115         CVec_u8Z_free(ret_var);
6116         return ret_arr;
6117 }
6118
6119 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6120         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6121         for (size_t i = 0; i < ret.datalen; i++) {
6122                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6123         }
6124         return ret;
6125 }
6126 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6127         return ThirtyTwoBytes_clone(&owner->a);
6128 }
6129 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6130         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6131         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6132         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6133         return ret_arr;
6134 }
6135
6136 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6137         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6138 }
6139 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6140         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6141         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6142         uint64_tArray ret_arr = NULL;
6143         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6144         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6145         for (size_t v = 0; v < ret_var.datalen; v++) {
6146                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6147                 *ret_conv_21_conv = ret_var.data[v];
6148                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6149         }
6150         
6151         FREE(ret_var.data);
6152         return ret_arr;
6153 }
6154
6155 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6156         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 };
6157         for (size_t i = 0; i < ret.datalen; i++) {
6158                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6159         }
6160         return ret;
6161 }
6162 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6163         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6164         for (size_t i = 0; i < ret.datalen; i++) {
6165                 ret.data[i] = Event_clone(&orig->data[i]);
6166         }
6167         return ret;
6168 }
6169 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6170         return owner->a;
6171 }
6172 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6173         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6174         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6175         return ret_conv;
6176 }
6177
6178 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6179         return TxOut_clone(&owner->b);
6180 }
6181 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6182         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6183         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6184         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6185         return tag_ptr(ret_ref, true);
6186 }
6187
6188 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6189         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6190         for (size_t i = 0; i < ret.datalen; i++) {
6191                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6192         }
6193         return ret;
6194 }
6195 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6196         return ThirtyTwoBytes_clone(&owner->a);
6197 }
6198 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6199         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6200         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6201         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6202         return ret_arr;
6203 }
6204
6205 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6206         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6207 }
6208 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6209         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6210         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6211         uint64_tArray ret_arr = NULL;
6212         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6213         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6214         for (size_t u = 0; u < ret_var.datalen; u++) {
6215                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6216                 *ret_conv_20_conv = ret_var.data[u];
6217                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6218         }
6219         
6220         FREE(ret_var.data);
6221         return ret_arr;
6222 }
6223
6224 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6225         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 };
6226         for (size_t i = 0; i < ret.datalen; i++) {
6227                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6228         }
6229         return ret;
6230 }
6231 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6232         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6233         switch(obj->tag) {
6234                 case LDKBalance_ClaimableOnChannelClose: return 0;
6235                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6236                 case LDKBalance_ContentiousClaimable: return 2;
6237                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6238                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6239                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6240                 default: abort();
6241         }
6242 }
6243 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6244         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6245         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6246                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6247         return claimable_amount_satoshis_conv;
6248 }
6249 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6250         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6251         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6252                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6253         return claimable_amount_satoshis_conv;
6254 }
6255 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6256         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6257         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6258                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6259         return confirmation_height_conv;
6260 }
6261 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6262         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6263         assert(obj->tag == LDKBalance_ContentiousClaimable);
6264                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6265         return claimable_amount_satoshis_conv;
6266 }
6267 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6268         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6269         assert(obj->tag == LDKBalance_ContentiousClaimable);
6270                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6271         return timeout_height_conv;
6272 }
6273 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6274         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6275         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6276                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6277         return claimable_amount_satoshis_conv;
6278 }
6279 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6280         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6281         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6282                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6283         return claimable_height_conv;
6284 }
6285 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6286         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6287         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6288                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6289         return claimable_amount_satoshis_conv;
6290 }
6291 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6292         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6293         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6294                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6295         return expiry_height_conv;
6296 }
6297 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6298         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6299         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6300                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6301         return claimable_amount_satoshis_conv;
6302 }
6303 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6304         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6305         for (size_t i = 0; i < ret.datalen; i++) {
6306                 ret.data[i] = Balance_clone(&orig->data[i]);
6307         }
6308         return ret;
6309 }
6310 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6311         return ThirtyTwoBytes_clone(&owner->a);
6312 }
6313 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6314         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6315         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6316         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6317         return ret_arr;
6318 }
6319
6320 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6321         LDKChannelMonitor ret = owner->b;
6322         ret.is_owned = false;
6323         return ret;
6324 }
6325 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6326         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6327         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6328         uint64_t ret_ref = 0;
6329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6331         return ret_ref;
6332 }
6333
6334 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6335 CHECK(owner->result_ok);
6336         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6337 }
6338 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6339         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6340         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6341         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6342         return tag_ptr(ret_conv, true);
6343 }
6344
6345 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6346 CHECK(!owner->result_ok);
6347         return DecodeError_clone(&*owner->contents.err);
6348 }
6349 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6350         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6352         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6353         uint64_t ret_ref = tag_ptr(ret_copy, true);
6354         return ret_ref;
6355 }
6356
6357 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6358         return owner->a;
6359 }
6360 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6361         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6362         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6363         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6364         return ret_arr;
6365 }
6366
6367 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6368         return Type_clone(&owner->b);
6369 }
6370 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6371         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6372         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6373         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6374         return tag_ptr(ret_ret, true);
6375 }
6376
6377 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6378         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6379         for (size_t i = 0; i < ret.datalen; i++) {
6380                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6381         }
6382         return ret;
6383 }
6384 typedef struct LDKCustomOnionMessageContents_JCalls {
6385         atomic_size_t refcnt;
6386         uint32_t instance_ptr;
6387 } LDKCustomOnionMessageContents_JCalls;
6388 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6389         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6390         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6391                 FREE(j_calls);
6392         }
6393 }
6394 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6395         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6396         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6397 }
6398 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6399         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6400         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6401         LDKCVec_u8Z ret_ref;
6402         ret_ref.datalen = ret->arr_len;
6403         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6404         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6405         return ret_ref;
6406 }
6407 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6408         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6410 }
6411 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6412         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6413         atomic_init(&calls->refcnt, 1);
6414         calls->instance_ptr = o;
6415
6416         LDKCustomOnionMessageContents ret = {
6417                 .this_arg = (void*) calls,
6418                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6419                 .write = write_LDKCustomOnionMessageContents_jcall,
6420                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6421                 .free = LDKCustomOnionMessageContents_JCalls_free,
6422         };
6423         return ret;
6424 }
6425 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6426         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6427         *res_ptr = LDKCustomOnionMessageContents_init(o);
6428         return tag_ptr(res_ptr, true);
6429 }
6430 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6431         void* this_arg_ptr = untag_ptr(this_arg);
6432         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6433         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6434         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6435         return ret_conv;
6436 }
6437
6438 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6439         void* this_arg_ptr = untag_ptr(this_arg);
6440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6441         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6442         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6443         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6444         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6445         CVec_u8Z_free(ret_var);
6446         return ret_arr;
6447 }
6448
6449 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6450         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6451         switch(obj->tag) {
6452                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6453                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6454                 default: abort();
6455         }
6456 }
6457 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6458         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6459         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6460                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6461                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6462         return tag_ptr(some_ret, true);
6463 }
6464 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6465 CHECK(owner->result_ok);
6466         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6467 }
6468 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6469         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6470         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6471         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6472         uint64_t ret_ref = tag_ptr(ret_copy, true);
6473         return ret_ref;
6474 }
6475
6476 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6477 CHECK(!owner->result_ok);
6478         return DecodeError_clone(&*owner->contents.err);
6479 }
6480 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6481         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6483         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6484         uint64_t ret_ref = tag_ptr(ret_copy, true);
6485         return ret_ref;
6486 }
6487
6488 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6489         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6490         switch(obj->tag) {
6491                 case LDKCOption_NetAddressZ_Some: return 0;
6492                 case LDKCOption_NetAddressZ_None: return 1;
6493                 default: abort();
6494         }
6495 }
6496 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6497         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6498         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6499                         uint64_t some_ref = tag_ptr(&obj->some, false);
6500         return some_ref;
6501 }
6502 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6503 CHECK(owner->result_ok);
6504         return CVec_u8Z_clone(&*owner->contents.result);
6505 }
6506 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6507         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6508         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6509         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6510         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6511         CVec_u8Z_free(ret_var);
6512         return ret_arr;
6513 }
6514
6515 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6516         LDKPeerHandleError ret = *owner->contents.err;
6517         ret.is_owned = false;
6518         return ret;
6519 }
6520 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6521         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6522         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6523         uint64_t ret_ref = 0;
6524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6526         return ret_ref;
6527 }
6528
6529 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6530 CHECK(owner->result_ok);
6531         return *owner->contents.result;
6532 }
6533 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6534         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6535         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6536 }
6537
6538 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6539         LDKPeerHandleError ret = *owner->contents.err;
6540         ret.is_owned = false;
6541         return ret;
6542 }
6543 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6544         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6545         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6546         uint64_t ret_ref = 0;
6547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6549         return ret_ref;
6550 }
6551
6552 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6553 CHECK(owner->result_ok);
6554         return *owner->contents.result;
6555 }
6556 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6557         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6558         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6559         return ret_conv;
6560 }
6561
6562 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6563         LDKPeerHandleError ret = *owner->contents.err;
6564         ret.is_owned = false;
6565         return ret;
6566 }
6567 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6568         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6569         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6570         uint64_t ret_ref = 0;
6571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6573         return ret_ref;
6574 }
6575
6576 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6577         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6578         switch(obj->tag) {
6579                 case LDKSendError_Secp256k1: return 0;
6580                 case LDKSendError_TooBigPacket: return 1;
6581                 case LDKSendError_TooFewBlindedHops: return 2;
6582                 case LDKSendError_InvalidFirstHop: return 3;
6583                 case LDKSendError_InvalidMessage: return 4;
6584                 case LDKSendError_BufferFull: return 5;
6585                 case LDKSendError_GetNodeIdFailed: return 6;
6586                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
6587                 default: abort();
6588         }
6589 }
6590 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6591         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6592         assert(obj->tag == LDKSendError_Secp256k1);
6593                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6594         return secp256k1_conv;
6595 }
6596 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6597 CHECK(owner->result_ok);
6598         return *owner->contents.result;
6599 }
6600 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6601         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6602         CResult_NoneSendErrorZ_get_ok(owner_conv);
6603 }
6604
6605 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6606 CHECK(!owner->result_ok);
6607         return SendError_clone(&*owner->contents.err);
6608 }
6609 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6610         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6611         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6612         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6613         uint64_t ret_ref = tag_ptr(ret_copy, true);
6614         return ret_ref;
6615 }
6616
6617 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6618         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6619         switch(obj->tag) {
6620                 case LDKGraphSyncError_DecodeError: return 0;
6621                 case LDKGraphSyncError_LightningError: return 1;
6622                 default: abort();
6623         }
6624 }
6625 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6626         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6627         assert(obj->tag == LDKGraphSyncError_DecodeError);
6628                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
6629         return decode_error_ref;
6630 }
6631 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6632         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6633         assert(obj->tag == LDKGraphSyncError_LightningError);
6634                         LDKLightningError lightning_error_var = obj->lightning_error;
6635                         uint64_t lightning_error_ref = 0;
6636                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6637                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6638         return lightning_error_ref;
6639 }
6640 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6641 CHECK(owner->result_ok);
6642         return *owner->contents.result;
6643 }
6644 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6645         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6646         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6647         return ret_conv;
6648 }
6649
6650 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6651 CHECK(!owner->result_ok);
6652         return GraphSyncError_clone(&*owner->contents.err);
6653 }
6654 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6655         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6656         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6657         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6658         uint64_t ret_ref = tag_ptr(ret_copy, true);
6659         return ret_ref;
6660 }
6661
6662 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
6663         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6664         switch(obj->tag) {
6665                 case LDKParseError_Bech32Error: return 0;
6666                 case LDKParseError_ParseAmountError: return 1;
6667                 case LDKParseError_MalformedSignature: return 2;
6668                 case LDKParseError_BadPrefix: return 3;
6669                 case LDKParseError_UnknownCurrency: return 4;
6670                 case LDKParseError_UnknownSiPrefix: return 5;
6671                 case LDKParseError_MalformedHRP: return 6;
6672                 case LDKParseError_TooShortDataPart: return 7;
6673                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
6674                 case LDKParseError_DescriptionDecodeError: return 9;
6675                 case LDKParseError_PaddingError: return 10;
6676                 case LDKParseError_IntegerOverflowError: return 11;
6677                 case LDKParseError_InvalidSegWitProgramLength: return 12;
6678                 case LDKParseError_InvalidPubKeyHashLength: return 13;
6679                 case LDKParseError_InvalidScriptHashLength: return 14;
6680                 case LDKParseError_InvalidRecoveryId: return 15;
6681                 case LDKParseError_InvalidSliceLength: return 16;
6682                 case LDKParseError_Skip: return 17;
6683                 default: abort();
6684         }
6685 }
6686 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
6687         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6688         assert(obj->tag == LDKParseError_Bech32Error);
6689                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
6690         return bech32_error_ref;
6691 }
6692 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
6693         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6694         assert(obj->tag == LDKParseError_ParseAmountError);
6695                         /*obj->parse_amount_error*/
6696         return 0;
6697 }
6698 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
6699         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6700         assert(obj->tag == LDKParseError_MalformedSignature);
6701                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
6702         return malformed_signature_conv;
6703 }
6704 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
6705         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6706         assert(obj->tag == LDKParseError_DescriptionDecodeError);
6707                         /*obj->description_decode_error*/
6708         return 0;
6709 }
6710 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
6711         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6712         assert(obj->tag == LDKParseError_InvalidSliceLength);
6713                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
6714                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
6715         return invalid_slice_length_conv;
6716 }
6717 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6718 CHECK(owner->result_ok);
6719         return SiPrefix_clone(&*owner->contents.result);
6720 }
6721 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
6722         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
6723         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
6724         return ret_conv;
6725 }
6726
6727 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6728 CHECK(!owner->result_ok);
6729         return ParseError_clone(&*owner->contents.err);
6730 }
6731 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
6732         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
6733         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6734         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
6735         uint64_t ret_ref = tag_ptr(ret_copy, true);
6736         return ret_ref;
6737 }
6738
6739 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
6740         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6741         switch(obj->tag) {
6742                 case LDKParseOrSemanticError_ParseError: return 0;
6743                 case LDKParseOrSemanticError_SemanticError: return 1;
6744                 default: abort();
6745         }
6746 }
6747 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
6748         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6749         assert(obj->tag == LDKParseOrSemanticError_ParseError);
6750                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
6751         return parse_error_ref;
6752 }
6753 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
6754         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6755         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
6756                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
6757         return semantic_error_conv;
6758 }
6759 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6760         LDKInvoice ret = *owner->contents.result;
6761         ret.is_owned = false;
6762         return ret;
6763 }
6764 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
6765         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
6766         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
6767         uint64_t ret_ref = 0;
6768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6770         return ret_ref;
6771 }
6772
6773 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6774 CHECK(!owner->result_ok);
6775         return ParseOrSemanticError_clone(&*owner->contents.err);
6776 }
6777 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
6778         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
6779         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
6780         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
6781         uint64_t ret_ref = tag_ptr(ret_copy, true);
6782         return ret_ref;
6783 }
6784
6785 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6786         LDKSignedRawInvoice ret = *owner->contents.result;
6787         ret.is_owned = false;
6788         return ret;
6789 }
6790 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
6791         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
6792         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
6793         uint64_t ret_ref = 0;
6794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6796         return ret_ref;
6797 }
6798
6799 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6800 CHECK(!owner->result_ok);
6801         return ParseError_clone(&*owner->contents.err);
6802 }
6803 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
6804         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
6805         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6806         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
6807         uint64_t ret_ref = tag_ptr(ret_copy, true);
6808         return ret_ref;
6809 }
6810
6811 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6812         LDKRawInvoice ret = owner->a;
6813         ret.is_owned = false;
6814         return ret;
6815 }
6816 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
6817         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6818         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6819         uint64_t ret_ref = 0;
6820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6822         return ret_ref;
6823 }
6824
6825 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6826         return ThirtyTwoBytes_clone(&owner->b);
6827 }
6828 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
6829         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6830         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6831         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
6832         return ret_arr;
6833 }
6834
6835 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6836         LDKInvoiceSignature ret = owner->c;
6837         ret.is_owned = false;
6838         return ret;
6839 }
6840 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
6841         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6842         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6843         uint64_t ret_ref = 0;
6844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6846         return ret_ref;
6847 }
6848
6849 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6850         LDKPayeePubKey ret = *owner->contents.result;
6851         ret.is_owned = false;
6852         return ret;
6853 }
6854 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
6855         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
6856         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6857         uint64_t ret_ref = 0;
6858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6860         return ret_ref;
6861 }
6862
6863 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6864 CHECK(!owner->result_ok);
6865         return *owner->contents.err;
6866 }
6867 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
6868         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
6869         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6870         return ret_conv;
6871 }
6872
6873 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6874         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6875         for (size_t i = 0; i < ret.datalen; i++) {
6876                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6877         }
6878         return ret;
6879 }
6880 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6881         LDKPositiveTimestamp ret = *owner->contents.result;
6882         ret.is_owned = false;
6883         return ret;
6884 }
6885 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
6886         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6887         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6888         uint64_t ret_ref = 0;
6889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6891         return ret_ref;
6892 }
6893
6894 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6895 CHECK(!owner->result_ok);
6896         return CreationError_clone(&*owner->contents.err);
6897 }
6898 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
6899         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6900         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6901         return ret_conv;
6902 }
6903
6904 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6905 CHECK(owner->result_ok);
6906         return *owner->contents.result;
6907 }
6908 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
6909         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6910         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6911 }
6912
6913 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6914 CHECK(!owner->result_ok);
6915         return SemanticError_clone(&*owner->contents.err);
6916 }
6917 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
6918         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6919         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6920         return ret_conv;
6921 }
6922
6923 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6924         LDKInvoice ret = *owner->contents.result;
6925         ret.is_owned = false;
6926         return ret;
6927 }
6928 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6929         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6930         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6931         uint64_t ret_ref = 0;
6932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6934         return ret_ref;
6935 }
6936
6937 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6938 CHECK(!owner->result_ok);
6939         return SemanticError_clone(&*owner->contents.err);
6940 }
6941 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6942         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6943         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6944         return ret_conv;
6945 }
6946
6947 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6948         LDKDescription ret = *owner->contents.result;
6949         ret.is_owned = false;
6950         return ret;
6951 }
6952 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6953         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6954         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6955         uint64_t ret_ref = 0;
6956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6958         return ret_ref;
6959 }
6960
6961 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6962 CHECK(!owner->result_ok);
6963         return CreationError_clone(&*owner->contents.err);
6964 }
6965 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6966         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6967         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6968         return ret_conv;
6969 }
6970
6971 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6972         LDKPrivateRoute ret = *owner->contents.result;
6973         ret.is_owned = false;
6974         return ret;
6975 }
6976 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6977         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6978         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6979         uint64_t ret_ref = 0;
6980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6982         return ret_ref;
6983 }
6984
6985 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6986 CHECK(!owner->result_ok);
6987         return CreationError_clone(&*owner->contents.err);
6988 }
6989 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6990         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6991         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6992         return ret_conv;
6993 }
6994
6995 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6996 CHECK(owner->result_ok);
6997         return *owner->contents.result;
6998 }
6999 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7000         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7001         CResult_NoneErrorZ_get_ok(owner_conv);
7002 }
7003
7004 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7005 CHECK(!owner->result_ok);
7006         return *owner->contents.err;
7007 }
7008 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7009         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7010         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7011         return ret_conv;
7012 }
7013
7014 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7015 CHECK(owner->result_ok);
7016         return NetAddress_clone(&*owner->contents.result);
7017 }
7018 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7019         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7020         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7021         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7022         uint64_t ret_ref = tag_ptr(ret_copy, true);
7023         return ret_ref;
7024 }
7025
7026 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7027 CHECK(!owner->result_ok);
7028         return DecodeError_clone(&*owner->contents.err);
7029 }
7030 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7031         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7032         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7033         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7034         uint64_t ret_ref = tag_ptr(ret_copy, true);
7035         return ret_ref;
7036 }
7037
7038 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7039         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7040         for (size_t i = 0; i < ret.datalen; i++) {
7041                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7042         }
7043         return ret;
7044 }
7045 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7046         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7047         for (size_t i = 0; i < ret.datalen; i++) {
7048                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7049         }
7050         return ret;
7051 }
7052 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7053         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7054         for (size_t i = 0; i < ret.datalen; i++) {
7055                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7056         }
7057         return ret;
7058 }
7059 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7060         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7061         for (size_t i = 0; i < ret.datalen; i++) {
7062                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7063         }
7064         return ret;
7065 }
7066 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7067         LDKAcceptChannel ret = *owner->contents.result;
7068         ret.is_owned = false;
7069         return ret;
7070 }
7071 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7072         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7073         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7074         uint64_t ret_ref = 0;
7075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7077         return ret_ref;
7078 }
7079
7080 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7081 CHECK(!owner->result_ok);
7082         return DecodeError_clone(&*owner->contents.err);
7083 }
7084 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7085         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7086         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7087         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7088         uint64_t ret_ref = tag_ptr(ret_copy, true);
7089         return ret_ref;
7090 }
7091
7092 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7093         LDKAnnouncementSignatures ret = *owner->contents.result;
7094         ret.is_owned = false;
7095         return ret;
7096 }
7097 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7098         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7099         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7100         uint64_t ret_ref = 0;
7101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7103         return ret_ref;
7104 }
7105
7106 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7107 CHECK(!owner->result_ok);
7108         return DecodeError_clone(&*owner->contents.err);
7109 }
7110 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7111         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7113         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7114         uint64_t ret_ref = tag_ptr(ret_copy, true);
7115         return ret_ref;
7116 }
7117
7118 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7119         LDKChannelReestablish ret = *owner->contents.result;
7120         ret.is_owned = false;
7121         return ret;
7122 }
7123 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7124         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7125         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7126         uint64_t ret_ref = 0;
7127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7129         return ret_ref;
7130 }
7131
7132 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7133 CHECK(!owner->result_ok);
7134         return DecodeError_clone(&*owner->contents.err);
7135 }
7136 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7137         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7139         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7140         uint64_t ret_ref = tag_ptr(ret_copy, true);
7141         return ret_ref;
7142 }
7143
7144 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7145         LDKClosingSigned ret = *owner->contents.result;
7146         ret.is_owned = false;
7147         return ret;
7148 }
7149 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7150         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7151         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7152         uint64_t ret_ref = 0;
7153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7155         return ret_ref;
7156 }
7157
7158 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7159 CHECK(!owner->result_ok);
7160         return DecodeError_clone(&*owner->contents.err);
7161 }
7162 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7163         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7165         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7166         uint64_t ret_ref = tag_ptr(ret_copy, true);
7167         return ret_ref;
7168 }
7169
7170 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7171         LDKClosingSignedFeeRange ret = *owner->contents.result;
7172         ret.is_owned = false;
7173         return ret;
7174 }
7175 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7176         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7177         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7178         uint64_t ret_ref = 0;
7179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7181         return ret_ref;
7182 }
7183
7184 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7185 CHECK(!owner->result_ok);
7186         return DecodeError_clone(&*owner->contents.err);
7187 }
7188 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7189         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7191         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7192         uint64_t ret_ref = tag_ptr(ret_copy, true);
7193         return ret_ref;
7194 }
7195
7196 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7197         LDKCommitmentSigned ret = *owner->contents.result;
7198         ret.is_owned = false;
7199         return ret;
7200 }
7201 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7202         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7203         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7204         uint64_t ret_ref = 0;
7205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7207         return ret_ref;
7208 }
7209
7210 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7211 CHECK(!owner->result_ok);
7212         return DecodeError_clone(&*owner->contents.err);
7213 }
7214 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7215         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7217         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7218         uint64_t ret_ref = tag_ptr(ret_copy, true);
7219         return ret_ref;
7220 }
7221
7222 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7223         LDKFundingCreated ret = *owner->contents.result;
7224         ret.is_owned = false;
7225         return ret;
7226 }
7227 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7228         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7229         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7230         uint64_t ret_ref = 0;
7231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7233         return ret_ref;
7234 }
7235
7236 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7237 CHECK(!owner->result_ok);
7238         return DecodeError_clone(&*owner->contents.err);
7239 }
7240 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7241         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7243         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7244         uint64_t ret_ref = tag_ptr(ret_copy, true);
7245         return ret_ref;
7246 }
7247
7248 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7249         LDKFundingSigned ret = *owner->contents.result;
7250         ret.is_owned = false;
7251         return ret;
7252 }
7253 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7254         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7255         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7256         uint64_t ret_ref = 0;
7257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7259         return ret_ref;
7260 }
7261
7262 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7263 CHECK(!owner->result_ok);
7264         return DecodeError_clone(&*owner->contents.err);
7265 }
7266 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7267         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7268         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7269         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7270         uint64_t ret_ref = tag_ptr(ret_copy, true);
7271         return ret_ref;
7272 }
7273
7274 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7275         LDKChannelReady ret = *owner->contents.result;
7276         ret.is_owned = false;
7277         return ret;
7278 }
7279 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7280         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7281         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7282         uint64_t ret_ref = 0;
7283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7285         return ret_ref;
7286 }
7287
7288 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7289 CHECK(!owner->result_ok);
7290         return DecodeError_clone(&*owner->contents.err);
7291 }
7292 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7293         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7295         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7296         uint64_t ret_ref = tag_ptr(ret_copy, true);
7297         return ret_ref;
7298 }
7299
7300 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7301         LDKInit ret = *owner->contents.result;
7302         ret.is_owned = false;
7303         return ret;
7304 }
7305 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7306         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7307         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7308         uint64_t ret_ref = 0;
7309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7311         return ret_ref;
7312 }
7313
7314 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7315 CHECK(!owner->result_ok);
7316         return DecodeError_clone(&*owner->contents.err);
7317 }
7318 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7319         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7321         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7322         uint64_t ret_ref = tag_ptr(ret_copy, true);
7323         return ret_ref;
7324 }
7325
7326 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7327         LDKOpenChannel ret = *owner->contents.result;
7328         ret.is_owned = false;
7329         return ret;
7330 }
7331 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7332         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7333         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7334         uint64_t ret_ref = 0;
7335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7337         return ret_ref;
7338 }
7339
7340 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7341 CHECK(!owner->result_ok);
7342         return DecodeError_clone(&*owner->contents.err);
7343 }
7344 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7345         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7347         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7348         uint64_t ret_ref = tag_ptr(ret_copy, true);
7349         return ret_ref;
7350 }
7351
7352 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7353         LDKRevokeAndACK ret = *owner->contents.result;
7354         ret.is_owned = false;
7355         return ret;
7356 }
7357 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7358         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7359         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7360         uint64_t ret_ref = 0;
7361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7363         return ret_ref;
7364 }
7365
7366 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7367 CHECK(!owner->result_ok);
7368         return DecodeError_clone(&*owner->contents.err);
7369 }
7370 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7371         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7373         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7374         uint64_t ret_ref = tag_ptr(ret_copy, true);
7375         return ret_ref;
7376 }
7377
7378 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7379         LDKShutdown ret = *owner->contents.result;
7380         ret.is_owned = false;
7381         return ret;
7382 }
7383 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7384         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7385         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7386         uint64_t ret_ref = 0;
7387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7389         return ret_ref;
7390 }
7391
7392 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7393 CHECK(!owner->result_ok);
7394         return DecodeError_clone(&*owner->contents.err);
7395 }
7396 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7397         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7399         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7400         uint64_t ret_ref = tag_ptr(ret_copy, true);
7401         return ret_ref;
7402 }
7403
7404 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7405         LDKUpdateFailHTLC ret = *owner->contents.result;
7406         ret.is_owned = false;
7407         return ret;
7408 }
7409 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7410         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7411         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7412         uint64_t ret_ref = 0;
7413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7415         return ret_ref;
7416 }
7417
7418 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7419 CHECK(!owner->result_ok);
7420         return DecodeError_clone(&*owner->contents.err);
7421 }
7422 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7423         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7425         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7426         uint64_t ret_ref = tag_ptr(ret_copy, true);
7427         return ret_ref;
7428 }
7429
7430 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7431         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7432         ret.is_owned = false;
7433         return ret;
7434 }
7435 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7436         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7437         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7438         uint64_t ret_ref = 0;
7439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7441         return ret_ref;
7442 }
7443
7444 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7445 CHECK(!owner->result_ok);
7446         return DecodeError_clone(&*owner->contents.err);
7447 }
7448 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7449         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7450         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7451         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7452         uint64_t ret_ref = tag_ptr(ret_copy, true);
7453         return ret_ref;
7454 }
7455
7456 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7457         LDKUpdateFee ret = *owner->contents.result;
7458         ret.is_owned = false;
7459         return ret;
7460 }
7461 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7462         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7463         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7464         uint64_t ret_ref = 0;
7465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7467         return ret_ref;
7468 }
7469
7470 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7471 CHECK(!owner->result_ok);
7472         return DecodeError_clone(&*owner->contents.err);
7473 }
7474 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7475         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7476         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7477         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7478         uint64_t ret_ref = tag_ptr(ret_copy, true);
7479         return ret_ref;
7480 }
7481
7482 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7483         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7484         ret.is_owned = false;
7485         return ret;
7486 }
7487 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7488         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7489         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7490         uint64_t ret_ref = 0;
7491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7493         return ret_ref;
7494 }
7495
7496 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7497 CHECK(!owner->result_ok);
7498         return DecodeError_clone(&*owner->contents.err);
7499 }
7500 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7501         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7502         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7503         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7504         uint64_t ret_ref = tag_ptr(ret_copy, true);
7505         return ret_ref;
7506 }
7507
7508 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7509         LDKUpdateAddHTLC ret = *owner->contents.result;
7510         ret.is_owned = false;
7511         return ret;
7512 }
7513 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7514         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7515         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7516         uint64_t ret_ref = 0;
7517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7519         return ret_ref;
7520 }
7521
7522 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7523 CHECK(!owner->result_ok);
7524         return DecodeError_clone(&*owner->contents.err);
7525 }
7526 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7527         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7529         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7530         uint64_t ret_ref = tag_ptr(ret_copy, true);
7531         return ret_ref;
7532 }
7533
7534 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7535         LDKOnionMessage ret = *owner->contents.result;
7536         ret.is_owned = false;
7537         return ret;
7538 }
7539 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7540         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7541         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7542         uint64_t ret_ref = 0;
7543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7545         return ret_ref;
7546 }
7547
7548 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7549 CHECK(!owner->result_ok);
7550         return DecodeError_clone(&*owner->contents.err);
7551 }
7552 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7553         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7555         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7556         uint64_t ret_ref = tag_ptr(ret_copy, true);
7557         return ret_ref;
7558 }
7559
7560 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7561         LDKPing ret = *owner->contents.result;
7562         ret.is_owned = false;
7563         return ret;
7564 }
7565 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7566         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7567         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7568         uint64_t ret_ref = 0;
7569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7571         return ret_ref;
7572 }
7573
7574 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7575 CHECK(!owner->result_ok);
7576         return DecodeError_clone(&*owner->contents.err);
7577 }
7578 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7579         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7581         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
7582         uint64_t ret_ref = tag_ptr(ret_copy, true);
7583         return ret_ref;
7584 }
7585
7586 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7587         LDKPong ret = *owner->contents.result;
7588         ret.is_owned = false;
7589         return ret;
7590 }
7591 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7592         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7593         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7594         uint64_t ret_ref = 0;
7595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7597         return ret_ref;
7598 }
7599
7600 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7601 CHECK(!owner->result_ok);
7602         return DecodeError_clone(&*owner->contents.err);
7603 }
7604 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7605         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7607         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
7608         uint64_t ret_ref = tag_ptr(ret_copy, true);
7609         return ret_ref;
7610 }
7611
7612 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7613         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7614         ret.is_owned = false;
7615         return ret;
7616 }
7617 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7618         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7619         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7620         uint64_t ret_ref = 0;
7621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7623         return ret_ref;
7624 }
7625
7626 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7627 CHECK(!owner->result_ok);
7628         return DecodeError_clone(&*owner->contents.err);
7629 }
7630 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7631         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7633         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7634         uint64_t ret_ref = tag_ptr(ret_copy, true);
7635         return ret_ref;
7636 }
7637
7638 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7639         LDKChannelAnnouncement ret = *owner->contents.result;
7640         ret.is_owned = false;
7641         return ret;
7642 }
7643 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7644         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7645         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7646         uint64_t ret_ref = 0;
7647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7649         return ret_ref;
7650 }
7651
7652 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7653 CHECK(!owner->result_ok);
7654         return DecodeError_clone(&*owner->contents.err);
7655 }
7656 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7657         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7659         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7660         uint64_t ret_ref = tag_ptr(ret_copy, true);
7661         return ret_ref;
7662 }
7663
7664 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7665         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7666         ret.is_owned = false;
7667         return ret;
7668 }
7669 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7670         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7671         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7672         uint64_t ret_ref = 0;
7673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7675         return ret_ref;
7676 }
7677
7678 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7679 CHECK(!owner->result_ok);
7680         return DecodeError_clone(&*owner->contents.err);
7681 }
7682 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7683         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7685         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7686         uint64_t ret_ref = tag_ptr(ret_copy, true);
7687         return ret_ref;
7688 }
7689
7690 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7691         LDKChannelUpdate ret = *owner->contents.result;
7692         ret.is_owned = false;
7693         return ret;
7694 }
7695 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7696         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7697         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7698         uint64_t ret_ref = 0;
7699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7701         return ret_ref;
7702 }
7703
7704 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7705 CHECK(!owner->result_ok);
7706         return DecodeError_clone(&*owner->contents.err);
7707 }
7708 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7709         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7711         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7712         uint64_t ret_ref = tag_ptr(ret_copy, true);
7713         return ret_ref;
7714 }
7715
7716 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7717         LDKErrorMessage ret = *owner->contents.result;
7718         ret.is_owned = false;
7719         return ret;
7720 }
7721 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7722         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7723         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7724         uint64_t ret_ref = 0;
7725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7727         return ret_ref;
7728 }
7729
7730 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7731 CHECK(!owner->result_ok);
7732         return DecodeError_clone(&*owner->contents.err);
7733 }
7734 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7735         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7737         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7738         uint64_t ret_ref = tag_ptr(ret_copy, true);
7739         return ret_ref;
7740 }
7741
7742 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7743         LDKWarningMessage ret = *owner->contents.result;
7744         ret.is_owned = false;
7745         return ret;
7746 }
7747 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7748         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7749         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7750         uint64_t ret_ref = 0;
7751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7753         return ret_ref;
7754 }
7755
7756 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7757 CHECK(!owner->result_ok);
7758         return DecodeError_clone(&*owner->contents.err);
7759 }
7760 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7761         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7762         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7763         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7764         uint64_t ret_ref = tag_ptr(ret_copy, true);
7765         return ret_ref;
7766 }
7767
7768 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7769         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7770         ret.is_owned = false;
7771         return ret;
7772 }
7773 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7774         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7775         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7776         uint64_t ret_ref = 0;
7777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7779         return ret_ref;
7780 }
7781
7782 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7783 CHECK(!owner->result_ok);
7784         return DecodeError_clone(&*owner->contents.err);
7785 }
7786 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7787         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7789         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7790         uint64_t ret_ref = tag_ptr(ret_copy, true);
7791         return ret_ref;
7792 }
7793
7794 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7795         LDKNodeAnnouncement ret = *owner->contents.result;
7796         ret.is_owned = false;
7797         return ret;
7798 }
7799 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7800         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7801         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7802         uint64_t ret_ref = 0;
7803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7805         return ret_ref;
7806 }
7807
7808 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7809 CHECK(!owner->result_ok);
7810         return DecodeError_clone(&*owner->contents.err);
7811 }
7812 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7813         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7814         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7815         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7816         uint64_t ret_ref = tag_ptr(ret_copy, true);
7817         return ret_ref;
7818 }
7819
7820 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7821         LDKQueryShortChannelIds ret = *owner->contents.result;
7822         ret.is_owned = false;
7823         return ret;
7824 }
7825 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7826         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7827         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7828         uint64_t ret_ref = 0;
7829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7831         return ret_ref;
7832 }
7833
7834 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7835 CHECK(!owner->result_ok);
7836         return DecodeError_clone(&*owner->contents.err);
7837 }
7838 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7839         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7840         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7841         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7842         uint64_t ret_ref = tag_ptr(ret_copy, true);
7843         return ret_ref;
7844 }
7845
7846 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7847         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7848         ret.is_owned = false;
7849         return ret;
7850 }
7851 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7852         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7853         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7854         uint64_t ret_ref = 0;
7855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7857         return ret_ref;
7858 }
7859
7860 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7861 CHECK(!owner->result_ok);
7862         return DecodeError_clone(&*owner->contents.err);
7863 }
7864 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7865         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7866         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7867         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7868         uint64_t ret_ref = tag_ptr(ret_copy, true);
7869         return ret_ref;
7870 }
7871
7872 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7873         LDKQueryChannelRange ret = *owner->contents.result;
7874         ret.is_owned = false;
7875         return ret;
7876 }
7877 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7878         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7879         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7880         uint64_t ret_ref = 0;
7881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7883         return ret_ref;
7884 }
7885
7886 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7887 CHECK(!owner->result_ok);
7888         return DecodeError_clone(&*owner->contents.err);
7889 }
7890 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7891         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7892         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7893         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7894         uint64_t ret_ref = tag_ptr(ret_copy, true);
7895         return ret_ref;
7896 }
7897
7898 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7899         LDKReplyChannelRange ret = *owner->contents.result;
7900         ret.is_owned = false;
7901         return ret;
7902 }
7903 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7904         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7905         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7906         uint64_t ret_ref = 0;
7907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7909         return ret_ref;
7910 }
7911
7912 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7913 CHECK(!owner->result_ok);
7914         return DecodeError_clone(&*owner->contents.err);
7915 }
7916 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7917         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7919         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7920         uint64_t ret_ref = tag_ptr(ret_copy, true);
7921         return ret_ref;
7922 }
7923
7924 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7925         LDKGossipTimestampFilter ret = *owner->contents.result;
7926         ret.is_owned = false;
7927         return ret;
7928 }
7929 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7930         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7931         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7932         uint64_t ret_ref = 0;
7933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7935         return ret_ref;
7936 }
7937
7938 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7939 CHECK(!owner->result_ok);
7940         return DecodeError_clone(&*owner->contents.err);
7941 }
7942 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7943         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7944         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7945         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7946         uint64_t ret_ref = tag_ptr(ret_copy, true);
7947         return ret_ref;
7948 }
7949
7950 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7951         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7952         switch(obj->tag) {
7953                 case LDKSignOrCreationError_SignError: return 0;
7954                 case LDKSignOrCreationError_CreationError: return 1;
7955                 default: abort();
7956         }
7957 }
7958 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7959         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7960         assert(obj->tag == LDKSignOrCreationError_CreationError);
7961                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7962         return creation_error_conv;
7963 }
7964 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7965         LDKInvoice ret = *owner->contents.result;
7966         ret.is_owned = false;
7967         return ret;
7968 }
7969 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7970         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7971         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7972         uint64_t ret_ref = 0;
7973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7975         return ret_ref;
7976 }
7977
7978 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7979 CHECK(!owner->result_ok);
7980         return SignOrCreationError_clone(&*owner->contents.err);
7981 }
7982 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7983         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7984         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7985         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7986         uint64_t ret_ref = tag_ptr(ret_copy, true);
7987         return ret_ref;
7988 }
7989
7990 typedef struct LDKFilter_JCalls {
7991         atomic_size_t refcnt;
7992         uint32_t instance_ptr;
7993 } LDKFilter_JCalls;
7994 static void LDKFilter_JCalls_free(void* this_arg) {
7995         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7996         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7997                 FREE(j_calls);
7998         }
7999 }
8000 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8001         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8002         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8003         memcpy(txid_arr->elems, *txid, 32);
8004         LDKu8slice script_pubkey_var = script_pubkey;
8005         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8006         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8007         js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8008 }
8009 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8010         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8011         LDKWatchedOutput output_var = output;
8012         uint64_t output_ref = 0;
8013         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8014         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8015         js_invoke_function_buuuuu(j_calls->instance_ptr, 39, output_ref, 0, 0, 0, 0, 0);
8016 }
8017 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8018         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8019         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8020 }
8021 static inline LDKFilter LDKFilter_init (JSValue o) {
8022         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8023         atomic_init(&calls->refcnt, 1);
8024         calls->instance_ptr = o;
8025
8026         LDKFilter ret = {
8027                 .this_arg = (void*) calls,
8028                 .register_tx = register_tx_LDKFilter_jcall,
8029                 .register_output = register_output_LDKFilter_jcall,
8030                 .free = LDKFilter_JCalls_free,
8031         };
8032         return ret;
8033 }
8034 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8035         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8036         *res_ptr = LDKFilter_init(o);
8037         return tag_ptr(res_ptr, true);
8038 }
8039 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8040         void* this_arg_ptr = untag_ptr(this_arg);
8041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8042         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8043         unsigned char txid_arr[32];
8044         CHECK(txid->arr_len == 32);
8045         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8046         unsigned char (*txid_ref)[32] = &txid_arr;
8047         LDKu8slice script_pubkey_ref;
8048         script_pubkey_ref.datalen = script_pubkey->arr_len;
8049         script_pubkey_ref.data = script_pubkey->elems;
8050         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8051         FREE(script_pubkey);
8052 }
8053
8054 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8055         void* this_arg_ptr = untag_ptr(this_arg);
8056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8057         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8058         LDKWatchedOutput output_conv;
8059         output_conv.inner = untag_ptr(output);
8060         output_conv.is_owned = ptr_is_owned(output);
8061         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8062         output_conv = WatchedOutput_clone(&output_conv);
8063         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8064 }
8065
8066 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8067         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8068         switch(obj->tag) {
8069                 case LDKCOption_FilterZ_Some: return 0;
8070                 case LDKCOption_FilterZ_None: return 1;
8071                 default: abort();
8072         }
8073 }
8074 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8075         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8076         assert(obj->tag == LDKCOption_FilterZ_Some);
8077                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8078                         *some_ret = obj->some;
8079                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8080                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8081                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8082                                 LDKFilter_JCalls_cloned(&(*some_ret));
8083                         }
8084         return tag_ptr(some_ret, true);
8085 }
8086 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8087         LDKLockedChannelMonitor ret = *owner->contents.result;
8088         ret.is_owned = false;
8089         return ret;
8090 }
8091 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8092         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8093         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8094         uint64_t ret_ref = 0;
8095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8097         return ret_ref;
8098 }
8099
8100 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8101 CHECK(!owner->result_ok);
8102         return *owner->contents.err;
8103 }
8104 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8105         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8106         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8107 }
8108
8109 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8110         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8111         for (size_t i = 0; i < ret.datalen; i++) {
8112                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8113         }
8114         return ret;
8115 }
8116 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8117         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8118         for (size_t i = 0; i < ret.datalen; i++) {
8119                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8120         }
8121         return ret;
8122 }
8123 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8124         LDKOutPoint ret = owner->a;
8125         ret.is_owned = false;
8126         return ret;
8127 }
8128 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8129         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8130         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8131         uint64_t ret_ref = 0;
8132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8134         return ret_ref;
8135 }
8136
8137 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8138         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8139 }
8140 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8141         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8142         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8143         uint64_tArray ret_arr = NULL;
8144         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8145         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8146         for (size_t r = 0; r < ret_var.datalen; r++) {
8147                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8148                 uint64_t ret_conv_17_ref = 0;
8149                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8150                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8151                 ret_arr_ptr[r] = ret_conv_17_ref;
8152         }
8153         
8154         FREE(ret_var.data);
8155         return ret_arr;
8156 }
8157
8158 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8159         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8160         for (size_t i = 0; i < ret.datalen; i++) {
8161                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8162         }
8163         return ret;
8164 }
8165 typedef struct LDKMessageSendEventsProvider_JCalls {
8166         atomic_size_t refcnt;
8167         uint32_t instance_ptr;
8168 } LDKMessageSendEventsProvider_JCalls;
8169 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8170         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8171         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8172                 FREE(j_calls);
8173         }
8174 }
8175 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8176         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8177         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
8178         LDKCVec_MessageSendEventZ ret_constr;
8179         ret_constr.datalen = ret->arr_len;
8180         if (ret_constr.datalen > 0)
8181                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8182         else
8183                 ret_constr.data = NULL;
8184         uint64_t* ret_vals = ret->elems;
8185         for (size_t s = 0; s < ret_constr.datalen; s++) {
8186                 uint64_t ret_conv_18 = ret_vals[s];
8187                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
8188                 CHECK_ACCESS(ret_conv_18_ptr);
8189                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8190                 FREE(untag_ptr(ret_conv_18));
8191                 ret_constr.data[s] = ret_conv_18_conv;
8192         }
8193         FREE(ret);
8194         return ret_constr;
8195 }
8196 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8197         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8198         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8199 }
8200 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8201         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8202         atomic_init(&calls->refcnt, 1);
8203         calls->instance_ptr = o;
8204
8205         LDKMessageSendEventsProvider ret = {
8206                 .this_arg = (void*) calls,
8207                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8208                 .free = LDKMessageSendEventsProvider_JCalls_free,
8209         };
8210         return ret;
8211 }
8212 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8213         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8214         *res_ptr = LDKMessageSendEventsProvider_init(o);
8215         return tag_ptr(res_ptr, true);
8216 }
8217 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) {
8218         void* this_arg_ptr = untag_ptr(this_arg);
8219         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8220         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8221         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8222         uint64_tArray ret_arr = NULL;
8223         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8224         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8225         for (size_t s = 0; s < ret_var.datalen; s++) {
8226                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8227                 *ret_conv_18_copy = ret_var.data[s];
8228                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
8229                 ret_arr_ptr[s] = ret_conv_18_ref;
8230         }
8231         
8232         FREE(ret_var.data);
8233         return ret_arr;
8234 }
8235
8236 typedef struct LDKOnionMessageProvider_JCalls {
8237         atomic_size_t refcnt;
8238         uint32_t instance_ptr;
8239 } LDKOnionMessageProvider_JCalls;
8240 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
8241         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8242         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8243                 FREE(j_calls);
8244         }
8245 }
8246 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
8247         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8248         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
8249         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
8250         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
8251         LDKOnionMessage ret_conv;
8252         ret_conv.inner = untag_ptr(ret);
8253         ret_conv.is_owned = ptr_is_owned(ret);
8254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
8255         return ret_conv;
8256 }
8257 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
8258         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
8259         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8260 }
8261 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8262         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8263         atomic_init(&calls->refcnt, 1);
8264         calls->instance_ptr = o;
8265
8266         LDKOnionMessageProvider ret = {
8267                 .this_arg = (void*) calls,
8268                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8269                 .free = LDKOnionMessageProvider_JCalls_free,
8270         };
8271         return ret;
8272 }
8273 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8274         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8275         *res_ptr = LDKOnionMessageProvider_init(o);
8276         return tag_ptr(res_ptr, true);
8277 }
8278 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) {
8279         void* this_arg_ptr = untag_ptr(this_arg);
8280         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8281         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8282         LDKPublicKey peer_node_id_ref;
8283         CHECK(peer_node_id->arr_len == 33);
8284         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8285         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8286         uint64_t ret_ref = 0;
8287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8289         return ret_ref;
8290 }
8291
8292 typedef struct LDKEventHandler_JCalls {
8293         atomic_size_t refcnt;
8294         uint32_t instance_ptr;
8295 } LDKEventHandler_JCalls;
8296 static void LDKEventHandler_JCalls_free(void* this_arg) {
8297         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8298         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8299                 FREE(j_calls);
8300         }
8301 }
8302 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
8303         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8304         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8305         *event_copy = event;
8306         uint64_t event_ref = tag_ptr(event_copy, true);
8307         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, event_ref, 0, 0, 0, 0, 0);
8308 }
8309 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8310         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8311         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8312 }
8313 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8314         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8315         atomic_init(&calls->refcnt, 1);
8316         calls->instance_ptr = o;
8317
8318         LDKEventHandler ret = {
8319                 .this_arg = (void*) calls,
8320                 .handle_event = handle_event_LDKEventHandler_jcall,
8321                 .free = LDKEventHandler_JCalls_free,
8322         };
8323         return ret;
8324 }
8325 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8326         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8327         *res_ptr = LDKEventHandler_init(o);
8328         return tag_ptr(res_ptr, true);
8329 }
8330 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8331         void* this_arg_ptr = untag_ptr(this_arg);
8332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8333         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8334         void* event_ptr = untag_ptr(event);
8335         CHECK_ACCESS(event_ptr);
8336         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
8337         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
8338         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8339 }
8340
8341 typedef struct LDKEventsProvider_JCalls {
8342         atomic_size_t refcnt;
8343         uint32_t instance_ptr;
8344 } LDKEventsProvider_JCalls;
8345 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8346         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8347         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8348                 FREE(j_calls);
8349         }
8350 }
8351 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8352         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8353         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8354         *handler_ret = handler;
8355         js_invoke_function_buuuuu(j_calls->instance_ptr, 43, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8356 }
8357 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8358         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8359         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8360 }
8361 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8362         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8363         atomic_init(&calls->refcnt, 1);
8364         calls->instance_ptr = o;
8365
8366         LDKEventsProvider ret = {
8367                 .this_arg = (void*) calls,
8368                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8369                 .free = LDKEventsProvider_JCalls_free,
8370         };
8371         return ret;
8372 }
8373 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8374         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8375         *res_ptr = LDKEventsProvider_init(o);
8376         return tag_ptr(res_ptr, true);
8377 }
8378 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8379         void* this_arg_ptr = untag_ptr(this_arg);
8380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8381         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8382         void* handler_ptr = untag_ptr(handler);
8383         CHECK_ACCESS(handler_ptr);
8384         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8385         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8386                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8387                 LDKEventHandler_JCalls_cloned(&handler_conv);
8388         }
8389         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8390 }
8391
8392 typedef struct LDKScore_JCalls {
8393         atomic_size_t refcnt;
8394         uint32_t instance_ptr;
8395 } LDKScore_JCalls;
8396 static void LDKScore_JCalls_free(void* this_arg) {
8397         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8398         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8399                 FREE(j_calls);
8400         }
8401 }
8402 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8403         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8404         int64_t short_channel_id_conv = short_channel_id;
8405         LDKNodeId source_var = *source;
8406         uint64_t source_ref = 0;
8407         source_var = NodeId_clone(&source_var);
8408         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8409         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8410         LDKNodeId target_var = *target;
8411         uint64_t target_ref = 0;
8412         target_var = NodeId_clone(&target_var);
8413         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8414         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8415         LDKChannelUsage usage_var = usage;
8416         uint64_t usage_ref = 0;
8417         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8418         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8419         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 44, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8420 }
8421 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8422         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8423         LDKCVec_RouteHopZ path_var = path;
8424         uint64_tArray path_arr = NULL;
8425         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8426         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8427         for (size_t k = 0; k < path_var.datalen; k++) {
8428                 LDKRouteHop path_conv_10_var = path_var.data[k];
8429                 uint64_t path_conv_10_ref = 0;
8430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8431                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8432                 path_arr_ptr[k] = path_conv_10_ref;
8433         }
8434         
8435         FREE(path_var.data);
8436         int64_t short_channel_id_conv = short_channel_id;
8437         js_invoke_function_ubuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8438 }
8439 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8440         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8441         LDKCVec_RouteHopZ path_var = path;
8442         uint64_tArray path_arr = NULL;
8443         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8444         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8445         for (size_t k = 0; k < path_var.datalen; k++) {
8446                 LDKRouteHop path_conv_10_var = path_var.data[k];
8447                 uint64_t path_conv_10_ref = 0;
8448                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8449                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8450                 path_arr_ptr[k] = path_conv_10_ref;
8451         }
8452         
8453         FREE(path_var.data);
8454         js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8455 }
8456 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8457         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8458         LDKCVec_RouteHopZ path_var = path;
8459         uint64_tArray path_arr = NULL;
8460         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8461         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8462         for (size_t k = 0; k < path_var.datalen; k++) {
8463                 LDKRouteHop path_conv_10_var = path_var.data[k];
8464                 uint64_t path_conv_10_ref = 0;
8465                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8466                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8467                 path_arr_ptr[k] = path_conv_10_ref;
8468         }
8469         
8470         FREE(path_var.data);
8471         int64_t short_channel_id_conv = short_channel_id;
8472         js_invoke_function_ubuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8473 }
8474 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8475         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8476         LDKCVec_RouteHopZ path_var = path;
8477         uint64_tArray path_arr = NULL;
8478         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8479         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8480         for (size_t k = 0; k < path_var.datalen; k++) {
8481                 LDKRouteHop path_conv_10_var = path_var.data[k];
8482                 uint64_t path_conv_10_ref = 0;
8483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8484                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8485                 path_arr_ptr[k] = path_conv_10_ref;
8486         }
8487         
8488         FREE(path_var.data);
8489         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8490 }
8491 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8492         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8493         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
8494         LDKCVec_u8Z ret_ref;
8495         ret_ref.datalen = ret->arr_len;
8496         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8497         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8498         return ret_ref;
8499 }
8500 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8501         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8502         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8503 }
8504 static inline LDKScore LDKScore_init (JSValue o) {
8505         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8506         atomic_init(&calls->refcnt, 1);
8507         calls->instance_ptr = o;
8508
8509         LDKScore ret = {
8510                 .this_arg = (void*) calls,
8511                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8512                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8513                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8514                 .probe_failed = probe_failed_LDKScore_jcall,
8515                 .probe_successful = probe_successful_LDKScore_jcall,
8516                 .write = write_LDKScore_jcall,
8517                 .free = LDKScore_JCalls_free,
8518         };
8519         return ret;
8520 }
8521 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8522         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8523         *res_ptr = LDKScore_init(o);
8524         return tag_ptr(res_ptr, true);
8525 }
8526 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) {
8527         void* this_arg_ptr = untag_ptr(this_arg);
8528         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8529         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8530         LDKNodeId source_conv;
8531         source_conv.inner = untag_ptr(source);
8532         source_conv.is_owned = ptr_is_owned(source);
8533         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8534         source_conv.is_owned = false;
8535         LDKNodeId target_conv;
8536         target_conv.inner = untag_ptr(target);
8537         target_conv.is_owned = ptr_is_owned(target);
8538         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8539         target_conv.is_owned = false;
8540         LDKChannelUsage usage_conv;
8541         usage_conv.inner = untag_ptr(usage);
8542         usage_conv.is_owned = ptr_is_owned(usage);
8543         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8544         usage_conv = ChannelUsage_clone(&usage_conv);
8545         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8546         return ret_conv;
8547 }
8548
8549 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) {
8550         void* this_arg_ptr = untag_ptr(this_arg);
8551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8552         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8553         LDKCVec_RouteHopZ path_constr;
8554         path_constr.datalen = path->arr_len;
8555         if (path_constr.datalen > 0)
8556                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8557         else
8558                 path_constr.data = NULL;
8559         uint64_t* path_vals = path->elems;
8560         for (size_t k = 0; k < path_constr.datalen; k++) {
8561                 uint64_t path_conv_10 = path_vals[k];
8562                 LDKRouteHop path_conv_10_conv;
8563                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8564                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8565                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8566                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8567                 path_constr.data[k] = path_conv_10_conv;
8568         }
8569         FREE(path);
8570         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8571 }
8572
8573 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8574         void* this_arg_ptr = untag_ptr(this_arg);
8575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8576         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8577         LDKCVec_RouteHopZ path_constr;
8578         path_constr.datalen = path->arr_len;
8579         if (path_constr.datalen > 0)
8580                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8581         else
8582                 path_constr.data = NULL;
8583         uint64_t* path_vals = path->elems;
8584         for (size_t k = 0; k < path_constr.datalen; k++) {
8585                 uint64_t path_conv_10 = path_vals[k];
8586                 LDKRouteHop path_conv_10_conv;
8587                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8588                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8589                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8590                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8591                 path_constr.data[k] = path_conv_10_conv;
8592         }
8593         FREE(path);
8594         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8595 }
8596
8597 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8598         void* this_arg_ptr = untag_ptr(this_arg);
8599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8600         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8601         LDKCVec_RouteHopZ path_constr;
8602         path_constr.datalen = path->arr_len;
8603         if (path_constr.datalen > 0)
8604                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8605         else
8606                 path_constr.data = NULL;
8607         uint64_t* path_vals = path->elems;
8608         for (size_t k = 0; k < path_constr.datalen; k++) {
8609                 uint64_t path_conv_10 = path_vals[k];
8610                 LDKRouteHop path_conv_10_conv;
8611                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8612                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8614                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8615                 path_constr.data[k] = path_conv_10_conv;
8616         }
8617         FREE(path);
8618         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8619 }
8620
8621 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8622         void* this_arg_ptr = untag_ptr(this_arg);
8623         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8624         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8625         LDKCVec_RouteHopZ path_constr;
8626         path_constr.datalen = path->arr_len;
8627         if (path_constr.datalen > 0)
8628                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8629         else
8630                 path_constr.data = NULL;
8631         uint64_t* path_vals = path->elems;
8632         for (size_t k = 0; k < path_constr.datalen; k++) {
8633                 uint64_t path_conv_10 = path_vals[k];
8634                 LDKRouteHop path_conv_10_conv;
8635                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8636                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8637                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8638                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8639                 path_constr.data[k] = path_conv_10_conv;
8640         }
8641         FREE(path);
8642         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8643 }
8644
8645 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8646         void* this_arg_ptr = untag_ptr(this_arg);
8647         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8648         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8649         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8652         CVec_u8Z_free(ret_var);
8653         return ret_arr;
8654 }
8655
8656 typedef struct LDKLockableScore_JCalls {
8657         atomic_size_t refcnt;
8658         uint32_t instance_ptr;
8659 } LDKLockableScore_JCalls;
8660 static void LDKLockableScore_JCalls_free(void* this_arg) {
8661         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8662         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8663                 FREE(j_calls);
8664         }
8665 }
8666 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8667         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8668         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8669         void* ret_ptr = untag_ptr(ret);
8670         CHECK_ACCESS(ret_ptr);
8671         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8672         if (ret_conv.free == LDKScore_JCalls_free) {
8673                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8674                 LDKScore_JCalls_cloned(&ret_conv);
8675         }// WARNING: we may need a move here but no clone is available for LDKScore
8676         
8677         return ret_conv;
8678 }
8679 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8680         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8681         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8682 }
8683 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8684         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8685         atomic_init(&calls->refcnt, 1);
8686         calls->instance_ptr = o;
8687
8688         LDKLockableScore ret = {
8689                 .this_arg = (void*) calls,
8690                 .lock = lock_LDKLockableScore_jcall,
8691                 .free = LDKLockableScore_JCalls_free,
8692         };
8693         return ret;
8694 }
8695 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8696         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8697         *res_ptr = LDKLockableScore_init(o);
8698         return tag_ptr(res_ptr, true);
8699 }
8700 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8701         void* this_arg_ptr = untag_ptr(this_arg);
8702         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8703         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8704         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8705         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8706         return tag_ptr(ret_ret, true);
8707 }
8708
8709 typedef struct LDKWriteableScore_JCalls {
8710         atomic_size_t refcnt;
8711         uint32_t instance_ptr;
8712         LDKLockableScore_JCalls* LockableScore;
8713 } LDKWriteableScore_JCalls;
8714 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8715         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8716         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8717                 FREE(j_calls);
8718         }
8719 }
8720 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8721         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8722         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, 0, 0, 0, 0, 0, 0);
8723         LDKCVec_u8Z ret_ref;
8724         ret_ref.datalen = ret->arr_len;
8725         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8726         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8727         return ret_ref;
8728 }
8729 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8730         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8731         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8732         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8733 }
8734 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8735         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8736         atomic_init(&calls->refcnt, 1);
8737         calls->instance_ptr = o;
8738
8739         LDKWriteableScore ret = {
8740                 .this_arg = (void*) calls,
8741                 .write = write_LDKWriteableScore_jcall,
8742                 .free = LDKWriteableScore_JCalls_free,
8743                 .LockableScore = LDKLockableScore_init(LockableScore),
8744         };
8745         calls->LockableScore = ret.LockableScore.this_arg;
8746         return ret;
8747 }
8748 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8749         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8750         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8751         return tag_ptr(res_ptr, true);
8752 }
8753 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8754         void* this_arg_ptr = untag_ptr(this_arg);
8755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8756         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8757         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8760         CVec_u8Z_free(ret_var);
8761         return ret_arr;
8762 }
8763
8764 typedef struct LDKPersister_JCalls {
8765         atomic_size_t refcnt;
8766         uint32_t instance_ptr;
8767 } LDKPersister_JCalls;
8768 static void LDKPersister_JCalls_free(void* this_arg) {
8769         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8770         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8771                 FREE(j_calls);
8772         }
8773 }
8774 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8775         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8776         LDKChannelManager channel_manager_var = *channel_manager;
8777         uint64_t channel_manager_ref = 0;
8778         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8779         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8780         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8781         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, channel_manager_ref, 0, 0, 0, 0, 0);
8782         void* ret_ptr = untag_ptr(ret);
8783         CHECK_ACCESS(ret_ptr);
8784         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8785         FREE(untag_ptr(ret));
8786         return ret_conv;
8787 }
8788 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8789         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8790         LDKNetworkGraph network_graph_var = *network_graph;
8791         uint64_t network_graph_ref = 0;
8792         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8793         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8794         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8795         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, network_graph_ref, 0, 0, 0, 0, 0);
8796         void* ret_ptr = untag_ptr(ret);
8797         CHECK_ACCESS(ret_ptr);
8798         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8799         FREE(untag_ptr(ret));
8800         return ret_conv;
8801 }
8802 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8803         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8804         // WARNING: This object doesn't live past this scope, needs clone!
8805         uint64_t ret_scorer = tag_ptr(scorer, false);
8806         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, ret_scorer, 0, 0, 0, 0, 0);
8807         void* ret_ptr = untag_ptr(ret);
8808         CHECK_ACCESS(ret_ptr);
8809         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8810         FREE(untag_ptr(ret));
8811         return ret_conv;
8812 }
8813 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8814         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8815         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8816 }
8817 static inline LDKPersister LDKPersister_init (JSValue o) {
8818         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8819         atomic_init(&calls->refcnt, 1);
8820         calls->instance_ptr = o;
8821
8822         LDKPersister ret = {
8823                 .this_arg = (void*) calls,
8824                 .persist_manager = persist_manager_LDKPersister_jcall,
8825                 .persist_graph = persist_graph_LDKPersister_jcall,
8826                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8827                 .free = LDKPersister_JCalls_free,
8828         };
8829         return ret;
8830 }
8831 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8832         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8833         *res_ptr = LDKPersister_init(o);
8834         return tag_ptr(res_ptr, true);
8835 }
8836 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8837         void* this_arg_ptr = untag_ptr(this_arg);
8838         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8839         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8840         LDKChannelManager channel_manager_conv;
8841         channel_manager_conv.inner = untag_ptr(channel_manager);
8842         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8843         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8844         channel_manager_conv.is_owned = false;
8845         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8846         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8847         return tag_ptr(ret_conv, true);
8848 }
8849
8850 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8851         void* this_arg_ptr = untag_ptr(this_arg);
8852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8853         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8854         LDKNetworkGraph network_graph_conv;
8855         network_graph_conv.inner = untag_ptr(network_graph);
8856         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8857         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8858         network_graph_conv.is_owned = false;
8859         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8860         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8861         return tag_ptr(ret_conv, true);
8862 }
8863
8864 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8865         void* this_arg_ptr = untag_ptr(this_arg);
8866         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8867         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8868         void* scorer_ptr = untag_ptr(scorer);
8869         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8870         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8871         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8872         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8873         return tag_ptr(ret_conv, true);
8874 }
8875
8876 typedef struct LDKFutureCallback_JCalls {
8877         atomic_size_t refcnt;
8878         uint32_t instance_ptr;
8879 } LDKFutureCallback_JCalls;
8880 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8881         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8882         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8883                 FREE(j_calls);
8884         }
8885 }
8886 void call_LDKFutureCallback_jcall(const void* this_arg) {
8887         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8888         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
8889 }
8890 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8891         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8892         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8893 }
8894 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8895         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8896         atomic_init(&calls->refcnt, 1);
8897         calls->instance_ptr = o;
8898
8899         LDKFutureCallback ret = {
8900                 .this_arg = (void*) calls,
8901                 .call = call_LDKFutureCallback_jcall,
8902                 .free = LDKFutureCallback_JCalls_free,
8903         };
8904         return ret;
8905 }
8906 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8907         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8908         *res_ptr = LDKFutureCallback_init(o);
8909         return tag_ptr(res_ptr, true);
8910 }
8911 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8912         void* this_arg_ptr = untag_ptr(this_arg);
8913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8914         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8915         (this_arg_conv->call)(this_arg_conv->this_arg);
8916 }
8917
8918 typedef struct LDKListen_JCalls {
8919         atomic_size_t refcnt;
8920         uint32_t instance_ptr;
8921 } LDKListen_JCalls;
8922 static void LDKListen_JCalls_free(void* this_arg) {
8923         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8924         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8925                 FREE(j_calls);
8926         }
8927 }
8928 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8929         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8930         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8931         memcpy(header_arr->elems, *header, 80);
8932         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8933         uint64_tArray txdata_arr = NULL;
8934         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8935         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8936         for (size_t c = 0; c < txdata_var.datalen; c++) {
8937                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8938                 *txdata_conv_28_conv = txdata_var.data[c];
8939                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8940         }
8941         
8942         FREE(txdata_var.data);
8943         int32_t height_conv = height;
8944         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8945 }
8946 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8947         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8948         LDKu8slice block_var = block;
8949         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8950         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8951         int32_t height_conv = height;
8952         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8953 }
8954 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8955         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8956         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8957         memcpy(header_arr->elems, *header, 80);
8958         int32_t height_conv = height;
8959         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8960 }
8961 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8962         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8963         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8964 }
8965 static inline LDKListen LDKListen_init (JSValue o) {
8966         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8967         atomic_init(&calls->refcnt, 1);
8968         calls->instance_ptr = o;
8969
8970         LDKListen ret = {
8971                 .this_arg = (void*) calls,
8972                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8973                 .block_connected = block_connected_LDKListen_jcall,
8974                 .block_disconnected = block_disconnected_LDKListen_jcall,
8975                 .free = LDKListen_JCalls_free,
8976         };
8977         return ret;
8978 }
8979 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8980         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8981         *res_ptr = LDKListen_init(o);
8982         return tag_ptr(res_ptr, true);
8983 }
8984 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) {
8985         void* this_arg_ptr = untag_ptr(this_arg);
8986         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8987         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8988         unsigned char header_arr[80];
8989         CHECK(header->arr_len == 80);
8990         memcpy(header_arr, header->elems, 80); FREE(header);
8991         unsigned char (*header_ref)[80] = &header_arr;
8992         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8993         txdata_constr.datalen = txdata->arr_len;
8994         if (txdata_constr.datalen > 0)
8995                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8996         else
8997                 txdata_constr.data = NULL;
8998         uint64_t* txdata_vals = txdata->elems;
8999         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9000                 uint64_t txdata_conv_28 = txdata_vals[c];
9001                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9002                 CHECK_ACCESS(txdata_conv_28_ptr);
9003                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9004                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9005                 txdata_constr.data[c] = txdata_conv_28_conv;
9006         }
9007         FREE(txdata);
9008         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9009 }
9010
9011 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9012         void* this_arg_ptr = untag_ptr(this_arg);
9013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9014         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9015         LDKu8slice block_ref;
9016         block_ref.datalen = block->arr_len;
9017         block_ref.data = block->elems;
9018         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9019         FREE(block);
9020 }
9021
9022 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9023         void* this_arg_ptr = untag_ptr(this_arg);
9024         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9025         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9026         unsigned char header_arr[80];
9027         CHECK(header->arr_len == 80);
9028         memcpy(header_arr, header->elems, 80); FREE(header);
9029         unsigned char (*header_ref)[80] = &header_arr;
9030         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9031 }
9032
9033 typedef struct LDKConfirm_JCalls {
9034         atomic_size_t refcnt;
9035         uint32_t instance_ptr;
9036 } LDKConfirm_JCalls;
9037 static void LDKConfirm_JCalls_free(void* this_arg) {
9038         LDKConfirm_JCalls *j_calls = (LDKConfirm_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 transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9044         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9045         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9046         memcpy(header_arr->elems, *header, 80);
9047         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9048         uint64_tArray txdata_arr = NULL;
9049         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9050         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9051         for (size_t c = 0; c < txdata_var.datalen; c++) {
9052                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9053                 *txdata_conv_28_conv = txdata_var.data[c];
9054                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9055         }
9056         
9057         FREE(txdata_var.data);
9058         int32_t height_conv = height;
9059         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9060 }
9061 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9062         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9063         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9064         memcpy(txid_arr->elems, *txid, 32);
9065         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9066 }
9067 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9068         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9069         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9070         memcpy(header_arr->elems, *header, 80);
9071         int32_t height_conv = height;
9072         js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9073 }
9074 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9075         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9076         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
9077         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9078         ret_constr.datalen = ret->arr_len;
9079         if (ret_constr.datalen > 0)
9080                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9081         else
9082                 ret_constr.data = NULL;
9083         uint64_t* ret_vals = ret->elems;
9084         for (size_t z = 0; z < ret_constr.datalen; z++) {
9085                 uint64_t ret_conv_25 = ret_vals[z];
9086                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9087                 CHECK_ACCESS(ret_conv_25_ptr);
9088                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9089                 FREE(untag_ptr(ret_conv_25));
9090                 ret_constr.data[z] = ret_conv_25_conv;
9091         }
9092         FREE(ret);
9093         return ret_constr;
9094 }
9095 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9096         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9097         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9098 }
9099 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9100         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9101         atomic_init(&calls->refcnt, 1);
9102         calls->instance_ptr = o;
9103
9104         LDKConfirm ret = {
9105                 .this_arg = (void*) calls,
9106                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9107                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9108                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9109                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9110                 .free = LDKConfirm_JCalls_free,
9111         };
9112         return ret;
9113 }
9114 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9115         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9116         *res_ptr = LDKConfirm_init(o);
9117         return tag_ptr(res_ptr, true);
9118 }
9119 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) {
9120         void* this_arg_ptr = untag_ptr(this_arg);
9121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9122         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9123         unsigned char header_arr[80];
9124         CHECK(header->arr_len == 80);
9125         memcpy(header_arr, header->elems, 80); FREE(header);
9126         unsigned char (*header_ref)[80] = &header_arr;
9127         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9128         txdata_constr.datalen = txdata->arr_len;
9129         if (txdata_constr.datalen > 0)
9130                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9131         else
9132                 txdata_constr.data = NULL;
9133         uint64_t* txdata_vals = txdata->elems;
9134         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9135                 uint64_t txdata_conv_28 = txdata_vals[c];
9136                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9137                 CHECK_ACCESS(txdata_conv_28_ptr);
9138                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9139                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9140                 txdata_constr.data[c] = txdata_conv_28_conv;
9141         }
9142         FREE(txdata);
9143         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9144 }
9145
9146 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9147         void* this_arg_ptr = untag_ptr(this_arg);
9148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9149         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9150         unsigned char txid_arr[32];
9151         CHECK(txid->arr_len == 32);
9152         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9153         unsigned char (*txid_ref)[32] = &txid_arr;
9154         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9155 }
9156
9157 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9158         void* this_arg_ptr = untag_ptr(this_arg);
9159         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9160         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9161         unsigned char header_arr[80];
9162         CHECK(header->arr_len == 80);
9163         memcpy(header_arr, header->elems, 80); FREE(header);
9164         unsigned char (*header_ref)[80] = &header_arr;
9165         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9166 }
9167
9168 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9169         void* this_arg_ptr = untag_ptr(this_arg);
9170         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9171         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9172         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9173         uint64_tArray ret_arr = NULL;
9174         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9175         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9176         for (size_t z = 0; z < ret_var.datalen; z++) {
9177                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9178                 *ret_conv_25_conv = ret_var.data[z];
9179                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9180         }
9181         
9182         FREE(ret_var.data);
9183         return ret_arr;
9184 }
9185
9186 typedef struct LDKPersist_JCalls {
9187         atomic_size_t refcnt;
9188         uint32_t instance_ptr;
9189 } LDKPersist_JCalls;
9190 static void LDKPersist_JCalls_free(void* this_arg) {
9191         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9192         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9193                 FREE(j_calls);
9194         }
9195 }
9196 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9197         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9198         LDKOutPoint channel_id_var = channel_id;
9199         uint64_t channel_id_ref = 0;
9200         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9201         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9202         LDKChannelMonitor data_var = *data;
9203         uint64_t data_ref = 0;
9204         data_var = ChannelMonitor_clone(&data_var);
9205         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9206         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9207         LDKMonitorUpdateId update_id_var = update_id;
9208         uint64_t update_id_ref = 0;
9209         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9210         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9211         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 63, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9212         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9213         return ret_conv;
9214 }
9215 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9216         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9217         LDKOutPoint channel_id_var = channel_id;
9218         uint64_t channel_id_ref = 0;
9219         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9220         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9221         LDKChannelMonitorUpdate update_var = *update;
9222         uint64_t update_ref = 0;
9223         update_var = ChannelMonitorUpdate_clone(&update_var);
9224         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9225         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9226         LDKChannelMonitor data_var = *data;
9227         uint64_t data_ref = 0;
9228         data_var = ChannelMonitor_clone(&data_var);
9229         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9230         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9231         LDKMonitorUpdateId update_id_var = update_id;
9232         uint64_t update_id_ref = 0;
9233         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9234         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9235         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 64, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9236         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9237         return ret_conv;
9238 }
9239 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9240         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9242 }
9243 static inline LDKPersist LDKPersist_init (JSValue o) {
9244         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9245         atomic_init(&calls->refcnt, 1);
9246         calls->instance_ptr = o;
9247
9248         LDKPersist ret = {
9249                 .this_arg = (void*) calls,
9250                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9251                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9252                 .free = LDKPersist_JCalls_free,
9253         };
9254         return ret;
9255 }
9256 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9257         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9258         *res_ptr = LDKPersist_init(o);
9259         return tag_ptr(res_ptr, true);
9260 }
9261 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) {
9262         void* this_arg_ptr = untag_ptr(this_arg);
9263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9264         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9265         LDKOutPoint channel_id_conv;
9266         channel_id_conv.inner = untag_ptr(channel_id);
9267         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9268         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9269         channel_id_conv = OutPoint_clone(&channel_id_conv);
9270         LDKChannelMonitor data_conv;
9271         data_conv.inner = untag_ptr(data);
9272         data_conv.is_owned = ptr_is_owned(data);
9273         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9274         data_conv.is_owned = false;
9275         LDKMonitorUpdateId update_id_conv;
9276         update_id_conv.inner = untag_ptr(update_id);
9277         update_id_conv.is_owned = ptr_is_owned(update_id);
9278         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9279         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9280         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));
9281         return ret_conv;
9282 }
9283
9284 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) {
9285         void* this_arg_ptr = untag_ptr(this_arg);
9286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9287         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9288         LDKOutPoint channel_id_conv;
9289         channel_id_conv.inner = untag_ptr(channel_id);
9290         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9291         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9292         channel_id_conv = OutPoint_clone(&channel_id_conv);
9293         LDKChannelMonitorUpdate update_conv;
9294         update_conv.inner = untag_ptr(update);
9295         update_conv.is_owned = ptr_is_owned(update);
9296         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9297         update_conv.is_owned = false;
9298         LDKChannelMonitor data_conv;
9299         data_conv.inner = untag_ptr(data);
9300         data_conv.is_owned = ptr_is_owned(data);
9301         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9302         data_conv.is_owned = false;
9303         LDKMonitorUpdateId update_id_conv;
9304         update_id_conv.inner = untag_ptr(update_id);
9305         update_id_conv.is_owned = ptr_is_owned(update_id);
9306         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9307         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9308         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));
9309         return ret_conv;
9310 }
9311
9312 typedef struct LDKChannelMessageHandler_JCalls {
9313         atomic_size_t refcnt;
9314         uint32_t instance_ptr;
9315         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9316 } LDKChannelMessageHandler_JCalls;
9317 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9318         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9319         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9320                 FREE(j_calls);
9321         }
9322 }
9323 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9324         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9325         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9326         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9327         LDKInitFeatures their_features_var = their_features;
9328         uint64_t their_features_ref = 0;
9329         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9330         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9331         LDKOpenChannel msg_var = *msg;
9332         uint64_t msg_ref = 0;
9333         msg_var = OpenChannel_clone(&msg_var);
9334         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9335         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9336         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9337 }
9338 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9339         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9340         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9341         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9342         LDKInitFeatures their_features_var = their_features;
9343         uint64_t their_features_ref = 0;
9344         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9345         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9346         LDKAcceptChannel msg_var = *msg;
9347         uint64_t msg_ref = 0;
9348         msg_var = AcceptChannel_clone(&msg_var);
9349         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9350         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9351         js_invoke_function_ubbuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9352 }
9353 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9354         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9355         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9356         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9357         LDKFundingCreated msg_var = *msg;
9358         uint64_t msg_ref = 0;
9359         msg_var = FundingCreated_clone(&msg_var);
9360         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9361         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9362         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9363 }
9364 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9365         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9366         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9367         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9368         LDKFundingSigned msg_var = *msg;
9369         uint64_t msg_ref = 0;
9370         msg_var = FundingSigned_clone(&msg_var);
9371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9372         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9373         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9374 }
9375 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9376         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9377         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9378         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9379         LDKChannelReady msg_var = *msg;
9380         uint64_t msg_ref = 0;
9381         msg_var = ChannelReady_clone(&msg_var);
9382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9383         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9384         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9385 }
9386 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9387         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9388         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9389         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9390         LDKInitFeatures their_features_var = *their_features;
9391         uint64_t their_features_ref = 0;
9392         their_features_var = InitFeatures_clone(&their_features_var);
9393         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9394         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9395         LDKShutdown msg_var = *msg;
9396         uint64_t msg_ref = 0;
9397         msg_var = Shutdown_clone(&msg_var);
9398         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9399         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9400         js_invoke_function_ubbuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9401 }
9402 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9403         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9404         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9405         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9406         LDKClosingSigned msg_var = *msg;
9407         uint64_t msg_ref = 0;
9408         msg_var = ClosingSigned_clone(&msg_var);
9409         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9410         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9411         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9412 }
9413 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9414         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9415         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9416         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9417         LDKUpdateAddHTLC msg_var = *msg;
9418         uint64_t msg_ref = 0;
9419         msg_var = UpdateAddHTLC_clone(&msg_var);
9420         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9421         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9422         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9423 }
9424 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9425         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9426         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9427         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9428         LDKUpdateFulfillHTLC msg_var = *msg;
9429         uint64_t msg_ref = 0;
9430         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9431         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9432         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9433         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9434 }
9435 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9436         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9437         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9438         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9439         LDKUpdateFailHTLC msg_var = *msg;
9440         uint64_t msg_ref = 0;
9441         msg_var = UpdateFailHTLC_clone(&msg_var);
9442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9443         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9444         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9445 }
9446 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9447         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9448         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9449         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9450         LDKUpdateFailMalformedHTLC msg_var = *msg;
9451         uint64_t msg_ref = 0;
9452         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9453         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9454         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9455         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9456 }
9457 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9458         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9459         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9460         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9461         LDKCommitmentSigned msg_var = *msg;
9462         uint64_t msg_ref = 0;
9463         msg_var = CommitmentSigned_clone(&msg_var);
9464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9465         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9466         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9467 }
9468 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9469         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9470         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9471         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9472         LDKRevokeAndACK msg_var = *msg;
9473         uint64_t msg_ref = 0;
9474         msg_var = RevokeAndACK_clone(&msg_var);
9475         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9476         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9477         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9478 }
9479 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9480         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9481         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9482         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9483         LDKUpdateFee msg_var = *msg;
9484         uint64_t msg_ref = 0;
9485         msg_var = UpdateFee_clone(&msg_var);
9486         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9487         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9488         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9489 }
9490 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9491         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9492         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9493         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9494         LDKAnnouncementSignatures msg_var = *msg;
9495         uint64_t msg_ref = 0;
9496         msg_var = AnnouncementSignatures_clone(&msg_var);
9497         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9498         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9499         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9500 }
9501 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9502         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9503         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9504         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9505         jboolean no_connection_possible_conv = no_connection_possible;
9506         js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9507 }
9508 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9509         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9510         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9511         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9512         LDKInit msg_var = *msg;
9513         uint64_t msg_ref = 0;
9514         msg_var = Init_clone(&msg_var);
9515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9516         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9517         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9518         void* ret_ptr = untag_ptr(ret);
9519         CHECK_ACCESS(ret_ptr);
9520         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9521         FREE(untag_ptr(ret));
9522         return ret_conv;
9523 }
9524 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9525         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9526         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9527         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9528         LDKChannelReestablish msg_var = *msg;
9529         uint64_t msg_ref = 0;
9530         msg_var = ChannelReestablish_clone(&msg_var);
9531         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9532         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9533         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9534 }
9535 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9536         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9537         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9538         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9539         LDKChannelUpdate msg_var = *msg;
9540         uint64_t msg_ref = 0;
9541         msg_var = ChannelUpdate_clone(&msg_var);
9542         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9543         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9544         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9545 }
9546 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9547         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9548         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9549         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9550         LDKErrorMessage msg_var = *msg;
9551         uint64_t msg_ref = 0;
9552         msg_var = ErrorMessage_clone(&msg_var);
9553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9554         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9555         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9556 }
9557 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9558         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9559         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, 0, 0, 0, 0, 0, 0);
9560         LDKNodeFeatures ret_conv;
9561         ret_conv.inner = untag_ptr(ret);
9562         ret_conv.is_owned = ptr_is_owned(ret);
9563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9564         return ret_conv;
9565 }
9566 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9567         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9568         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9569         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9570         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9571         LDKInitFeatures ret_conv;
9572         ret_conv.inner = untag_ptr(ret);
9573         ret_conv.is_owned = ptr_is_owned(ret);
9574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9575         return ret_conv;
9576 }
9577 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9578         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9580         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9581 }
9582 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9583         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9584         atomic_init(&calls->refcnt, 1);
9585         calls->instance_ptr = o;
9586
9587         LDKChannelMessageHandler ret = {
9588                 .this_arg = (void*) calls,
9589                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9590                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9591                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9592                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9593                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9594                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9595                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9596                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9597                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9598                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9599                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9600                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9601                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9602                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9603                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9604                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9605                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9606                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9607                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9608                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9609                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9610                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9611                 .free = LDKChannelMessageHandler_JCalls_free,
9612                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9613         };
9614         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9615         return ret;
9616 }
9617 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9618         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9619         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9620         return tag_ptr(res_ptr, true);
9621 }
9622 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) {
9623         void* this_arg_ptr = untag_ptr(this_arg);
9624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9625         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9626         LDKPublicKey their_node_id_ref;
9627         CHECK(their_node_id->arr_len == 33);
9628         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9629         LDKInitFeatures their_features_conv;
9630         their_features_conv.inner = untag_ptr(their_features);
9631         their_features_conv.is_owned = ptr_is_owned(their_features);
9632         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9633         their_features_conv = InitFeatures_clone(&their_features_conv);
9634         LDKOpenChannel msg_conv;
9635         msg_conv.inner = untag_ptr(msg);
9636         msg_conv.is_owned = ptr_is_owned(msg);
9637         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9638         msg_conv.is_owned = false;
9639         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9640 }
9641
9642 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) {
9643         void* this_arg_ptr = untag_ptr(this_arg);
9644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9645         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9646         LDKPublicKey their_node_id_ref;
9647         CHECK(their_node_id->arr_len == 33);
9648         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9649         LDKInitFeatures their_features_conv;
9650         their_features_conv.inner = untag_ptr(their_features);
9651         their_features_conv.is_owned = ptr_is_owned(their_features);
9652         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9653         their_features_conv = InitFeatures_clone(&their_features_conv);
9654         LDKAcceptChannel msg_conv;
9655         msg_conv.inner = untag_ptr(msg);
9656         msg_conv.is_owned = ptr_is_owned(msg);
9657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9658         msg_conv.is_owned = false;
9659         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9660 }
9661
9662 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) {
9663         void* this_arg_ptr = untag_ptr(this_arg);
9664         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9665         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9666         LDKPublicKey their_node_id_ref;
9667         CHECK(their_node_id->arr_len == 33);
9668         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9669         LDKFundingCreated msg_conv;
9670         msg_conv.inner = untag_ptr(msg);
9671         msg_conv.is_owned = ptr_is_owned(msg);
9672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9673         msg_conv.is_owned = false;
9674         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9675 }
9676
9677 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) {
9678         void* this_arg_ptr = untag_ptr(this_arg);
9679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9680         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9681         LDKPublicKey their_node_id_ref;
9682         CHECK(their_node_id->arr_len == 33);
9683         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9684         LDKFundingSigned msg_conv;
9685         msg_conv.inner = untag_ptr(msg);
9686         msg_conv.is_owned = ptr_is_owned(msg);
9687         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9688         msg_conv.is_owned = false;
9689         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9690 }
9691
9692 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) {
9693         void* this_arg_ptr = untag_ptr(this_arg);
9694         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9695         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9696         LDKPublicKey their_node_id_ref;
9697         CHECK(their_node_id->arr_len == 33);
9698         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9699         LDKChannelReady msg_conv;
9700         msg_conv.inner = untag_ptr(msg);
9701         msg_conv.is_owned = ptr_is_owned(msg);
9702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9703         msg_conv.is_owned = false;
9704         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9705 }
9706
9707 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) {
9708         void* this_arg_ptr = untag_ptr(this_arg);
9709         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9710         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9711         LDKPublicKey their_node_id_ref;
9712         CHECK(their_node_id->arr_len == 33);
9713         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9714         LDKInitFeatures their_features_conv;
9715         their_features_conv.inner = untag_ptr(their_features);
9716         their_features_conv.is_owned = ptr_is_owned(their_features);
9717         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9718         their_features_conv.is_owned = false;
9719         LDKShutdown msg_conv;
9720         msg_conv.inner = untag_ptr(msg);
9721         msg_conv.is_owned = ptr_is_owned(msg);
9722         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9723         msg_conv.is_owned = false;
9724         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9725 }
9726
9727 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) {
9728         void* this_arg_ptr = untag_ptr(this_arg);
9729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9730         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9731         LDKPublicKey their_node_id_ref;
9732         CHECK(their_node_id->arr_len == 33);
9733         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9734         LDKClosingSigned msg_conv;
9735         msg_conv.inner = untag_ptr(msg);
9736         msg_conv.is_owned = ptr_is_owned(msg);
9737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9738         msg_conv.is_owned = false;
9739         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9740 }
9741
9742 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) {
9743         void* this_arg_ptr = untag_ptr(this_arg);
9744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9745         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9746         LDKPublicKey their_node_id_ref;
9747         CHECK(their_node_id->arr_len == 33);
9748         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9749         LDKUpdateAddHTLC msg_conv;
9750         msg_conv.inner = untag_ptr(msg);
9751         msg_conv.is_owned = ptr_is_owned(msg);
9752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9753         msg_conv.is_owned = false;
9754         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9755 }
9756
9757 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) {
9758         void* this_arg_ptr = untag_ptr(this_arg);
9759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9760         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9761         LDKPublicKey their_node_id_ref;
9762         CHECK(their_node_id->arr_len == 33);
9763         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9764         LDKUpdateFulfillHTLC msg_conv;
9765         msg_conv.inner = untag_ptr(msg);
9766         msg_conv.is_owned = ptr_is_owned(msg);
9767         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9768         msg_conv.is_owned = false;
9769         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9770 }
9771
9772 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) {
9773         void* this_arg_ptr = untag_ptr(this_arg);
9774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9775         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9776         LDKPublicKey their_node_id_ref;
9777         CHECK(their_node_id->arr_len == 33);
9778         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9779         LDKUpdateFailHTLC msg_conv;
9780         msg_conv.inner = untag_ptr(msg);
9781         msg_conv.is_owned = ptr_is_owned(msg);
9782         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9783         msg_conv.is_owned = false;
9784         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9785 }
9786
9787 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) {
9788         void* this_arg_ptr = untag_ptr(this_arg);
9789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9790         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9791         LDKPublicKey their_node_id_ref;
9792         CHECK(their_node_id->arr_len == 33);
9793         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9794         LDKUpdateFailMalformedHTLC msg_conv;
9795         msg_conv.inner = untag_ptr(msg);
9796         msg_conv.is_owned = ptr_is_owned(msg);
9797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9798         msg_conv.is_owned = false;
9799         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9800 }
9801
9802 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) {
9803         void* this_arg_ptr = untag_ptr(this_arg);
9804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9805         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9806         LDKPublicKey their_node_id_ref;
9807         CHECK(their_node_id->arr_len == 33);
9808         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9809         LDKCommitmentSigned msg_conv;
9810         msg_conv.inner = untag_ptr(msg);
9811         msg_conv.is_owned = ptr_is_owned(msg);
9812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9813         msg_conv.is_owned = false;
9814         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9815 }
9816
9817 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) {
9818         void* this_arg_ptr = untag_ptr(this_arg);
9819         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9820         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9821         LDKPublicKey their_node_id_ref;
9822         CHECK(their_node_id->arr_len == 33);
9823         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9824         LDKRevokeAndACK msg_conv;
9825         msg_conv.inner = untag_ptr(msg);
9826         msg_conv.is_owned = ptr_is_owned(msg);
9827         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9828         msg_conv.is_owned = false;
9829         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9830 }
9831
9832 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) {
9833         void* this_arg_ptr = untag_ptr(this_arg);
9834         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9835         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9836         LDKPublicKey their_node_id_ref;
9837         CHECK(their_node_id->arr_len == 33);
9838         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9839         LDKUpdateFee msg_conv;
9840         msg_conv.inner = untag_ptr(msg);
9841         msg_conv.is_owned = ptr_is_owned(msg);
9842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9843         msg_conv.is_owned = false;
9844         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9845 }
9846
9847 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) {
9848         void* this_arg_ptr = untag_ptr(this_arg);
9849         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9850         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9851         LDKPublicKey their_node_id_ref;
9852         CHECK(their_node_id->arr_len == 33);
9853         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9854         LDKAnnouncementSignatures msg_conv;
9855         msg_conv.inner = untag_ptr(msg);
9856         msg_conv.is_owned = ptr_is_owned(msg);
9857         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9858         msg_conv.is_owned = false;
9859         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9860 }
9861
9862 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) {
9863         void* this_arg_ptr = untag_ptr(this_arg);
9864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9865         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9866         LDKPublicKey their_node_id_ref;
9867         CHECK(their_node_id->arr_len == 33);
9868         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9869         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9870 }
9871
9872 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) {
9873         void* this_arg_ptr = untag_ptr(this_arg);
9874         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9875         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9876         LDKPublicKey their_node_id_ref;
9877         CHECK(their_node_id->arr_len == 33);
9878         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9879         LDKInit msg_conv;
9880         msg_conv.inner = untag_ptr(msg);
9881         msg_conv.is_owned = ptr_is_owned(msg);
9882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9883         msg_conv.is_owned = false;
9884         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9885         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9886         return tag_ptr(ret_conv, true);
9887 }
9888
9889 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) {
9890         void* this_arg_ptr = untag_ptr(this_arg);
9891         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9892         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9893         LDKPublicKey their_node_id_ref;
9894         CHECK(their_node_id->arr_len == 33);
9895         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9896         LDKChannelReestablish msg_conv;
9897         msg_conv.inner = untag_ptr(msg);
9898         msg_conv.is_owned = ptr_is_owned(msg);
9899         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9900         msg_conv.is_owned = false;
9901         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9902 }
9903
9904 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) {
9905         void* this_arg_ptr = untag_ptr(this_arg);
9906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9907         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9908         LDKPublicKey their_node_id_ref;
9909         CHECK(their_node_id->arr_len == 33);
9910         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9911         LDKChannelUpdate msg_conv;
9912         msg_conv.inner = untag_ptr(msg);
9913         msg_conv.is_owned = ptr_is_owned(msg);
9914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9915         msg_conv.is_owned = false;
9916         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9917 }
9918
9919 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9920         void* this_arg_ptr = untag_ptr(this_arg);
9921         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9922         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9923         LDKPublicKey their_node_id_ref;
9924         CHECK(their_node_id->arr_len == 33);
9925         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9926         LDKErrorMessage msg_conv;
9927         msg_conv.inner = untag_ptr(msg);
9928         msg_conv.is_owned = ptr_is_owned(msg);
9929         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9930         msg_conv.is_owned = false;
9931         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9932 }
9933
9934 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9935         void* this_arg_ptr = untag_ptr(this_arg);
9936         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9937         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9938         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9939         uint64_t ret_ref = 0;
9940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9942         return ret_ref;
9943 }
9944
9945 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9946         void* this_arg_ptr = untag_ptr(this_arg);
9947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9948         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9949         LDKPublicKey their_node_id_ref;
9950         CHECK(their_node_id->arr_len == 33);
9951         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9952         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9953         uint64_t ret_ref = 0;
9954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9956         return ret_ref;
9957 }
9958
9959 typedef struct LDKRoutingMessageHandler_JCalls {
9960         atomic_size_t refcnt;
9961         uint32_t instance_ptr;
9962         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9963 } LDKRoutingMessageHandler_JCalls;
9964 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9965         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9966         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9967                 FREE(j_calls);
9968         }
9969 }
9970 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9971         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9972         LDKNodeAnnouncement msg_var = *msg;
9973         uint64_t msg_ref = 0;
9974         msg_var = NodeAnnouncement_clone(&msg_var);
9975         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9976         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9977         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0);
9978         void* ret_ptr = untag_ptr(ret);
9979         CHECK_ACCESS(ret_ptr);
9980         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9981         FREE(untag_ptr(ret));
9982         return ret_conv;
9983 }
9984 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9985         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9986         LDKChannelAnnouncement msg_var = *msg;
9987         uint64_t msg_ref = 0;
9988         msg_var = ChannelAnnouncement_clone(&msg_var);
9989         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9990         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9991         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
9992         void* ret_ptr = untag_ptr(ret);
9993         CHECK_ACCESS(ret_ptr);
9994         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9995         FREE(untag_ptr(ret));
9996         return ret_conv;
9997 }
9998 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9999         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10000         LDKChannelUpdate msg_var = *msg;
10001         uint64_t msg_ref = 0;
10002         msg_var = ChannelUpdate_clone(&msg_var);
10003         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10004         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10005         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10006         void* ret_ptr = untag_ptr(ret);
10007         CHECK_ACCESS(ret_ptr);
10008         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10009         FREE(untag_ptr(ret));
10010         return ret_conv;
10011 }
10012 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10013         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10014         int64_t starting_point_conv = starting_point;
10015         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, starting_point_conv, 0, 0, 0, 0, 0);
10016         void* ret_ptr = untag_ptr(ret);
10017         CHECK_ACCESS(ret_ptr);
10018         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10019         FREE(untag_ptr(ret));
10020         return ret_conv;
10021 }
10022 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
10023         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10024         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
10025         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
10026         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 91, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
10027         LDKNodeAnnouncement ret_conv;
10028         ret_conv.inner = untag_ptr(ret);
10029         ret_conv.is_owned = ptr_is_owned(ret);
10030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10031         return ret_conv;
10032 }
10033 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10034         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10035         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10036         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10037         LDKInit init_var = *init;
10038         uint64_t init_ref = 0;
10039         init_var = Init_clone(&init_var);
10040         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10041         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10042         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10043         void* ret_ptr = untag_ptr(ret);
10044         CHECK_ACCESS(ret_ptr);
10045         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10046         FREE(untag_ptr(ret));
10047         return ret_conv;
10048 }
10049 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10050         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10051         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10052         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10053         LDKReplyChannelRange msg_var = msg;
10054         uint64_t msg_ref = 0;
10055         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10056         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10057         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10058         void* ret_ptr = untag_ptr(ret);
10059         CHECK_ACCESS(ret_ptr);
10060         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10061         FREE(untag_ptr(ret));
10062         return ret_conv;
10063 }
10064 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10065         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10066         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10067         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10068         LDKReplyShortChannelIdsEnd msg_var = msg;
10069         uint64_t msg_ref = 0;
10070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10071         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10072         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10073         void* ret_ptr = untag_ptr(ret);
10074         CHECK_ACCESS(ret_ptr);
10075         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10076         FREE(untag_ptr(ret));
10077         return ret_conv;
10078 }
10079 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10080         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10081         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10082         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10083         LDKQueryChannelRange msg_var = msg;
10084         uint64_t msg_ref = 0;
10085         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10086         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10087         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10088         void* ret_ptr = untag_ptr(ret);
10089         CHECK_ACCESS(ret_ptr);
10090         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10091         FREE(untag_ptr(ret));
10092         return ret_conv;
10093 }
10094 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10095         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10096         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10097         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10098         LDKQueryShortChannelIds msg_var = msg;
10099         uint64_t msg_ref = 0;
10100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10101         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10102         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10103         void* ret_ptr = untag_ptr(ret);
10104         CHECK_ACCESS(ret_ptr);
10105         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10106         FREE(untag_ptr(ret));
10107         return ret_conv;
10108 }
10109 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10110         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10111         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, 0, 0, 0, 0, 0, 0);
10112         LDKNodeFeatures ret_conv;
10113         ret_conv.inner = untag_ptr(ret);
10114         ret_conv.is_owned = ptr_is_owned(ret);
10115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10116         return ret_conv;
10117 }
10118 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10119         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10120         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10121         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10122         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10123         LDKInitFeatures ret_conv;
10124         ret_conv.inner = untag_ptr(ret);
10125         ret_conv.is_owned = ptr_is_owned(ret);
10126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10127         return ret_conv;
10128 }
10129 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10130         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10132         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10133 }
10134 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10135         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10136         atomic_init(&calls->refcnt, 1);
10137         calls->instance_ptr = o;
10138
10139         LDKRoutingMessageHandler ret = {
10140                 .this_arg = (void*) calls,
10141                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10142                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10143                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10144                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10145                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10146                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10147                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10148                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10149                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10150                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10151                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10152                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10153                 .free = LDKRoutingMessageHandler_JCalls_free,
10154                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10155         };
10156         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10157         return ret;
10158 }
10159 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10160         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10161         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10162         return tag_ptr(res_ptr, true);
10163 }
10164 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10165         void* this_arg_ptr = untag_ptr(this_arg);
10166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10167         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10168         LDKNodeAnnouncement msg_conv;
10169         msg_conv.inner = untag_ptr(msg);
10170         msg_conv.is_owned = ptr_is_owned(msg);
10171         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10172         msg_conv.is_owned = false;
10173         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10174         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10175         return tag_ptr(ret_conv, true);
10176 }
10177
10178 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10179         void* this_arg_ptr = untag_ptr(this_arg);
10180         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10181         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10182         LDKChannelAnnouncement msg_conv;
10183         msg_conv.inner = untag_ptr(msg);
10184         msg_conv.is_owned = ptr_is_owned(msg);
10185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10186         msg_conv.is_owned = false;
10187         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10188         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10189         return tag_ptr(ret_conv, true);
10190 }
10191
10192 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10193         void* this_arg_ptr = untag_ptr(this_arg);
10194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10195         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10196         LDKChannelUpdate msg_conv;
10197         msg_conv.inner = untag_ptr(msg);
10198         msg_conv.is_owned = ptr_is_owned(msg);
10199         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10200         msg_conv.is_owned = false;
10201         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10202         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10203         return tag_ptr(ret_conv, true);
10204 }
10205
10206 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) {
10207         void* this_arg_ptr = untag_ptr(this_arg);
10208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10209         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10210         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10211         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10212         uint64_t ret_ref = tag_ptr(ret_copy, true);
10213         return ret_ref;
10214 }
10215
10216 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) {
10217         void* this_arg_ptr = untag_ptr(this_arg);
10218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10219         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10220         LDKPublicKey starting_point_ref;
10221         CHECK(starting_point->arr_len == 33);
10222         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10223         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
10224         uint64_t ret_ref = 0;
10225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10227         return ret_ref;
10228 }
10229
10230 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) {
10231         void* this_arg_ptr = untag_ptr(this_arg);
10232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10233         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10234         LDKPublicKey their_node_id_ref;
10235         CHECK(their_node_id->arr_len == 33);
10236         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10237         LDKInit init_conv;
10238         init_conv.inner = untag_ptr(init);
10239         init_conv.is_owned = ptr_is_owned(init);
10240         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10241         init_conv.is_owned = false;
10242         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10243         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10244         return tag_ptr(ret_conv, true);
10245 }
10246
10247 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) {
10248         void* this_arg_ptr = untag_ptr(this_arg);
10249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10250         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10251         LDKPublicKey their_node_id_ref;
10252         CHECK(their_node_id->arr_len == 33);
10253         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10254         LDKReplyChannelRange msg_conv;
10255         msg_conv.inner = untag_ptr(msg);
10256         msg_conv.is_owned = ptr_is_owned(msg);
10257         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10258         msg_conv = ReplyChannelRange_clone(&msg_conv);
10259         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10260         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10261         return tag_ptr(ret_conv, true);
10262 }
10263
10264 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) {
10265         void* this_arg_ptr = untag_ptr(this_arg);
10266         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10267         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10268         LDKPublicKey their_node_id_ref;
10269         CHECK(their_node_id->arr_len == 33);
10270         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10271         LDKReplyShortChannelIdsEnd msg_conv;
10272         msg_conv.inner = untag_ptr(msg);
10273         msg_conv.is_owned = ptr_is_owned(msg);
10274         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10275         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10276         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10277         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10278         return tag_ptr(ret_conv, true);
10279 }
10280
10281 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) {
10282         void* this_arg_ptr = untag_ptr(this_arg);
10283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10284         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10285         LDKPublicKey their_node_id_ref;
10286         CHECK(their_node_id->arr_len == 33);
10287         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10288         LDKQueryChannelRange msg_conv;
10289         msg_conv.inner = untag_ptr(msg);
10290         msg_conv.is_owned = ptr_is_owned(msg);
10291         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10292         msg_conv = QueryChannelRange_clone(&msg_conv);
10293         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10294         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10295         return tag_ptr(ret_conv, true);
10296 }
10297
10298 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) {
10299         void* this_arg_ptr = untag_ptr(this_arg);
10300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10301         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10302         LDKPublicKey their_node_id_ref;
10303         CHECK(their_node_id->arr_len == 33);
10304         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10305         LDKQueryShortChannelIds msg_conv;
10306         msg_conv.inner = untag_ptr(msg);
10307         msg_conv.is_owned = ptr_is_owned(msg);
10308         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10309         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10310         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10311         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10312         return tag_ptr(ret_conv, true);
10313 }
10314
10315 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10316         void* this_arg_ptr = untag_ptr(this_arg);
10317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10318         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10319         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10320         uint64_t ret_ref = 0;
10321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10323         return ret_ref;
10324 }
10325
10326 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10327         void* this_arg_ptr = untag_ptr(this_arg);
10328         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10329         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10330         LDKPublicKey their_node_id_ref;
10331         CHECK(their_node_id->arr_len == 33);
10332         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10333         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10334         uint64_t ret_ref = 0;
10335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10337         return ret_ref;
10338 }
10339
10340 typedef struct LDKOnionMessageHandler_JCalls {
10341         atomic_size_t refcnt;
10342         uint32_t instance_ptr;
10343         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10344 } LDKOnionMessageHandler_JCalls;
10345 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10346         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10347         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10348                 FREE(j_calls);
10349         }
10350 }
10351 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10352         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10353         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10354         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10355         LDKOnionMessage msg_var = *msg;
10356         uint64_t msg_ref = 0;
10357         msg_var = OnionMessage_clone(&msg_var);
10358         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10359         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10360         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10361 }
10362 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10363         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10364         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10365         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10366         LDKInit init_var = *init;
10367         uint64_t init_ref = 0;
10368         init_var = Init_clone(&init_var);
10369         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10370         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10371         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10372         void* ret_ptr = untag_ptr(ret);
10373         CHECK_ACCESS(ret_ptr);
10374         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10375         FREE(untag_ptr(ret));
10376         return ret_conv;
10377 }
10378 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10379         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10380         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10381         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10382         jboolean no_connection_possible_conv = no_connection_possible;
10383         js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10384 }
10385 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10386         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10387         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, 0, 0, 0, 0, 0, 0);
10388         LDKNodeFeatures ret_conv;
10389         ret_conv.inner = untag_ptr(ret);
10390         ret_conv.is_owned = ptr_is_owned(ret);
10391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10392         return ret_conv;
10393 }
10394 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10395         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10396         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10397         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10398         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10399         LDKInitFeatures ret_conv;
10400         ret_conv.inner = untag_ptr(ret);
10401         ret_conv.is_owned = ptr_is_owned(ret);
10402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10403         return ret_conv;
10404 }
10405 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10406         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10407         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10408         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10409 }
10410 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10411         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10412         atomic_init(&calls->refcnt, 1);
10413         calls->instance_ptr = o;
10414
10415         LDKOnionMessageHandler ret = {
10416                 .this_arg = (void*) calls,
10417                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10418                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10419                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10420                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10421                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10422                 .free = LDKOnionMessageHandler_JCalls_free,
10423                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10424         };
10425         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10426         return ret;
10427 }
10428 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10429         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10430         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10431         return tag_ptr(res_ptr, true);
10432 }
10433 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) {
10434         void* this_arg_ptr = untag_ptr(this_arg);
10435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10436         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10437         LDKPublicKey peer_node_id_ref;
10438         CHECK(peer_node_id->arr_len == 33);
10439         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10440         LDKOnionMessage msg_conv;
10441         msg_conv.inner = untag_ptr(msg);
10442         msg_conv.is_owned = ptr_is_owned(msg);
10443         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10444         msg_conv.is_owned = false;
10445         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10446 }
10447
10448 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) {
10449         void* this_arg_ptr = untag_ptr(this_arg);
10450         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10451         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10452         LDKPublicKey their_node_id_ref;
10453         CHECK(their_node_id->arr_len == 33);
10454         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10455         LDKInit init_conv;
10456         init_conv.inner = untag_ptr(init);
10457         init_conv.is_owned = ptr_is_owned(init);
10458         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10459         init_conv.is_owned = false;
10460         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10461         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10462         return tag_ptr(ret_conv, true);
10463 }
10464
10465 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) {
10466         void* this_arg_ptr = untag_ptr(this_arg);
10467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10468         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10469         LDKPublicKey their_node_id_ref;
10470         CHECK(their_node_id->arr_len == 33);
10471         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10472         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10473 }
10474
10475 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10476         void* this_arg_ptr = untag_ptr(this_arg);
10477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10478         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10479         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10480         uint64_t ret_ref = 0;
10481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10483         return ret_ref;
10484 }
10485
10486 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10487         void* this_arg_ptr = untag_ptr(this_arg);
10488         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10489         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10490         LDKPublicKey their_node_id_ref;
10491         CHECK(their_node_id->arr_len == 33);
10492         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10493         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10494         uint64_t ret_ref = 0;
10495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10497         return ret_ref;
10498 }
10499
10500 typedef struct LDKCustomMessageReader_JCalls {
10501         atomic_size_t refcnt;
10502         uint32_t instance_ptr;
10503 } LDKCustomMessageReader_JCalls;
10504 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10505         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10506         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10507                 FREE(j_calls);
10508         }
10509 }
10510 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10511         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10512         int16_t message_type_conv = message_type;
10513         LDKu8slice buffer_var = buffer;
10514         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10515         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10516         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10517         void* ret_ptr = untag_ptr(ret);
10518         CHECK_ACCESS(ret_ptr);
10519         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10520         FREE(untag_ptr(ret));
10521         return ret_conv;
10522 }
10523 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10524         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10525         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10526 }
10527 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10528         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10529         atomic_init(&calls->refcnt, 1);
10530         calls->instance_ptr = o;
10531
10532         LDKCustomMessageReader ret = {
10533                 .this_arg = (void*) calls,
10534                 .read = read_LDKCustomMessageReader_jcall,
10535                 .free = LDKCustomMessageReader_JCalls_free,
10536         };
10537         return ret;
10538 }
10539 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10540         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10541         *res_ptr = LDKCustomMessageReader_init(o);
10542         return tag_ptr(res_ptr, true);
10543 }
10544 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10545         void* this_arg_ptr = untag_ptr(this_arg);
10546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10547         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10548         LDKu8slice buffer_ref;
10549         buffer_ref.datalen = buffer->arr_len;
10550         buffer_ref.data = buffer->elems;
10551         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10552         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10553         FREE(buffer);
10554         return tag_ptr(ret_conv, true);
10555 }
10556
10557 typedef struct LDKCustomMessageHandler_JCalls {
10558         atomic_size_t refcnt;
10559         uint32_t instance_ptr;
10560         LDKCustomMessageReader_JCalls* CustomMessageReader;
10561 } LDKCustomMessageHandler_JCalls;
10562 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10563         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10564         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10565                 FREE(j_calls);
10566         }
10567 }
10568 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10569         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10570         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10571         *msg_ret = msg;
10572         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10573         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10574         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 105, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
10575         void* ret_ptr = untag_ptr(ret);
10576         CHECK_ACCESS(ret_ptr);
10577         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10578         FREE(untag_ptr(ret));
10579         return ret_conv;
10580 }
10581 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10582         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10583         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
10584         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10585         ret_constr.datalen = ret->arr_len;
10586         if (ret_constr.datalen > 0)
10587                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10588         else
10589                 ret_constr.data = NULL;
10590         uint64_t* ret_vals = ret->elems;
10591         for (size_t z = 0; z < ret_constr.datalen; z++) {
10592                 uint64_t ret_conv_25 = ret_vals[z];
10593                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10594                 CHECK_ACCESS(ret_conv_25_ptr);
10595                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10596                 FREE(untag_ptr(ret_conv_25));
10597                 ret_constr.data[z] = ret_conv_25_conv;
10598         }
10599         FREE(ret);
10600         return ret_constr;
10601 }
10602 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10603         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10604         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10605         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10606 }
10607 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10608         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10609         atomic_init(&calls->refcnt, 1);
10610         calls->instance_ptr = o;
10611
10612         LDKCustomMessageHandler ret = {
10613                 .this_arg = (void*) calls,
10614                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10615                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10616                 .free = LDKCustomMessageHandler_JCalls_free,
10617                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10618         };
10619         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10620         return ret;
10621 }
10622 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10623         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10624         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10625         return tag_ptr(res_ptr, true);
10626 }
10627 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) {
10628         void* this_arg_ptr = untag_ptr(this_arg);
10629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10630         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10631         void* msg_ptr = untag_ptr(msg);
10632         CHECK_ACCESS(msg_ptr);
10633         LDKType msg_conv = *(LDKType*)(msg_ptr);
10634         if (msg_conv.free == LDKType_JCalls_free) {
10635                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10636                 LDKType_JCalls_cloned(&msg_conv);
10637         }
10638         LDKPublicKey sender_node_id_ref;
10639         CHECK(sender_node_id->arr_len == 33);
10640         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10641         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10642         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10643         return tag_ptr(ret_conv, true);
10644 }
10645
10646 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10647         void* this_arg_ptr = untag_ptr(this_arg);
10648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10649         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10650         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10651         uint64_tArray ret_arr = NULL;
10652         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10653         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10654         for (size_t z = 0; z < ret_var.datalen; z++) {
10655                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10656                 *ret_conv_25_conv = ret_var.data[z];
10657                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10658         }
10659         
10660         FREE(ret_var.data);
10661         return ret_arr;
10662 }
10663
10664 typedef struct LDKCustomOnionMessageHandler_JCalls {
10665         atomic_size_t refcnt;
10666         uint32_t instance_ptr;
10667 } LDKCustomOnionMessageHandler_JCalls;
10668 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
10669         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10670         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10671                 FREE(j_calls);
10672         }
10673 }
10674 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
10675         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10676         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
10677         *msg_ret = msg;
10678         js_invoke_function_buuuuu(j_calls->instance_ptr, 107, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
10679 }
10680 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
10681         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10682         int64_t message_type_conv = message_type;
10683         LDKu8slice buffer_var = buffer;
10684         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10685         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10686         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10687         void* ret_ptr = untag_ptr(ret);
10688         CHECK_ACCESS(ret_ptr);
10689         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
10690         FREE(untag_ptr(ret));
10691         return ret_conv;
10692 }
10693 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
10694         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
10695         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10696 }
10697 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
10698         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
10699         atomic_init(&calls->refcnt, 1);
10700         calls->instance_ptr = o;
10701
10702         LDKCustomOnionMessageHandler ret = {
10703                 .this_arg = (void*) calls,
10704                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
10705                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
10706                 .free = LDKCustomOnionMessageHandler_JCalls_free,
10707         };
10708         return ret;
10709 }
10710 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
10711         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
10712         *res_ptr = LDKCustomOnionMessageHandler_init(o);
10713         return tag_ptr(res_ptr, true);
10714 }
10715 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
10716         void* this_arg_ptr = untag_ptr(this_arg);
10717         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10718         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10719         void* msg_ptr = untag_ptr(msg);
10720         CHECK_ACCESS(msg_ptr);
10721         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
10722         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
10723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10724                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
10725         }
10726         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
10727 }
10728
10729 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) {
10730         void* this_arg_ptr = untag_ptr(this_arg);
10731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10732         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10733         LDKu8slice buffer_ref;
10734         buffer_ref.datalen = buffer->arr_len;
10735         buffer_ref.data = buffer->elems;
10736         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
10737         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
10738         FREE(buffer);
10739         return tag_ptr(ret_conv, true);
10740 }
10741
10742 typedef struct LDKSocketDescriptor_JCalls {
10743         atomic_size_t refcnt;
10744         uint32_t instance_ptr;
10745 } LDKSocketDescriptor_JCalls;
10746 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10747         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10748         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10749                 FREE(j_calls);
10750         }
10751 }
10752 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10753         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10754         LDKu8slice data_var = data;
10755         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10756         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10757         jboolean resume_read_conv = resume_read;
10758         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10759 }
10760 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10761         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10762         js_invoke_function_uuuuuu(j_calls->instance_ptr, 110, 0, 0, 0, 0, 0, 0);
10763 }
10764 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10765         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10766         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10767         *other_arg_clone = SocketDescriptor_clone(other_arg);
10768         return js_invoke_function_buuuuu(j_calls->instance_ptr, 111, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10769 }
10770 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10771         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10772         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
10773 }
10774 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10775         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10776         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10777 }
10778 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10779         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10780         atomic_init(&calls->refcnt, 1);
10781         calls->instance_ptr = o;
10782
10783         LDKSocketDescriptor ret = {
10784                 .this_arg = (void*) calls,
10785                 .send_data = send_data_LDKSocketDescriptor_jcall,
10786                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10787                 .eq = eq_LDKSocketDescriptor_jcall,
10788                 .hash = hash_LDKSocketDescriptor_jcall,
10789                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10790                 .free = LDKSocketDescriptor_JCalls_free,
10791         };
10792         return ret;
10793 }
10794 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10795         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10796         *res_ptr = LDKSocketDescriptor_init(o);
10797         return tag_ptr(res_ptr, true);
10798 }
10799 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10800         void* this_arg_ptr = untag_ptr(this_arg);
10801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10802         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10803         LDKu8slice data_ref;
10804         data_ref.datalen = data->arr_len;
10805         data_ref.data = data->elems;
10806         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10807         FREE(data);
10808         return ret_conv;
10809 }
10810
10811 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10812         void* this_arg_ptr = untag_ptr(this_arg);
10813         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10814         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10815         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10816 }
10817
10818 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10819         void* this_arg_ptr = untag_ptr(this_arg);
10820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10821         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10822         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10823         return ret_conv;
10824 }
10825
10826 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10827         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10828         switch(obj->tag) {
10829                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10830                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10831                 case LDKEffectiveCapacity_Total: return 2;
10832                 case LDKEffectiveCapacity_Infinite: return 3;
10833                 case LDKEffectiveCapacity_Unknown: return 4;
10834                 default: abort();
10835         }
10836 }
10837 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10838         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10839         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10840                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10841         return liquidity_msat_conv;
10842 }
10843 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10844         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10845         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10846                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10847         return amount_msat_conv;
10848 }
10849 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10850         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10851         assert(obj->tag == LDKEffectiveCapacity_Total);
10852                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10853         return capacity_msat_conv;
10854 }
10855 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10856         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10857         assert(obj->tag == LDKEffectiveCapacity_Total);
10858                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
10859         return htlc_maximum_msat_conv;
10860 }
10861 typedef struct LDKRouter_JCalls {
10862         atomic_size_t refcnt;
10863         uint32_t instance_ptr;
10864 } LDKRouter_JCalls;
10865 static void LDKRouter_JCalls_free(void* this_arg) {
10866         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10867         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10868                 FREE(j_calls);
10869         }
10870 }
10871 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10872         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10873         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10874         memcpy(payer_arr->elems, payer.compressed_form, 33);
10875         LDKRouteParameters route_params_var = *route_params;
10876         uint64_t route_params_ref = 0;
10877         route_params_var = RouteParameters_clone(&route_params_var);
10878         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10879         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10880         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10881         uint64_tArray first_hops_arr = NULL;
10882         if (first_hops != NULL) {
10883                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10884                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10885                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10886                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10887                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10888                         uint64_t first_hops_conv_16_ref = 0;
10889                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10890                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10891                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10892                 }
10893         
10894         }
10895         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10896         uint64_t inflight_htlcs_ref = 0;
10897         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10898         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10899         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 113, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
10900         void* ret_ptr = untag_ptr(ret);
10901         CHECK_ACCESS(ret_ptr);
10902         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10903         FREE(untag_ptr(ret));
10904         return ret_conv;
10905 }
10906 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
10907         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10908         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10909         memcpy(payer_arr->elems, payer.compressed_form, 33);
10910         LDKRouteParameters route_params_var = *route_params;
10911         uint64_t route_params_ref = 0;
10912         route_params_var = RouteParameters_clone(&route_params_var);
10913         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10914         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10915         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10916         uint64_tArray first_hops_arr = NULL;
10917         if (first_hops != NULL) {
10918                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10919                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10920                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10921                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10922                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10923                         uint64_t first_hops_conv_16_ref = 0;
10924                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10925                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10926                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10927                 }
10928         
10929         }
10930         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10931         uint64_t inflight_htlcs_ref = 0;
10932         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10933         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10934         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
10935         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
10936         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
10937         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
10938         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 114, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr);
10939         void* ret_ptr = untag_ptr(ret);
10940         CHECK_ACCESS(ret_ptr);
10941         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10942         FREE(untag_ptr(ret));
10943         return ret_conv;
10944 }
10945 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10946         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10947         LDKCVec_RouteHopZ path_var = path;
10948         uint64_tArray path_arr = NULL;
10949         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10950         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10951         for (size_t k = 0; k < path_var.datalen; k++) {
10952                 LDKRouteHop path_conv_10_var = path_var.data[k];
10953                 uint64_t path_conv_10_ref = 0;
10954                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10955                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10956                 path_arr_ptr[k] = path_conv_10_ref;
10957         }
10958         
10959         FREE(path_var.data);
10960         int64_t short_channel_id_conv = short_channel_id;
10961         js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10962 }
10963 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10964         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10965         LDKCVec_RouteHopZ path_var = path;
10966         uint64_tArray path_arr = NULL;
10967         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10968         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10969         for (size_t k = 0; k < path_var.datalen; k++) {
10970                 LDKRouteHop path_conv_10_var = path_var.data[k];
10971                 uint64_t path_conv_10_ref = 0;
10972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10973                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10974                 path_arr_ptr[k] = path_conv_10_ref;
10975         }
10976         
10977         FREE(path_var.data);
10978         js_invoke_function_uuuuuu(j_calls->instance_ptr, 116, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10979 }
10980 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10981         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10982         LDKCVec_RouteHopZ path_var = path;
10983         uint64_tArray path_arr = NULL;
10984         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10985         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10986         for (size_t k = 0; k < path_var.datalen; k++) {
10987                 LDKRouteHop path_conv_10_var = path_var.data[k];
10988                 uint64_t path_conv_10_ref = 0;
10989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10990                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10991                 path_arr_ptr[k] = path_conv_10_ref;
10992         }
10993         
10994         FREE(path_var.data);
10995         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10996 }
10997 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10998         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10999         LDKCVec_RouteHopZ path_var = path;
11000         uint64_tArray path_arr = NULL;
11001         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
11002         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
11003         for (size_t k = 0; k < path_var.datalen; k++) {
11004                 LDKRouteHop path_conv_10_var = path_var.data[k];
11005                 uint64_t path_conv_10_ref = 0;
11006                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
11007                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
11008                 path_arr_ptr[k] = path_conv_10_ref;
11009         }
11010         
11011         FREE(path_var.data);
11012         int64_t short_channel_id_conv = short_channel_id;
11013         js_invoke_function_ubuuuu(j_calls->instance_ptr, 118, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
11014 }
11015 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
11016         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
11017         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11018 }
11019 static inline LDKRouter LDKRouter_init (JSValue o) {
11020         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
11021         atomic_init(&calls->refcnt, 1);
11022         calls->instance_ptr = o;
11023
11024         LDKRouter ret = {
11025                 .this_arg = (void*) calls,
11026                 .find_route = find_route_LDKRouter_jcall,
11027                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
11028                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
11029                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
11030                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
11031                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
11032                 .free = LDKRouter_JCalls_free,
11033         };
11034         return ret;
11035 }
11036 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
11037         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
11038         *res_ptr = LDKRouter_init(o);
11039         return tag_ptr(res_ptr, true);
11040 }
11041 uint64_t  __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs) {
11042         void* this_arg_ptr = untag_ptr(this_arg);
11043         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11044         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11045         LDKPublicKey payer_ref;
11046         CHECK(payer->arr_len == 33);
11047         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11048         LDKRouteParameters route_params_conv;
11049         route_params_conv.inner = untag_ptr(route_params);
11050         route_params_conv.is_owned = ptr_is_owned(route_params);
11051         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11052         route_params_conv.is_owned = false;
11053         LDKCVec_ChannelDetailsZ first_hops_constr;
11054         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11055         if (first_hops != 0) {
11056                 first_hops_constr.datalen = first_hops->arr_len;
11057                 if (first_hops_constr.datalen > 0)
11058                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11059                 else
11060                         first_hops_constr.data = NULL;
11061                 uint64_t* first_hops_vals = first_hops->elems;
11062                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11063                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11064                         LDKChannelDetails first_hops_conv_16_conv;
11065                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11066                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11067                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11068                         first_hops_conv_16_conv.is_owned = false;
11069                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11070                 }
11071                 FREE(first_hops);
11072                 first_hops_ptr = &first_hops_constr;
11073         }
11074         LDKInFlightHtlcs inflight_htlcs_conv;
11075         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11076         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11077         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11078         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
11079         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11080         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
11081         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11082         return tag_ptr(ret_conv, true);
11083 }
11084
11085 uint64_t  __attribute__((export_name("TS_Router_find_route_with_id"))) TS_Router_find_route_with_id(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) {
11086         void* this_arg_ptr = untag_ptr(this_arg);
11087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11088         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11089         LDKPublicKey payer_ref;
11090         CHECK(payer->arr_len == 33);
11091         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11092         LDKRouteParameters route_params_conv;
11093         route_params_conv.inner = untag_ptr(route_params);
11094         route_params_conv.is_owned = ptr_is_owned(route_params);
11095         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11096         route_params_conv.is_owned = false;
11097         LDKCVec_ChannelDetailsZ first_hops_constr;
11098         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11099         if (first_hops != 0) {
11100                 first_hops_constr.datalen = first_hops->arr_len;
11101                 if (first_hops_constr.datalen > 0)
11102                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11103                 else
11104                         first_hops_constr.data = NULL;
11105                 uint64_t* first_hops_vals = first_hops->elems;
11106                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11107                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11108                         LDKChannelDetails first_hops_conv_16_conv;
11109                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11110                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11112                         first_hops_conv_16_conv.is_owned = false;
11113                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11114                 }
11115                 FREE(first_hops);
11116                 first_hops_ptr = &first_hops_constr;
11117         }
11118         LDKInFlightHtlcs inflight_htlcs_conv;
11119         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11120         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11121         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11122         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
11123         LDKThirtyTwoBytes _payment_hash_ref;
11124         CHECK(_payment_hash->arr_len == 32);
11125         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
11126         LDKThirtyTwoBytes _payment_id_ref;
11127         CHECK(_payment_id->arr_len == 32);
11128         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
11129         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11130         *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref);
11131         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11132         return tag_ptr(ret_conv, true);
11133 }
11134
11135 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) {
11136         void* this_arg_ptr = untag_ptr(this_arg);
11137         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11138         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11139         LDKCVec_RouteHopZ path_constr;
11140         path_constr.datalen = path->arr_len;
11141         if (path_constr.datalen > 0)
11142                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11143         else
11144                 path_constr.data = NULL;
11145         uint64_t* path_vals = path->elems;
11146         for (size_t k = 0; k < path_constr.datalen; k++) {
11147                 uint64_t path_conv_10 = path_vals[k];
11148                 LDKRouteHop path_conv_10_conv;
11149                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11150                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11151                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11152                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11153                 path_constr.data[k] = path_conv_10_conv;
11154         }
11155         FREE(path);
11156         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11157 }
11158
11159 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
11160         void* this_arg_ptr = untag_ptr(this_arg);
11161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11162         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11163         LDKCVec_RouteHopZ path_constr;
11164         path_constr.datalen = path->arr_len;
11165         if (path_constr.datalen > 0)
11166                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11167         else
11168                 path_constr.data = NULL;
11169         uint64_t* path_vals = path->elems;
11170         for (size_t k = 0; k < path_constr.datalen; k++) {
11171                 uint64_t path_conv_10 = path_vals[k];
11172                 LDKRouteHop path_conv_10_conv;
11173                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11174                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11175                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11176                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11177                 path_constr.data[k] = path_conv_10_conv;
11178         }
11179         FREE(path);
11180         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11181 }
11182
11183 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11184         void* this_arg_ptr = untag_ptr(this_arg);
11185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11186         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11187         LDKCVec_RouteHopZ path_constr;
11188         path_constr.datalen = path->arr_len;
11189         if (path_constr.datalen > 0)
11190                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11191         else
11192                 path_constr.data = NULL;
11193         uint64_t* path_vals = path->elems;
11194         for (size_t k = 0; k < path_constr.datalen; k++) {
11195                 uint64_t path_conv_10 = path_vals[k];
11196                 LDKRouteHop path_conv_10_conv;
11197                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11198                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11199                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11200                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11201                 path_constr.data[k] = path_conv_10_conv;
11202         }
11203         FREE(path);
11204         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11205 }
11206
11207 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) {
11208         void* this_arg_ptr = untag_ptr(this_arg);
11209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11210         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11211         LDKCVec_RouteHopZ path_constr;
11212         path_constr.datalen = path->arr_len;
11213         if (path_constr.datalen > 0)
11214                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11215         else
11216                 path_constr.data = NULL;
11217         uint64_t* path_vals = path->elems;
11218         for (size_t k = 0; k < path_constr.datalen; k++) {
11219                 uint64_t path_conv_10 = path_vals[k];
11220                 LDKRouteHop path_conv_10_conv;
11221                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11222                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11223                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11224                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11225                 path_constr.data[k] = path_conv_10_conv;
11226         }
11227         FREE(path);
11228         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11229 }
11230
11231 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11232         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11233         switch(obj->tag) {
11234                 case LDKDestination_Node: return 0;
11235                 case LDKDestination_BlindedPath: return 1;
11236                 default: abort();
11237         }
11238 }
11239 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11240         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11241         assert(obj->tag == LDKDestination_Node);
11242                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11243                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11244         return node_arr;
11245 }
11246 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11247         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11248         assert(obj->tag == LDKDestination_BlindedPath);
11249                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11250                         uint64_t blinded_path_ref = 0;
11251                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11252                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11253         return blinded_path_ref;
11254 }
11255 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11256         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11257         switch(obj->tag) {
11258                 case LDKOnionMessageContents_Custom: return 0;
11259                 default: abort();
11260         }
11261 }
11262 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11263         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11264         assert(obj->tag == LDKOnionMessageContents_Custom);
11265                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11266                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11267         return tag_ptr(custom_ret, true);
11268 }
11269 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11270         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11271         switch(obj->tag) {
11272                 case LDKFallback_SegWitProgram: return 0;
11273                 case LDKFallback_PubKeyHash: return 1;
11274                 case LDKFallback_ScriptHash: return 2;
11275                 default: abort();
11276         }
11277 }
11278 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11279         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11280         assert(obj->tag == LDKFallback_SegWitProgram);
11281                         uint8_t version_val = obj->seg_wit_program.version._0;
11282         return version_val;
11283 }
11284 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11285         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11286         assert(obj->tag == LDKFallback_SegWitProgram);
11287                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11288                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11289                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11290         return program_arr;
11291 }
11292 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11293         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11294         assert(obj->tag == LDKFallback_PubKeyHash);
11295                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11296                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11297         return pub_key_hash_arr;
11298 }
11299 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11300         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11301         assert(obj->tag == LDKFallback_ScriptHash);
11302                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11303                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11304         return script_hash_arr;
11305 }
11306 typedef struct LDKPayer_JCalls {
11307         atomic_size_t refcnt;
11308         uint32_t instance_ptr;
11309 } LDKPayer_JCalls;
11310 static void LDKPayer_JCalls_free(void* this_arg) {
11311         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11312         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11313                 FREE(j_calls);
11314         }
11315 }
11316 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
11317         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11318         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, 0, 0, 0, 0, 0, 0);
11319         LDKPublicKey ret_ref;
11320         CHECK(ret->arr_len == 33);
11321         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
11322         return ret_ref;
11323 }
11324 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
11325         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11326         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, 0, 0, 0, 0, 0, 0);
11327         LDKCVec_ChannelDetailsZ ret_constr;
11328         ret_constr.datalen = ret->arr_len;
11329         if (ret_constr.datalen > 0)
11330                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11331         else
11332                 ret_constr.data = NULL;
11333         uint64_t* ret_vals = ret->elems;
11334         for (size_t q = 0; q < ret_constr.datalen; q++) {
11335                 uint64_t ret_conv_16 = ret_vals[q];
11336                 LDKChannelDetails ret_conv_16_conv;
11337                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
11338                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
11339                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
11340                 ret_constr.data[q] = ret_conv_16_conv;
11341         }
11342         FREE(ret);
11343         return ret_constr;
11344 }
11345 LDKCResult_NonePaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret, LDKThirtyTwoBytes payment_id) {
11346         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11347         LDKRoute route_var = *route;
11348         uint64_t route_ref = 0;
11349         route_var = Route_clone(&route_var);
11350         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11351         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11352         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11353         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
11354         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11355         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
11356         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11357         memcpy(payment_id_arr->elems, payment_id.data, 32);
11358         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, (uint32_t)payment_id_arr, 0, 0);
11359         void* ret_ptr = untag_ptr(ret);
11360         CHECK_ACCESS(ret_ptr);
11361         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11362         FREE(untag_ptr(ret));
11363         return ret_conv;
11364 }
11365 LDKCResult_NonePaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_id) {
11366         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11367         LDKRoute route_var = *route;
11368         uint64_t route_ref = 0;
11369         route_var = Route_clone(&route_var);
11370         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11371         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11372         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11373         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
11374         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11375         memcpy(payment_id_arr->elems, payment_id.data, 32);
11376         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, route_ref, (uint32_t)payment_preimage_arr, (uint32_t)payment_id_arr, 0, 0, 0);
11377         void* ret_ptr = untag_ptr(ret);
11378         CHECK_ACCESS(ret_ptr);
11379         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11380         FREE(untag_ptr(ret));
11381         return ret_conv;
11382 }
11383 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
11384         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11385         LDKRoute route_var = *route;
11386         uint64_t route_ref = 0;
11387         route_var = Route_clone(&route_var);
11388         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11389         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11390         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11391         memcpy(payment_id_arr->elems, payment_id.data, 32);
11392         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
11393         void* ret_ptr = untag_ptr(ret);
11394         CHECK_ACCESS(ret_ptr);
11395         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11396         FREE(untag_ptr(ret));
11397         return ret_conv;
11398 }
11399 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
11400         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11401         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11402         memcpy(payment_id_arr->elems, payment_id.data, 32);
11403         js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
11404 }
11405 LDKInFlightHtlcs inflight_htlcs_LDKPayer_jcall(const void* this_arg) {
11406         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11407         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, 0, 0, 0, 0, 0, 0);
11408         LDKInFlightHtlcs ret_conv;
11409         ret_conv.inner = untag_ptr(ret);
11410         ret_conv.is_owned = ptr_is_owned(ret);
11411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11412         return ret_conv;
11413 }
11414 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
11415         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
11416         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11417 }
11418 static inline LDKPayer LDKPayer_init (JSValue o) {
11419         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
11420         atomic_init(&calls->refcnt, 1);
11421         calls->instance_ptr = o;
11422
11423         LDKPayer ret = {
11424                 .this_arg = (void*) calls,
11425                 .node_id = node_id_LDKPayer_jcall,
11426                 .first_hops = first_hops_LDKPayer_jcall,
11427                 .send_payment = send_payment_LDKPayer_jcall,
11428                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
11429                 .retry_payment = retry_payment_LDKPayer_jcall,
11430                 .abandon_payment = abandon_payment_LDKPayer_jcall,
11431                 .inflight_htlcs = inflight_htlcs_LDKPayer_jcall,
11432                 .free = LDKPayer_JCalls_free,
11433         };
11434         return ret;
11435 }
11436 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
11437         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
11438         *res_ptr = LDKPayer_init(o);
11439         return tag_ptr(res_ptr, true);
11440 }
11441 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
11442         void* this_arg_ptr = untag_ptr(this_arg);
11443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11444         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11445         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
11446         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
11447         return ret_arr;
11448 }
11449
11450 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
11451         void* this_arg_ptr = untag_ptr(this_arg);
11452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11453         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11454         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
11455         uint64_tArray ret_arr = NULL;
11456         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11457         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11458         for (size_t q = 0; q < ret_var.datalen; q++) {
11459                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11460                 uint64_t ret_conv_16_ref = 0;
11461                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
11462                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
11463                 ret_arr_ptr[q] = ret_conv_16_ref;
11464         }
11465         
11466         FREE(ret_var.data);
11467         return ret_arr;
11468 }
11469
11470 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, int8_tArray payment_id) {
11471         void* this_arg_ptr = untag_ptr(this_arg);
11472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11473         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11474         LDKRoute route_conv;
11475         route_conv.inner = untag_ptr(route);
11476         route_conv.is_owned = ptr_is_owned(route);
11477         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11478         route_conv.is_owned = false;
11479         LDKThirtyTwoBytes payment_hash_ref;
11480         CHECK(payment_hash->arr_len == 32);
11481         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
11482         LDKThirtyTwoBytes payment_secret_ref;
11483         CHECK(payment_secret->arr_len == 32);
11484         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
11485         LDKThirtyTwoBytes payment_id_ref;
11486         CHECK(payment_id->arr_len == 32);
11487         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11488         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11489         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
11490         return tag_ptr(ret_conv, true);
11491 }
11492
11493 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, int8_tArray payment_id) {
11494         void* this_arg_ptr = untag_ptr(this_arg);
11495         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11496         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11497         LDKRoute route_conv;
11498         route_conv.inner = untag_ptr(route);
11499         route_conv.is_owned = ptr_is_owned(route);
11500         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11501         route_conv.is_owned = false;
11502         LDKThirtyTwoBytes payment_preimage_ref;
11503         CHECK(payment_preimage->arr_len == 32);
11504         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
11505         LDKThirtyTwoBytes payment_id_ref;
11506         CHECK(payment_id->arr_len == 32);
11507         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11508         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11509         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref, payment_id_ref);
11510         return tag_ptr(ret_conv, true);
11511 }
11512
11513 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
11514         void* this_arg_ptr = untag_ptr(this_arg);
11515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11516         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11517         LDKRoute route_conv;
11518         route_conv.inner = untag_ptr(route);
11519         route_conv.is_owned = ptr_is_owned(route);
11520         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11521         route_conv.is_owned = false;
11522         LDKThirtyTwoBytes payment_id_ref;
11523         CHECK(payment_id->arr_len == 32);
11524         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11525         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11526         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
11527         return tag_ptr(ret_conv, true);
11528 }
11529
11530 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
11531         void* this_arg_ptr = untag_ptr(this_arg);
11532         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11533         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11534         LDKThirtyTwoBytes payment_id_ref;
11535         CHECK(payment_id->arr_len == 32);
11536         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11537         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
11538 }
11539
11540 uint64_t  __attribute__((export_name("TS_Payer_inflight_htlcs"))) TS_Payer_inflight_htlcs(uint64_t this_arg) {
11541         void* this_arg_ptr = untag_ptr(this_arg);
11542         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11543         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11544         LDKInFlightHtlcs ret_var = (this_arg_conv->inflight_htlcs)(this_arg_conv->this_arg);
11545         uint64_t ret_ref = 0;
11546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11548         return ret_ref;
11549 }
11550
11551 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11552         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11553         switch(obj->tag) {
11554                 case LDKRetry_Attempts: return 0;
11555                 default: abort();
11556         }
11557 }
11558 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11559         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11560         assert(obj->tag == LDKRetry_Attempts);
11561                         uint32_t attempts_conv = obj->attempts;
11562         return attempts_conv;
11563 }
11564 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11565         LDKStr ret_str = _ldk_get_compiled_version();
11566         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11567         Str_free(ret_str);
11568         return ret_conv;
11569 }
11570
11571 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11572         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11573         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11574         Str_free(ret_str);
11575         return ret_conv;
11576 }
11577
11578 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11579         LDKU128 val_ref;
11580         CHECK(val->arr_len == 16);
11581         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11582         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11583         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11584         return ret_arr;
11585 }
11586
11587 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11588         LDKSixteenBytes le_bytes_ref;
11589         CHECK(le_bytes->arr_len == 16);
11590         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11591         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11592         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11593         return ret_arr;
11594 }
11595
11596 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11597         LDKThirtyTwoBytes big_endian_bytes_ref;
11598         CHECK(big_endian_bytes->arr_len == 32);
11599         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11600         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11601         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11602         return tag_ptr(ret_ref, true);
11603 }
11604
11605 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11606         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11607         *ret_copy = Bech32Error_clone(arg);
11608         uint64_t ret_ref = tag_ptr(ret_copy, true);
11609         return ret_ref;
11610 }
11611 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11612         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11613         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11614         return ret_conv;
11615 }
11616
11617 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11618         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11619         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11620         *ret_copy = Bech32Error_clone(orig_conv);
11621         uint64_t ret_ref = tag_ptr(ret_copy, true);
11622         return ret_ref;
11623 }
11624
11625 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11626         if (!ptr_is_owned(o)) return;
11627         void* o_ptr = untag_ptr(o);
11628         CHECK_ACCESS(o_ptr);
11629         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11630         FREE(untag_ptr(o));
11631         Bech32Error_free(o_conv);
11632 }
11633
11634 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11635         LDKTransaction _res_ref;
11636         _res_ref.datalen = _res->arr_len;
11637         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11638         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11639         _res_ref.data_is_owned = true;
11640         Transaction_free(_res_ref);
11641 }
11642
11643 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11644         LDKWitness _res_ref;
11645         _res_ref.datalen = _res->arr_len;
11646         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11647         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11648         _res_ref.data_is_owned = true;
11649         Witness_free(_res_ref);
11650 }
11651
11652 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11653         LDKCVec_u8Z script_pubkey_ref;
11654         script_pubkey_ref.datalen = script_pubkey->arr_len;
11655         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11656         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11657         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11658         *ret_ref = TxOut_new(script_pubkey_ref, value);
11659         return tag_ptr(ret_ref, true);
11660 }
11661
11662 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11663         if (!ptr_is_owned(_res)) return;
11664         void* _res_ptr = untag_ptr(_res);
11665         CHECK_ACCESS(_res_ptr);
11666         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11667         FREE(untag_ptr(_res));
11668         TxOut_free(_res_conv);
11669 }
11670
11671 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11672         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11673         *ret_ref = TxOut_clone(arg);
11674         return tag_ptr(ret_ref, true);
11675 }
11676 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11677         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11678         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11679         return ret_conv;
11680 }
11681
11682 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11683         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11684         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11685         *ret_ref = TxOut_clone(orig_conv);
11686         return tag_ptr(ret_ref, true);
11687 }
11688
11689 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11690         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11691         Str_free(dummy);
11692 }
11693
11694 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
11695         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
11696         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11697         *ret_copy = COption_HTLCClaimZ_some(o_conv);
11698         uint64_t ret_ref = tag_ptr(ret_copy, true);
11699         return ret_ref;
11700 }
11701
11702 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
11703         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11704         *ret_copy = COption_HTLCClaimZ_none();
11705         uint64_t ret_ref = tag_ptr(ret_copy, true);
11706         return ret_ref;
11707 }
11708
11709 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
11710         if (!ptr_is_owned(_res)) return;
11711         void* _res_ptr = untag_ptr(_res);
11712         CHECK_ACCESS(_res_ptr);
11713         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
11714         FREE(untag_ptr(_res));
11715         COption_HTLCClaimZ_free(_res_conv);
11716 }
11717
11718 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11719         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11720         *ret_conv = CResult_NoneNoneZ_ok();
11721         return tag_ptr(ret_conv, true);
11722 }
11723
11724 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11725         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11726         *ret_conv = CResult_NoneNoneZ_err();
11727         return tag_ptr(ret_conv, true);
11728 }
11729
11730 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11731         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11732         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11733         return ret_conv;
11734 }
11735
11736 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11737         if (!ptr_is_owned(_res)) return;
11738         void* _res_ptr = untag_ptr(_res);
11739         CHECK_ACCESS(_res_ptr);
11740         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11741         FREE(untag_ptr(_res));
11742         CResult_NoneNoneZ_free(_res_conv);
11743 }
11744
11745 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11746         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11747         *ret_conv = CResult_NoneNoneZ_clone(arg);
11748         return tag_ptr(ret_conv, true);
11749 }
11750 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11751         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11752         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11753         return ret_conv;
11754 }
11755
11756 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11757         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11758         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11759         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11760         return tag_ptr(ret_conv, true);
11761 }
11762
11763 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11764         LDKCounterpartyCommitmentSecrets o_conv;
11765         o_conv.inner = untag_ptr(o);
11766         o_conv.is_owned = ptr_is_owned(o);
11767         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11768         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11769         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11770         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11771         return tag_ptr(ret_conv, true);
11772 }
11773
11774 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11775         void* e_ptr = untag_ptr(e);
11776         CHECK_ACCESS(e_ptr);
11777         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11778         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11779         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11780         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11781         return tag_ptr(ret_conv, true);
11782 }
11783
11784 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11785         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11786         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11787         return ret_conv;
11788 }
11789
11790 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11791         if (!ptr_is_owned(_res)) return;
11792         void* _res_ptr = untag_ptr(_res);
11793         CHECK_ACCESS(_res_ptr);
11794         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11795         FREE(untag_ptr(_res));
11796         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11797 }
11798
11799 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11800         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11801         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11802         return tag_ptr(ret_conv, true);
11803 }
11804 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11805         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11806         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11807         return ret_conv;
11808 }
11809
11810 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11811         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11812         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11813         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11814         return tag_ptr(ret_conv, true);
11815 }
11816
11817 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11818         LDKTxCreationKeys o_conv;
11819         o_conv.inner = untag_ptr(o);
11820         o_conv.is_owned = ptr_is_owned(o);
11821         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11822         o_conv = TxCreationKeys_clone(&o_conv);
11823         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11824         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11825         return tag_ptr(ret_conv, true);
11826 }
11827
11828 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11829         void* e_ptr = untag_ptr(e);
11830         CHECK_ACCESS(e_ptr);
11831         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11832         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11833         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11834         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11835         return tag_ptr(ret_conv, true);
11836 }
11837
11838 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11839         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11840         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11841         return ret_conv;
11842 }
11843
11844 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11845         if (!ptr_is_owned(_res)) return;
11846         void* _res_ptr = untag_ptr(_res);
11847         CHECK_ACCESS(_res_ptr);
11848         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11849         FREE(untag_ptr(_res));
11850         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11851 }
11852
11853 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11854         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11855         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11856         return tag_ptr(ret_conv, true);
11857 }
11858 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11859         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11860         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11861         return ret_conv;
11862 }
11863
11864 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11865         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11866         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11867         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11868         return tag_ptr(ret_conv, true);
11869 }
11870
11871 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11872         LDKChannelPublicKeys o_conv;
11873         o_conv.inner = untag_ptr(o);
11874         o_conv.is_owned = ptr_is_owned(o);
11875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11876         o_conv = ChannelPublicKeys_clone(&o_conv);
11877         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11878         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11879         return tag_ptr(ret_conv, true);
11880 }
11881
11882 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11883         void* e_ptr = untag_ptr(e);
11884         CHECK_ACCESS(e_ptr);
11885         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11886         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11887         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11888         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11889         return tag_ptr(ret_conv, true);
11890 }
11891
11892 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11893         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11894         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11895         return ret_conv;
11896 }
11897
11898 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11899         if (!ptr_is_owned(_res)) return;
11900         void* _res_ptr = untag_ptr(_res);
11901         CHECK_ACCESS(_res_ptr);
11902         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11903         FREE(untag_ptr(_res));
11904         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11905 }
11906
11907 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11908         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11909         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11910         return tag_ptr(ret_conv, true);
11911 }
11912 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11913         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11914         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11915         return ret_conv;
11916 }
11917
11918 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11919         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11920         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11921         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11922         return tag_ptr(ret_conv, true);
11923 }
11924
11925 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11926         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11927         *ret_copy = COption_u32Z_some(o);
11928         uint64_t ret_ref = tag_ptr(ret_copy, true);
11929         return ret_ref;
11930 }
11931
11932 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11933         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11934         *ret_copy = COption_u32Z_none();
11935         uint64_t ret_ref = tag_ptr(ret_copy, true);
11936         return ret_ref;
11937 }
11938
11939 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11940         if (!ptr_is_owned(_res)) return;
11941         void* _res_ptr = untag_ptr(_res);
11942         CHECK_ACCESS(_res_ptr);
11943         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11944         FREE(untag_ptr(_res));
11945         COption_u32Z_free(_res_conv);
11946 }
11947
11948 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11949         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11950         *ret_copy = COption_u32Z_clone(arg);
11951         uint64_t ret_ref = tag_ptr(ret_copy, true);
11952         return ret_ref;
11953 }
11954 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11955         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11956         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11957         return ret_conv;
11958 }
11959
11960 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11961         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11962         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11963         *ret_copy = COption_u32Z_clone(orig_conv);
11964         uint64_t ret_ref = tag_ptr(ret_copy, true);
11965         return ret_ref;
11966 }
11967
11968 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11969         LDKHTLCOutputInCommitment o_conv;
11970         o_conv.inner = untag_ptr(o);
11971         o_conv.is_owned = ptr_is_owned(o);
11972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11973         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11974         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11975         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11976         return tag_ptr(ret_conv, true);
11977 }
11978
11979 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11980         void* e_ptr = untag_ptr(e);
11981         CHECK_ACCESS(e_ptr);
11982         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11983         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11984         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11985         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11986         return tag_ptr(ret_conv, true);
11987 }
11988
11989 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11990         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11991         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11992         return ret_conv;
11993 }
11994
11995 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11996         if (!ptr_is_owned(_res)) return;
11997         void* _res_ptr = untag_ptr(_res);
11998         CHECK_ACCESS(_res_ptr);
11999         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12000         FREE(untag_ptr(_res));
12001         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12002 }
12003
12004 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12005         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12006         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12007         return tag_ptr(ret_conv, true);
12008 }
12009 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12010         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12011         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12012         return ret_conv;
12013 }
12014
12015 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12016         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12017         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12018         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12019         return tag_ptr(ret_conv, true);
12020 }
12021
12022 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12023         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12024         return ret_conv;
12025 }
12026
12027 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12028         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12029         return ret_conv;
12030 }
12031
12032 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12033         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12034         COption_NoneZ_free(_res_conv);
12035 }
12036
12037 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12038         LDKCounterpartyChannelTransactionParameters o_conv;
12039         o_conv.inner = untag_ptr(o);
12040         o_conv.is_owned = ptr_is_owned(o);
12041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12042         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12043         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12044         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12045         return tag_ptr(ret_conv, true);
12046 }
12047
12048 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12049         void* e_ptr = untag_ptr(e);
12050         CHECK_ACCESS(e_ptr);
12051         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12052         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12053         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12054         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12055         return tag_ptr(ret_conv, true);
12056 }
12057
12058 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12059         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12060         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12061         return ret_conv;
12062 }
12063
12064 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12065         if (!ptr_is_owned(_res)) return;
12066         void* _res_ptr = untag_ptr(_res);
12067         CHECK_ACCESS(_res_ptr);
12068         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12069         FREE(untag_ptr(_res));
12070         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12071 }
12072
12073 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12074         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12075         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12076         return tag_ptr(ret_conv, true);
12077 }
12078 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12079         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12080         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12081         return ret_conv;
12082 }
12083
12084 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12085         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12086         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12087         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12088         return tag_ptr(ret_conv, true);
12089 }
12090
12091 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12092         LDKChannelTransactionParameters o_conv;
12093         o_conv.inner = untag_ptr(o);
12094         o_conv.is_owned = ptr_is_owned(o);
12095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12096         o_conv = ChannelTransactionParameters_clone(&o_conv);
12097         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12098         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12099         return tag_ptr(ret_conv, true);
12100 }
12101
12102 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12103         void* e_ptr = untag_ptr(e);
12104         CHECK_ACCESS(e_ptr);
12105         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12106         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12107         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12108         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12109         return tag_ptr(ret_conv, true);
12110 }
12111
12112 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12113         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12114         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12115         return ret_conv;
12116 }
12117
12118 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12119         if (!ptr_is_owned(_res)) return;
12120         void* _res_ptr = untag_ptr(_res);
12121         CHECK_ACCESS(_res_ptr);
12122         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12123         FREE(untag_ptr(_res));
12124         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12125 }
12126
12127 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12128         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12129         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12130         return tag_ptr(ret_conv, true);
12131 }
12132 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12133         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12134         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12135         return ret_conv;
12136 }
12137
12138 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12139         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12140         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12141         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12142         return tag_ptr(ret_conv, true);
12143 }
12144
12145 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12146         LDKCVec_SignatureZ _res_constr;
12147         _res_constr.datalen = _res->arr_len;
12148         if (_res_constr.datalen > 0)
12149                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12150         else
12151                 _res_constr.data = NULL;
12152         int8_tArray* _res_vals = (void*) _res->elems;
12153         for (size_t m = 0; m < _res_constr.datalen; m++) {
12154                 int8_tArray _res_conv_12 = _res_vals[m];
12155                 LDKSignature _res_conv_12_ref;
12156                 CHECK(_res_conv_12->arr_len == 64);
12157                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12158                 _res_constr.data[m] = _res_conv_12_ref;
12159         }
12160         FREE(_res);
12161         CVec_SignatureZ_free(_res_constr);
12162 }
12163
12164 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12165         LDKHolderCommitmentTransaction o_conv;
12166         o_conv.inner = untag_ptr(o);
12167         o_conv.is_owned = ptr_is_owned(o);
12168         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12169         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12170         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12171         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12172         return tag_ptr(ret_conv, true);
12173 }
12174
12175 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12176         void* e_ptr = untag_ptr(e);
12177         CHECK_ACCESS(e_ptr);
12178         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12179         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12180         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12181         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12182         return tag_ptr(ret_conv, true);
12183 }
12184
12185 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12186         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12187         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12188         return ret_conv;
12189 }
12190
12191 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12192         if (!ptr_is_owned(_res)) return;
12193         void* _res_ptr = untag_ptr(_res);
12194         CHECK_ACCESS(_res_ptr);
12195         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12196         FREE(untag_ptr(_res));
12197         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12198 }
12199
12200 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12201         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12202         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12203         return tag_ptr(ret_conv, true);
12204 }
12205 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12206         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12207         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12208         return ret_conv;
12209 }
12210
12211 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12212         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12213         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12214         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12215         return tag_ptr(ret_conv, true);
12216 }
12217
12218 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12219         LDKBuiltCommitmentTransaction o_conv;
12220         o_conv.inner = untag_ptr(o);
12221         o_conv.is_owned = ptr_is_owned(o);
12222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12223         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12224         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12225         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12226         return tag_ptr(ret_conv, true);
12227 }
12228
12229 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12230         void* e_ptr = untag_ptr(e);
12231         CHECK_ACCESS(e_ptr);
12232         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12233         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12234         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12235         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12236         return tag_ptr(ret_conv, true);
12237 }
12238
12239 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12240         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12241         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12242         return ret_conv;
12243 }
12244
12245 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12246         if (!ptr_is_owned(_res)) return;
12247         void* _res_ptr = untag_ptr(_res);
12248         CHECK_ACCESS(_res_ptr);
12249         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12250         FREE(untag_ptr(_res));
12251         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12252 }
12253
12254 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12255         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12256         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12257         return tag_ptr(ret_conv, true);
12258 }
12259 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12260         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12261         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12262         return ret_conv;
12263 }
12264
12265 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12266         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12267         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12268         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12269         return tag_ptr(ret_conv, true);
12270 }
12271
12272 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12273         LDKTrustedClosingTransaction o_conv;
12274         o_conv.inner = untag_ptr(o);
12275         o_conv.is_owned = ptr_is_owned(o);
12276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12277         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12278         
12279         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12280         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12281         return tag_ptr(ret_conv, true);
12282 }
12283
12284 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12285         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12286         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12287         return tag_ptr(ret_conv, true);
12288 }
12289
12290 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12291         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12292         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12293         return ret_conv;
12294 }
12295
12296 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12297         if (!ptr_is_owned(_res)) return;
12298         void* _res_ptr = untag_ptr(_res);
12299         CHECK_ACCESS(_res_ptr);
12300         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12301         FREE(untag_ptr(_res));
12302         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12303 }
12304
12305 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12306         LDKCommitmentTransaction o_conv;
12307         o_conv.inner = untag_ptr(o);
12308         o_conv.is_owned = ptr_is_owned(o);
12309         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12310         o_conv = CommitmentTransaction_clone(&o_conv);
12311         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12312         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12313         return tag_ptr(ret_conv, true);
12314 }
12315
12316 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12317         void* e_ptr = untag_ptr(e);
12318         CHECK_ACCESS(e_ptr);
12319         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12320         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12321         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12322         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12323         return tag_ptr(ret_conv, true);
12324 }
12325
12326 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12327         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12328         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12329         return ret_conv;
12330 }
12331
12332 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12333         if (!ptr_is_owned(_res)) return;
12334         void* _res_ptr = untag_ptr(_res);
12335         CHECK_ACCESS(_res_ptr);
12336         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12337         FREE(untag_ptr(_res));
12338         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12339 }
12340
12341 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12342         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12343         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12344         return tag_ptr(ret_conv, true);
12345 }
12346 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12347         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12348         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12349         return ret_conv;
12350 }
12351
12352 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12353         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12354         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12355         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12356         return tag_ptr(ret_conv, true);
12357 }
12358
12359 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12360         LDKTrustedCommitmentTransaction o_conv;
12361         o_conv.inner = untag_ptr(o);
12362         o_conv.is_owned = ptr_is_owned(o);
12363         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12364         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12365         
12366         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12367         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12368         return tag_ptr(ret_conv, true);
12369 }
12370
12371 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12372         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12373         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12374         return tag_ptr(ret_conv, true);
12375 }
12376
12377 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12378         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12379         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12380         return ret_conv;
12381 }
12382
12383 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12384         if (!ptr_is_owned(_res)) return;
12385         void* _res_ptr = untag_ptr(_res);
12386         CHECK_ACCESS(_res_ptr);
12387         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12388         FREE(untag_ptr(_res));
12389         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12390 }
12391
12392 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12393         LDKCVec_SignatureZ o_constr;
12394         o_constr.datalen = o->arr_len;
12395         if (o_constr.datalen > 0)
12396                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12397         else
12398                 o_constr.data = NULL;
12399         int8_tArray* o_vals = (void*) o->elems;
12400         for (size_t m = 0; m < o_constr.datalen; m++) {
12401                 int8_tArray o_conv_12 = o_vals[m];
12402                 LDKSignature o_conv_12_ref;
12403                 CHECK(o_conv_12->arr_len == 64);
12404                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12405                 o_constr.data[m] = o_conv_12_ref;
12406         }
12407         FREE(o);
12408         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12409         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12410         return tag_ptr(ret_conv, true);
12411 }
12412
12413 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12414         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12415         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12416         return tag_ptr(ret_conv, true);
12417 }
12418
12419 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12420         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12421         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12422         return ret_conv;
12423 }
12424
12425 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12426         if (!ptr_is_owned(_res)) return;
12427         void* _res_ptr = untag_ptr(_res);
12428         CHECK_ACCESS(_res_ptr);
12429         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12430         FREE(untag_ptr(_res));
12431         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12432 }
12433
12434 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12435         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12436         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12437         return tag_ptr(ret_conv, true);
12438 }
12439 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12440         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12441         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12442         return ret_conv;
12443 }
12444
12445 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12446         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12447         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12448         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12449         return tag_ptr(ret_conv, true);
12450 }
12451
12452 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12453         LDKShutdownScript o_conv;
12454         o_conv.inner = untag_ptr(o);
12455         o_conv.is_owned = ptr_is_owned(o);
12456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12457         o_conv = ShutdownScript_clone(&o_conv);
12458         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12459         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12460         return tag_ptr(ret_conv, true);
12461 }
12462
12463 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12464         void* e_ptr = untag_ptr(e);
12465         CHECK_ACCESS(e_ptr);
12466         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12467         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12468         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12469         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12470         return tag_ptr(ret_conv, true);
12471 }
12472
12473 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12474         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12475         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12476         return ret_conv;
12477 }
12478
12479 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12480         if (!ptr_is_owned(_res)) return;
12481         void* _res_ptr = untag_ptr(_res);
12482         CHECK_ACCESS(_res_ptr);
12483         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12484         FREE(untag_ptr(_res));
12485         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12486 }
12487
12488 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12489         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12490         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12491         return tag_ptr(ret_conv, true);
12492 }
12493 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12494         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12495         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12496         return ret_conv;
12497 }
12498
12499 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12500         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12501         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12502         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12503         return tag_ptr(ret_conv, true);
12504 }
12505
12506 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12507         LDKShutdownScript o_conv;
12508         o_conv.inner = untag_ptr(o);
12509         o_conv.is_owned = ptr_is_owned(o);
12510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12511         o_conv = ShutdownScript_clone(&o_conv);
12512         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12513         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12514         return tag_ptr(ret_conv, true);
12515 }
12516
12517 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12518         LDKInvalidShutdownScript e_conv;
12519         e_conv.inner = untag_ptr(e);
12520         e_conv.is_owned = ptr_is_owned(e);
12521         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12522         e_conv = InvalidShutdownScript_clone(&e_conv);
12523         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12524         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12525         return tag_ptr(ret_conv, true);
12526 }
12527
12528 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12529         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12530         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12531         return ret_conv;
12532 }
12533
12534 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12535         if (!ptr_is_owned(_res)) return;
12536         void* _res_ptr = untag_ptr(_res);
12537         CHECK_ACCESS(_res_ptr);
12538         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12539         FREE(untag_ptr(_res));
12540         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12541 }
12542
12543 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12544         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12545         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12546         return tag_ptr(ret_conv, true);
12547 }
12548 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12549         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12550         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12551         return ret_conv;
12552 }
12553
12554 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12555         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12556         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12557         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12558         return tag_ptr(ret_conv, true);
12559 }
12560
12561 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12562         LDKCVec_PublicKeyZ _res_constr;
12563         _res_constr.datalen = _res->arr_len;
12564         if (_res_constr.datalen > 0)
12565                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12566         else
12567                 _res_constr.data = NULL;
12568         int8_tArray* _res_vals = (void*) _res->elems;
12569         for (size_t m = 0; m < _res_constr.datalen; m++) {
12570                 int8_tArray _res_conv_12 = _res_vals[m];
12571                 LDKPublicKey _res_conv_12_ref;
12572                 CHECK(_res_conv_12->arr_len == 33);
12573                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12574                 _res_constr.data[m] = _res_conv_12_ref;
12575         }
12576         FREE(_res);
12577         CVec_PublicKeyZ_free(_res_constr);
12578 }
12579
12580 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
12581         LDKBlindedPath o_conv;
12582         o_conv.inner = untag_ptr(o);
12583         o_conv.is_owned = ptr_is_owned(o);
12584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12585         o_conv = BlindedPath_clone(&o_conv);
12586         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12587         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
12588         return tag_ptr(ret_conv, true);
12589 }
12590
12591 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
12592         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12593         *ret_conv = CResult_BlindedPathNoneZ_err();
12594         return tag_ptr(ret_conv, true);
12595 }
12596
12597 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
12598         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
12599         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
12600         return ret_conv;
12601 }
12602
12603 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
12604         if (!ptr_is_owned(_res)) return;
12605         void* _res_ptr = untag_ptr(_res);
12606         CHECK_ACCESS(_res_ptr);
12607         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
12608         FREE(untag_ptr(_res));
12609         CResult_BlindedPathNoneZ_free(_res_conv);
12610 }
12611
12612 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
12613         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12614         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
12615         return tag_ptr(ret_conv, true);
12616 }
12617 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
12618         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
12619         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
12620         return ret_conv;
12621 }
12622
12623 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
12624         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
12625         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12626         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
12627         return tag_ptr(ret_conv, true);
12628 }
12629
12630 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
12631         LDKBlindedPath o_conv;
12632         o_conv.inner = untag_ptr(o);
12633         o_conv.is_owned = ptr_is_owned(o);
12634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12635         o_conv = BlindedPath_clone(&o_conv);
12636         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12637         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
12638         return tag_ptr(ret_conv, true);
12639 }
12640
12641 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
12642         void* e_ptr = untag_ptr(e);
12643         CHECK_ACCESS(e_ptr);
12644         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12645         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12646         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12647         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
12648         return tag_ptr(ret_conv, true);
12649 }
12650
12651 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
12652         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
12653         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
12654         return ret_conv;
12655 }
12656
12657 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
12658         if (!ptr_is_owned(_res)) return;
12659         void* _res_ptr = untag_ptr(_res);
12660         CHECK_ACCESS(_res_ptr);
12661         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
12662         FREE(untag_ptr(_res));
12663         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
12664 }
12665
12666 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
12667         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12668         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
12669         return tag_ptr(ret_conv, true);
12670 }
12671 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
12672         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
12673         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
12674         return ret_conv;
12675 }
12676
12677 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
12678         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
12679         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12680         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
12681         return tag_ptr(ret_conv, true);
12682 }
12683
12684 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
12685         LDKBlindedHop o_conv;
12686         o_conv.inner = untag_ptr(o);
12687         o_conv.is_owned = ptr_is_owned(o);
12688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12689         o_conv = BlindedHop_clone(&o_conv);
12690         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12691         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
12692         return tag_ptr(ret_conv, true);
12693 }
12694
12695 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
12696         void* e_ptr = untag_ptr(e);
12697         CHECK_ACCESS(e_ptr);
12698         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12699         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12700         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12701         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
12702         return tag_ptr(ret_conv, true);
12703 }
12704
12705 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
12706         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
12707         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
12708         return ret_conv;
12709 }
12710
12711 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
12712         if (!ptr_is_owned(_res)) return;
12713         void* _res_ptr = untag_ptr(_res);
12714         CHECK_ACCESS(_res_ptr);
12715         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
12716         FREE(untag_ptr(_res));
12717         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
12718 }
12719
12720 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
12721         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12722         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
12723         return tag_ptr(ret_conv, true);
12724 }
12725 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12726         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
12727         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
12728         return ret_conv;
12729 }
12730
12731 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
12732         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
12733         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12734         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
12735         return tag_ptr(ret_conv, true);
12736 }
12737
12738 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12739         LDKCVec_ChannelDetailsZ _res_constr;
12740         _res_constr.datalen = _res->arr_len;
12741         if (_res_constr.datalen > 0)
12742                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12743         else
12744                 _res_constr.data = NULL;
12745         uint64_t* _res_vals = _res->elems;
12746         for (size_t q = 0; q < _res_constr.datalen; q++) {
12747                 uint64_t _res_conv_16 = _res_vals[q];
12748                 LDKChannelDetails _res_conv_16_conv;
12749                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12750                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12751                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12752                 _res_constr.data[q] = _res_conv_16_conv;
12753         }
12754         FREE(_res);
12755         CVec_ChannelDetailsZ_free(_res_constr);
12756 }
12757
12758 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12759         LDKRoute o_conv;
12760         o_conv.inner = untag_ptr(o);
12761         o_conv.is_owned = ptr_is_owned(o);
12762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12763         o_conv = Route_clone(&o_conv);
12764         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12765         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12766         return tag_ptr(ret_conv, true);
12767 }
12768
12769 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12770         LDKLightningError e_conv;
12771         e_conv.inner = untag_ptr(e);
12772         e_conv.is_owned = ptr_is_owned(e);
12773         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12774         e_conv = LightningError_clone(&e_conv);
12775         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12776         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12777         return tag_ptr(ret_conv, true);
12778 }
12779
12780 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12781         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12782         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12783         return ret_conv;
12784 }
12785
12786 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12787         if (!ptr_is_owned(_res)) return;
12788         void* _res_ptr = untag_ptr(_res);
12789         CHECK_ACCESS(_res_ptr);
12790         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12791         FREE(untag_ptr(_res));
12792         CResult_RouteLightningErrorZ_free(_res_conv);
12793 }
12794
12795 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12796         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12797         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12798         return tag_ptr(ret_conv, true);
12799 }
12800 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12801         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12802         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12803         return ret_conv;
12804 }
12805
12806 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12807         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12808         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12809         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12810         return tag_ptr(ret_conv, true);
12811 }
12812
12813 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12814         LDKCVec_RouteHopZ _res_constr;
12815         _res_constr.datalen = _res->arr_len;
12816         if (_res_constr.datalen > 0)
12817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12818         else
12819                 _res_constr.data = NULL;
12820         uint64_t* _res_vals = _res->elems;
12821         for (size_t k = 0; k < _res_constr.datalen; k++) {
12822                 uint64_t _res_conv_10 = _res_vals[k];
12823                 LDKRouteHop _res_conv_10_conv;
12824                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12825                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12826                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12827                 _res_constr.data[k] = _res_conv_10_conv;
12828         }
12829         FREE(_res);
12830         CVec_RouteHopZ_free(_res_constr);
12831 }
12832
12833 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12834         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12835         *ret_copy = COption_u64Z_some(o);
12836         uint64_t ret_ref = tag_ptr(ret_copy, true);
12837         return ret_ref;
12838 }
12839
12840 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12841         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12842         *ret_copy = COption_u64Z_none();
12843         uint64_t ret_ref = tag_ptr(ret_copy, true);
12844         return ret_ref;
12845 }
12846
12847 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12848         if (!ptr_is_owned(_res)) return;
12849         void* _res_ptr = untag_ptr(_res);
12850         CHECK_ACCESS(_res_ptr);
12851         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12852         FREE(untag_ptr(_res));
12853         COption_u64Z_free(_res_conv);
12854 }
12855
12856 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12857         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12858         *ret_copy = COption_u64Z_clone(arg);
12859         uint64_t ret_ref = tag_ptr(ret_copy, true);
12860         return ret_ref;
12861 }
12862 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12863         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12864         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12865         return ret_conv;
12866 }
12867
12868 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12869         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12870         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12871         *ret_copy = COption_u64Z_clone(orig_conv);
12872         uint64_t ret_ref = tag_ptr(ret_copy, true);
12873         return ret_ref;
12874 }
12875
12876 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
12877         LDKInFlightHtlcs o_conv;
12878         o_conv.inner = untag_ptr(o);
12879         o_conv.is_owned = ptr_is_owned(o);
12880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12881         o_conv = InFlightHtlcs_clone(&o_conv);
12882         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12883         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
12884         return tag_ptr(ret_conv, true);
12885 }
12886
12887 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
12888         void* e_ptr = untag_ptr(e);
12889         CHECK_ACCESS(e_ptr);
12890         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12891         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12892         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12893         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
12894         return tag_ptr(ret_conv, true);
12895 }
12896
12897 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
12898         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
12899         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
12900         return ret_conv;
12901 }
12902
12903 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
12904         if (!ptr_is_owned(_res)) return;
12905         void* _res_ptr = untag_ptr(_res);
12906         CHECK_ACCESS(_res_ptr);
12907         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
12908         FREE(untag_ptr(_res));
12909         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
12910 }
12911
12912 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
12913         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12914         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
12915         return tag_ptr(ret_conv, true);
12916 }
12917 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
12918         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
12919         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
12920         return ret_conv;
12921 }
12922
12923 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
12924         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
12925         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12926         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
12927         return tag_ptr(ret_conv, true);
12928 }
12929
12930 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12931         LDKRouteHop o_conv;
12932         o_conv.inner = untag_ptr(o);
12933         o_conv.is_owned = ptr_is_owned(o);
12934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12935         o_conv = RouteHop_clone(&o_conv);
12936         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12937         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12938         return tag_ptr(ret_conv, true);
12939 }
12940
12941 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12942         void* e_ptr = untag_ptr(e);
12943         CHECK_ACCESS(e_ptr);
12944         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12945         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12946         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12947         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12948         return tag_ptr(ret_conv, true);
12949 }
12950
12951 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12952         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12953         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12954         return ret_conv;
12955 }
12956
12957 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12958         if (!ptr_is_owned(_res)) return;
12959         void* _res_ptr = untag_ptr(_res);
12960         CHECK_ACCESS(_res_ptr);
12961         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12962         FREE(untag_ptr(_res));
12963         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12964 }
12965
12966 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12967         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12968         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12969         return tag_ptr(ret_conv, true);
12970 }
12971 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12972         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12973         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12974         return ret_conv;
12975 }
12976
12977 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12978         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12979         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12980         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12981         return tag_ptr(ret_conv, true);
12982 }
12983
12984 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12985         LDKCVec_CVec_RouteHopZZ _res_constr;
12986         _res_constr.datalen = _res->arr_len;
12987         if (_res_constr.datalen > 0)
12988                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12989         else
12990                 _res_constr.data = NULL;
12991         uint64_tArray* _res_vals = (void*) _res->elems;
12992         for (size_t m = 0; m < _res_constr.datalen; m++) {
12993                 uint64_tArray _res_conv_12 = _res_vals[m];
12994                 LDKCVec_RouteHopZ _res_conv_12_constr;
12995                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12996                 if (_res_conv_12_constr.datalen > 0)
12997                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12998                 else
12999                         _res_conv_12_constr.data = NULL;
13000                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
13001                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
13002                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
13003                         LDKRouteHop _res_conv_12_conv_10_conv;
13004                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
13005                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
13006                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
13007                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
13008                 }
13009                 FREE(_res_conv_12);
13010                 _res_constr.data[m] = _res_conv_12_constr;
13011         }
13012         FREE(_res);
13013         CVec_CVec_RouteHopZZ_free(_res_constr);
13014 }
13015
13016 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13017         LDKRoute o_conv;
13018         o_conv.inner = untag_ptr(o);
13019         o_conv.is_owned = ptr_is_owned(o);
13020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13021         o_conv = Route_clone(&o_conv);
13022         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13023         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13024         return tag_ptr(ret_conv, true);
13025 }
13026
13027 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13028         void* e_ptr = untag_ptr(e);
13029         CHECK_ACCESS(e_ptr);
13030         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13031         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13032         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13033         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13034         return tag_ptr(ret_conv, true);
13035 }
13036
13037 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13038         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13039         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13040         return ret_conv;
13041 }
13042
13043 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13044         if (!ptr_is_owned(_res)) return;
13045         void* _res_ptr = untag_ptr(_res);
13046         CHECK_ACCESS(_res_ptr);
13047         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13048         FREE(untag_ptr(_res));
13049         CResult_RouteDecodeErrorZ_free(_res_conv);
13050 }
13051
13052 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13053         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13054         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13055         return tag_ptr(ret_conv, true);
13056 }
13057 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13058         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13059         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13060         return ret_conv;
13061 }
13062
13063 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13064         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13065         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13066         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13067         return tag_ptr(ret_conv, true);
13068 }
13069
13070 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13071         LDKRouteParameters o_conv;
13072         o_conv.inner = untag_ptr(o);
13073         o_conv.is_owned = ptr_is_owned(o);
13074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13075         o_conv = RouteParameters_clone(&o_conv);
13076         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13077         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13078         return tag_ptr(ret_conv, true);
13079 }
13080
13081 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13082         void* e_ptr = untag_ptr(e);
13083         CHECK_ACCESS(e_ptr);
13084         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13085         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13086         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13087         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13088         return tag_ptr(ret_conv, true);
13089 }
13090
13091 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13092         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13093         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13094         return ret_conv;
13095 }
13096
13097 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13098         if (!ptr_is_owned(_res)) return;
13099         void* _res_ptr = untag_ptr(_res);
13100         CHECK_ACCESS(_res_ptr);
13101         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13102         FREE(untag_ptr(_res));
13103         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13104 }
13105
13106 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13107         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13108         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13109         return tag_ptr(ret_conv, true);
13110 }
13111 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13112         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13113         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13114         return ret_conv;
13115 }
13116
13117 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13118         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13119         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13120         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13121         return tag_ptr(ret_conv, true);
13122 }
13123
13124 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13125         LDKCVec_RouteHintZ _res_constr;
13126         _res_constr.datalen = _res->arr_len;
13127         if (_res_constr.datalen > 0)
13128                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13129         else
13130                 _res_constr.data = NULL;
13131         uint64_t* _res_vals = _res->elems;
13132         for (size_t l = 0; l < _res_constr.datalen; l++) {
13133                 uint64_t _res_conv_11 = _res_vals[l];
13134                 LDKRouteHint _res_conv_11_conv;
13135                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13136                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13138                 _res_constr.data[l] = _res_conv_11_conv;
13139         }
13140         FREE(_res);
13141         CVec_RouteHintZ_free(_res_constr);
13142 }
13143
13144 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13145         LDKCVec_u64Z _res_constr;
13146         _res_constr.datalen = _res->arr_len;
13147         if (_res_constr.datalen > 0)
13148                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13149         else
13150                 _res_constr.data = NULL;
13151         int64_t* _res_vals = _res->elems;
13152         for (size_t i = 0; i < _res_constr.datalen; i++) {
13153                 int64_t _res_conv_8 = _res_vals[i];
13154                 _res_constr.data[i] = _res_conv_8;
13155         }
13156         FREE(_res);
13157         CVec_u64Z_free(_res_constr);
13158 }
13159
13160 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13161         LDKPaymentParameters o_conv;
13162         o_conv.inner = untag_ptr(o);
13163         o_conv.is_owned = ptr_is_owned(o);
13164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13165         o_conv = PaymentParameters_clone(&o_conv);
13166         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13167         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13168         return tag_ptr(ret_conv, true);
13169 }
13170
13171 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13172         void* e_ptr = untag_ptr(e);
13173         CHECK_ACCESS(e_ptr);
13174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13176         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13177         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13178         return tag_ptr(ret_conv, true);
13179 }
13180
13181 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13182         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13183         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13184         return ret_conv;
13185 }
13186
13187 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13188         if (!ptr_is_owned(_res)) return;
13189         void* _res_ptr = untag_ptr(_res);
13190         CHECK_ACCESS(_res_ptr);
13191         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13192         FREE(untag_ptr(_res));
13193         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13194 }
13195
13196 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13197         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13198         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13199         return tag_ptr(ret_conv, true);
13200 }
13201 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13202         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13203         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13204         return ret_conv;
13205 }
13206
13207 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13208         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13209         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13210         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13211         return tag_ptr(ret_conv, true);
13212 }
13213
13214 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13215         LDKCVec_RouteHintHopZ _res_constr;
13216         _res_constr.datalen = _res->arr_len;
13217         if (_res_constr.datalen > 0)
13218                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13219         else
13220                 _res_constr.data = NULL;
13221         uint64_t* _res_vals = _res->elems;
13222         for (size_t o = 0; o < _res_constr.datalen; o++) {
13223                 uint64_t _res_conv_14 = _res_vals[o];
13224                 LDKRouteHintHop _res_conv_14_conv;
13225                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13226                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13228                 _res_constr.data[o] = _res_conv_14_conv;
13229         }
13230         FREE(_res);
13231         CVec_RouteHintHopZ_free(_res_constr);
13232 }
13233
13234 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13235         LDKRouteHint o_conv;
13236         o_conv.inner = untag_ptr(o);
13237         o_conv.is_owned = ptr_is_owned(o);
13238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13239         o_conv = RouteHint_clone(&o_conv);
13240         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13241         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13242         return tag_ptr(ret_conv, true);
13243 }
13244
13245 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13246         void* e_ptr = untag_ptr(e);
13247         CHECK_ACCESS(e_ptr);
13248         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13249         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13250         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13251         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13252         return tag_ptr(ret_conv, true);
13253 }
13254
13255 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13256         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13257         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13258         return ret_conv;
13259 }
13260
13261 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13262         if (!ptr_is_owned(_res)) return;
13263         void* _res_ptr = untag_ptr(_res);
13264         CHECK_ACCESS(_res_ptr);
13265         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13266         FREE(untag_ptr(_res));
13267         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13268 }
13269
13270 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13271         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13272         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13273         return tag_ptr(ret_conv, true);
13274 }
13275 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13276         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13277         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13278         return ret_conv;
13279 }
13280
13281 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13282         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13283         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13284         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13285         return tag_ptr(ret_conv, true);
13286 }
13287
13288 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13289         LDKRouteHintHop o_conv;
13290         o_conv.inner = untag_ptr(o);
13291         o_conv.is_owned = ptr_is_owned(o);
13292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13293         o_conv = RouteHintHop_clone(&o_conv);
13294         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13295         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13296         return tag_ptr(ret_conv, true);
13297 }
13298
13299 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13300         void* e_ptr = untag_ptr(e);
13301         CHECK_ACCESS(e_ptr);
13302         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13303         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13304         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13305         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13306         return tag_ptr(ret_conv, true);
13307 }
13308
13309 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13310         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13311         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13312         return ret_conv;
13313 }
13314
13315 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13316         if (!ptr_is_owned(_res)) return;
13317         void* _res_ptr = untag_ptr(_res);
13318         CHECK_ACCESS(_res_ptr);
13319         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13320         FREE(untag_ptr(_res));
13321         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13322 }
13323
13324 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13325         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13326         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13327         return tag_ptr(ret_conv, true);
13328 }
13329 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13330         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13331         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13332         return ret_conv;
13333 }
13334
13335 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13336         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13337         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13338         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13339         return tag_ptr(ret_conv, true);
13340 }
13341
13342 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
13343         void* o_ptr = untag_ptr(o);
13344         CHECK_ACCESS(o_ptr);
13345         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
13346         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
13347         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13348         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
13349         return tag_ptr(ret_conv, true);
13350 }
13351
13352 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
13353         void* e_ptr = untag_ptr(e);
13354         CHECK_ACCESS(e_ptr);
13355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13357         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13358         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
13359         return tag_ptr(ret_conv, true);
13360 }
13361
13362 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
13363         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
13364         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
13365         return ret_conv;
13366 }
13367
13368 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
13369         if (!ptr_is_owned(_res)) return;
13370         void* _res_ptr = untag_ptr(_res);
13371         CHECK_ACCESS(_res_ptr);
13372         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
13373         FREE(untag_ptr(_res));
13374         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
13375 }
13376
13377 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
13378         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13379         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
13380         return tag_ptr(ret_conv, true);
13381 }
13382 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
13383         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
13384         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
13385         return ret_conv;
13386 }
13387
13388 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
13389         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
13390         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13391         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
13392         return tag_ptr(ret_conv, true);
13393 }
13394
13395 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
13396         void* o_ptr = untag_ptr(o);
13397         CHECK_ACCESS(o_ptr);
13398         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13399         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
13400         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13401         *ret_copy = COption_ClosureReasonZ_some(o_conv);
13402         uint64_t ret_ref = tag_ptr(ret_copy, true);
13403         return ret_ref;
13404 }
13405
13406 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
13407         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13408         *ret_copy = COption_ClosureReasonZ_none();
13409         uint64_t ret_ref = tag_ptr(ret_copy, true);
13410         return ret_ref;
13411 }
13412
13413 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
13414         if (!ptr_is_owned(_res)) return;
13415         void* _res_ptr = untag_ptr(_res);
13416         CHECK_ACCESS(_res_ptr);
13417         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13418         FREE(untag_ptr(_res));
13419         COption_ClosureReasonZ_free(_res_conv);
13420 }
13421
13422 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13423         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13424         *ret_copy = COption_ClosureReasonZ_clone(arg);
13425         uint64_t ret_ref = tag_ptr(ret_copy, true);
13426         return ret_ref;
13427 }
13428 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13429         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13430         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13431         return ret_conv;
13432 }
13433
13434 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13435         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13436         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13437         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13438         uint64_t ret_ref = tag_ptr(ret_copy, true);
13439         return ret_ref;
13440 }
13441
13442 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13443         void* o_ptr = untag_ptr(o);
13444         CHECK_ACCESS(o_ptr);
13445         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13446         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13447         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13448         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13449         return tag_ptr(ret_conv, true);
13450 }
13451
13452 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13453         void* e_ptr = untag_ptr(e);
13454         CHECK_ACCESS(e_ptr);
13455         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13456         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13457         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13458         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13459         return tag_ptr(ret_conv, true);
13460 }
13461
13462 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13463         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13464         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13465         return ret_conv;
13466 }
13467
13468 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13469         if (!ptr_is_owned(_res)) return;
13470         void* _res_ptr = untag_ptr(_res);
13471         CHECK_ACCESS(_res_ptr);
13472         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13473         FREE(untag_ptr(_res));
13474         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13475 }
13476
13477 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13478         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13479         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13480         return tag_ptr(ret_conv, true);
13481 }
13482 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13483         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13484         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13485         return ret_conv;
13486 }
13487
13488 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13489         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13490         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13491         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13492         return tag_ptr(ret_conv, true);
13493 }
13494
13495 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13496         void* o_ptr = untag_ptr(o);
13497         CHECK_ACCESS(o_ptr);
13498         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13499         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13500         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13501         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13502         uint64_t ret_ref = tag_ptr(ret_copy, true);
13503         return ret_ref;
13504 }
13505
13506 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13507         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13508         *ret_copy = COption_HTLCDestinationZ_none();
13509         uint64_t ret_ref = tag_ptr(ret_copy, true);
13510         return ret_ref;
13511 }
13512
13513 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13514         if (!ptr_is_owned(_res)) return;
13515         void* _res_ptr = untag_ptr(_res);
13516         CHECK_ACCESS(_res_ptr);
13517         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13518         FREE(untag_ptr(_res));
13519         COption_HTLCDestinationZ_free(_res_conv);
13520 }
13521
13522 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13523         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13524         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13525         uint64_t ret_ref = tag_ptr(ret_copy, true);
13526         return ret_ref;
13527 }
13528 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13529         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13530         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13531         return ret_conv;
13532 }
13533
13534 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13535         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13536         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13537         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13538         uint64_t ret_ref = tag_ptr(ret_copy, true);
13539         return ret_ref;
13540 }
13541
13542 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13543         void* o_ptr = untag_ptr(o);
13544         CHECK_ACCESS(o_ptr);
13545         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13546         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13547         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13548         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13549         return tag_ptr(ret_conv, true);
13550 }
13551
13552 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13553         void* e_ptr = untag_ptr(e);
13554         CHECK_ACCESS(e_ptr);
13555         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13556         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13557         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13558         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13559         return tag_ptr(ret_conv, true);
13560 }
13561
13562 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13563         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13564         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13565         return ret_conv;
13566 }
13567
13568 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13569         if (!ptr_is_owned(_res)) return;
13570         void* _res_ptr = untag_ptr(_res);
13571         CHECK_ACCESS(_res_ptr);
13572         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13573         FREE(untag_ptr(_res));
13574         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13575 }
13576
13577 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13578         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13579         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13580         return tag_ptr(ret_conv, true);
13581 }
13582 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13583         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13584         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13585         return ret_conv;
13586 }
13587
13588 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13589         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13590         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13591         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13592         return tag_ptr(ret_conv, true);
13593 }
13594
13595 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
13596         LDKU128 o_ref;
13597         CHECK(o->arr_len == 16);
13598         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
13599         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13600         *ret_copy = COption_u128Z_some(o_ref);
13601         uint64_t ret_ref = tag_ptr(ret_copy, true);
13602         return ret_ref;
13603 }
13604
13605 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
13606         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13607         *ret_copy = COption_u128Z_none();
13608         uint64_t ret_ref = tag_ptr(ret_copy, true);
13609         return ret_ref;
13610 }
13611
13612 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
13613         if (!ptr_is_owned(_res)) return;
13614         void* _res_ptr = untag_ptr(_res);
13615         CHECK_ACCESS(_res_ptr);
13616         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
13617         FREE(untag_ptr(_res));
13618         COption_u128Z_free(_res_conv);
13619 }
13620
13621 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
13622         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13623         *ret_copy = COption_u128Z_clone(arg);
13624         uint64_t ret_ref = tag_ptr(ret_copy, true);
13625         return ret_ref;
13626 }
13627 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
13628         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
13629         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
13630         return ret_conv;
13631 }
13632
13633 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
13634         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
13635         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13636         *ret_copy = COption_u128Z_clone(orig_conv);
13637         uint64_t ret_ref = tag_ptr(ret_copy, true);
13638         return ret_ref;
13639 }
13640
13641 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13642         void* o_ptr = untag_ptr(o);
13643         CHECK_ACCESS(o_ptr);
13644         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13645         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13646         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13647         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13648         uint64_t ret_ref = tag_ptr(ret_copy, true);
13649         return ret_ref;
13650 }
13651
13652 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13653         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13654         *ret_copy = COption_NetworkUpdateZ_none();
13655         uint64_t ret_ref = tag_ptr(ret_copy, true);
13656         return ret_ref;
13657 }
13658
13659 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13660         if (!ptr_is_owned(_res)) return;
13661         void* _res_ptr = untag_ptr(_res);
13662         CHECK_ACCESS(_res_ptr);
13663         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13664         FREE(untag_ptr(_res));
13665         COption_NetworkUpdateZ_free(_res_conv);
13666 }
13667
13668 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13669         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13670         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13671         uint64_t ret_ref = tag_ptr(ret_copy, true);
13672         return ret_ref;
13673 }
13674 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13675         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13676         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13677         return ret_conv;
13678 }
13679
13680 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13681         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13682         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13683         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13684         uint64_t ret_ref = tag_ptr(ret_copy, true);
13685         return ret_ref;
13686 }
13687
13688 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13689         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13690         _res_constr.datalen = _res->arr_len;
13691         if (_res_constr.datalen > 0)
13692                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13693         else
13694                 _res_constr.data = NULL;
13695         uint64_t* _res_vals = _res->elems;
13696         for (size_t b = 0; b < _res_constr.datalen; b++) {
13697                 uint64_t _res_conv_27 = _res_vals[b];
13698                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13699                 CHECK_ACCESS(_res_conv_27_ptr);
13700                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13701                 FREE(untag_ptr(_res_conv_27));
13702                 _res_constr.data[b] = _res_conv_27_conv;
13703         }
13704         FREE(_res);
13705         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13706 }
13707
13708 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13709         void* o_ptr = untag_ptr(o);
13710         CHECK_ACCESS(o_ptr);
13711         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13712         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13713         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13714         *ret_copy = COption_EventZ_some(o_conv);
13715         uint64_t ret_ref = tag_ptr(ret_copy, true);
13716         return ret_ref;
13717 }
13718
13719 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13720         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13721         *ret_copy = COption_EventZ_none();
13722         uint64_t ret_ref = tag_ptr(ret_copy, true);
13723         return ret_ref;
13724 }
13725
13726 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13727         if (!ptr_is_owned(_res)) return;
13728         void* _res_ptr = untag_ptr(_res);
13729         CHECK_ACCESS(_res_ptr);
13730         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13731         FREE(untag_ptr(_res));
13732         COption_EventZ_free(_res_conv);
13733 }
13734
13735 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13736         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13737         *ret_copy = COption_EventZ_clone(arg);
13738         uint64_t ret_ref = tag_ptr(ret_copy, true);
13739         return ret_ref;
13740 }
13741 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13742         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13743         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13744         return ret_conv;
13745 }
13746
13747 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13748         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13749         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13750         *ret_copy = COption_EventZ_clone(orig_conv);
13751         uint64_t ret_ref = tag_ptr(ret_copy, true);
13752         return ret_ref;
13753 }
13754
13755 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13756         void* o_ptr = untag_ptr(o);
13757         CHECK_ACCESS(o_ptr);
13758         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13759         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13760         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13761         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13762         return tag_ptr(ret_conv, true);
13763 }
13764
13765 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13766         void* e_ptr = untag_ptr(e);
13767         CHECK_ACCESS(e_ptr);
13768         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13769         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13770         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13771         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13772         return tag_ptr(ret_conv, true);
13773 }
13774
13775 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13776         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13777         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13778         return ret_conv;
13779 }
13780
13781 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13782         if (!ptr_is_owned(_res)) return;
13783         void* _res_ptr = untag_ptr(_res);
13784         CHECK_ACCESS(_res_ptr);
13785         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13786         FREE(untag_ptr(_res));
13787         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13788 }
13789
13790 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13791         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13792         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13793         return tag_ptr(ret_conv, true);
13794 }
13795 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13796         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13797         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13798         return ret_conv;
13799 }
13800
13801 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13802         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13803         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13804         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13805         return tag_ptr(ret_conv, true);
13806 }
13807
13808 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13809         LDKCVec_MessageSendEventZ _res_constr;
13810         _res_constr.datalen = _res->arr_len;
13811         if (_res_constr.datalen > 0)
13812                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13813         else
13814                 _res_constr.data = NULL;
13815         uint64_t* _res_vals = _res->elems;
13816         for (size_t s = 0; s < _res_constr.datalen; s++) {
13817                 uint64_t _res_conv_18 = _res_vals[s];
13818                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13819                 CHECK_ACCESS(_res_conv_18_ptr);
13820                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13821                 FREE(untag_ptr(_res_conv_18));
13822                 _res_constr.data[s] = _res_conv_18_conv;
13823         }
13824         FREE(_res);
13825         CVec_MessageSendEventZ_free(_res_constr);
13826 }
13827
13828 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13829         void* o_ptr = untag_ptr(o);
13830         CHECK_ACCESS(o_ptr);
13831         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13832         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13833         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13834         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13835         return tag_ptr(ret_conv, true);
13836 }
13837
13838 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13839         LDKAccessError e_conv = LDKAccessError_from_js(e);
13840         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13841         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13842         return tag_ptr(ret_conv, true);
13843 }
13844
13845 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13846         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13847         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13848         return ret_conv;
13849 }
13850
13851 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13852         if (!ptr_is_owned(_res)) return;
13853         void* _res_ptr = untag_ptr(_res);
13854         CHECK_ACCESS(_res_ptr);
13855         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13856         FREE(untag_ptr(_res));
13857         CResult_TxOutAccessErrorZ_free(_res_conv);
13858 }
13859
13860 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13861         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13862         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13863         return tag_ptr(ret_conv, true);
13864 }
13865 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13866         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13867         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13868         return ret_conv;
13869 }
13870
13871 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13872         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13873         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13874         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13875         return tag_ptr(ret_conv, true);
13876 }
13877
13878 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13879         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13880         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13881         return tag_ptr(ret_conv, true);
13882 }
13883 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13884         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13885         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13886         return ret_conv;
13887 }
13888
13889 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13890         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13891         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13892         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13893         return tag_ptr(ret_conv, true);
13894 }
13895
13896 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13897         LDKTransaction b_ref;
13898         b_ref.datalen = b->arr_len;
13899         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13900         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13901         b_ref.data_is_owned = true;
13902         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13903         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13904         return tag_ptr(ret_conv, true);
13905 }
13906
13907 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13908         if (!ptr_is_owned(_res)) return;
13909         void* _res_ptr = untag_ptr(_res);
13910         CHECK_ACCESS(_res_ptr);
13911         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13912         FREE(untag_ptr(_res));
13913         C2Tuple_usizeTransactionZ_free(_res_conv);
13914 }
13915
13916 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13917         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13918         _res_constr.datalen = _res->arr_len;
13919         if (_res_constr.datalen > 0)
13920                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13921         else
13922                 _res_constr.data = NULL;
13923         uint64_t* _res_vals = _res->elems;
13924         for (size_t c = 0; c < _res_constr.datalen; c++) {
13925                 uint64_t _res_conv_28 = _res_vals[c];
13926                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13927                 CHECK_ACCESS(_res_conv_28_ptr);
13928                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13929                 FREE(untag_ptr(_res_conv_28));
13930                 _res_constr.data[c] = _res_conv_28_conv;
13931         }
13932         FREE(_res);
13933         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13934 }
13935
13936 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
13937         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13938         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
13939         return tag_ptr(ret_conv, true);
13940 }
13941 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
13942         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
13943         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
13944         return ret_conv;
13945 }
13946
13947 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
13948         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
13949         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13950         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
13951         return tag_ptr(ret_conv, true);
13952 }
13953
13954 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
13955         LDKThirtyTwoBytes a_ref;
13956         CHECK(a->arr_len == 32);
13957         memcpy(a_ref.data, a->elems, 32); FREE(a);
13958         LDKThirtyTwoBytes b_ref;
13959         CHECK(b->arr_len == 32);
13960         memcpy(b_ref.data, b->elems, 32); FREE(b);
13961         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13962         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
13963         return tag_ptr(ret_conv, true);
13964 }
13965
13966 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
13967         if (!ptr_is_owned(_res)) return;
13968         void* _res_ptr = untag_ptr(_res);
13969         CHECK_ACCESS(_res_ptr);
13970         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
13971         FREE(untag_ptr(_res));
13972         C2Tuple_TxidBlockHashZ_free(_res_conv);
13973 }
13974
13975 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
13976         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
13977         _res_constr.datalen = _res->arr_len;
13978         if (_res_constr.datalen > 0)
13979                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
13980         else
13981                 _res_constr.data = NULL;
13982         uint64_t* _res_vals = _res->elems;
13983         for (size_t z = 0; z < _res_constr.datalen; z++) {
13984                 uint64_t _res_conv_25 = _res_vals[z];
13985                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
13986                 CHECK_ACCESS(_res_conv_25_ptr);
13987                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
13988                 FREE(untag_ptr(_res_conv_25));
13989                 _res_constr.data[z] = _res_conv_25_conv;
13990         }
13991         FREE(_res);
13992         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
13993 }
13994
13995 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13996         LDKCVec_MonitorEventZ _res_constr;
13997         _res_constr.datalen = _res->arr_len;
13998         if (_res_constr.datalen > 0)
13999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14000         else
14001                 _res_constr.data = NULL;
14002         uint64_t* _res_vals = _res->elems;
14003         for (size_t o = 0; o < _res_constr.datalen; o++) {
14004                 uint64_t _res_conv_14 = _res_vals[o];
14005                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
14006                 CHECK_ACCESS(_res_conv_14_ptr);
14007                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
14008                 FREE(untag_ptr(_res_conv_14));
14009                 _res_constr.data[o] = _res_conv_14_conv;
14010         }
14011         FREE(_res);
14012         CVec_MonitorEventZ_free(_res_constr);
14013 }
14014
14015 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
14016         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14017         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
14018         return tag_ptr(ret_conv, true);
14019 }
14020 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
14021         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
14022         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
14023         return ret_conv;
14024 }
14025
14026 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
14027         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
14028         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14029         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
14030         return tag_ptr(ret_conv, true);
14031 }
14032
14033 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14034         LDKOutPoint a_conv;
14035         a_conv.inner = untag_ptr(a);
14036         a_conv.is_owned = ptr_is_owned(a);
14037         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14038         a_conv = OutPoint_clone(&a_conv);
14039         LDKCVec_MonitorEventZ b_constr;
14040         b_constr.datalen = b->arr_len;
14041         if (b_constr.datalen > 0)
14042                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14043         else
14044                 b_constr.data = NULL;
14045         uint64_t* b_vals = b->elems;
14046         for (size_t o = 0; o < b_constr.datalen; o++) {
14047                 uint64_t b_conv_14 = b_vals[o];
14048                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14049                 CHECK_ACCESS(b_conv_14_ptr);
14050                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14051                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14052                 b_constr.data[o] = b_conv_14_conv;
14053         }
14054         FREE(b);
14055         LDKPublicKey c_ref;
14056         CHECK(c->arr_len == 33);
14057         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14058         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14059         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14060         return tag_ptr(ret_conv, true);
14061 }
14062
14063 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14064         if (!ptr_is_owned(_res)) return;
14065         void* _res_ptr = untag_ptr(_res);
14066         CHECK_ACCESS(_res_ptr);
14067         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14068         FREE(untag_ptr(_res));
14069         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14070 }
14071
14072 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14073         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14074         _res_constr.datalen = _res->arr_len;
14075         if (_res_constr.datalen > 0)
14076                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14077         else
14078                 _res_constr.data = NULL;
14079         uint64_t* _res_vals = _res->elems;
14080         for (size_t x = 0; x < _res_constr.datalen; x++) {
14081                 uint64_t _res_conv_49 = _res_vals[x];
14082                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14083                 CHECK_ACCESS(_res_conv_49_ptr);
14084                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14085                 FREE(untag_ptr(_res_conv_49));
14086                 _res_constr.data[x] = _res_conv_49_conv;
14087         }
14088         FREE(_res);
14089         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14090 }
14091
14092 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14093         LDKFixedPenaltyScorer o_conv;
14094         o_conv.inner = untag_ptr(o);
14095         o_conv.is_owned = ptr_is_owned(o);
14096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14097         o_conv = FixedPenaltyScorer_clone(&o_conv);
14098         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14099         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14100         return tag_ptr(ret_conv, true);
14101 }
14102
14103 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14104         void* e_ptr = untag_ptr(e);
14105         CHECK_ACCESS(e_ptr);
14106         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14107         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14108         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14109         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14110         return tag_ptr(ret_conv, true);
14111 }
14112
14113 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14114         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14115         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14116         return ret_conv;
14117 }
14118
14119 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14120         if (!ptr_is_owned(_res)) return;
14121         void* _res_ptr = untag_ptr(_res);
14122         CHECK_ACCESS(_res_ptr);
14123         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14124         FREE(untag_ptr(_res));
14125         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14126 }
14127
14128 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14129         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14130         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14131         return tag_ptr(ret_conv, true);
14132 }
14133 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14134         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14135         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14136         return ret_conv;
14137 }
14138
14139 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14140         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14141         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14142         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14143         return tag_ptr(ret_conv, true);
14144 }
14145
14146 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14147         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14148         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14149         return tag_ptr(ret_conv, true);
14150 }
14151 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14152         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14153         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14154         return ret_conv;
14155 }
14156
14157 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14158         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14159         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14160         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14161         return tag_ptr(ret_conv, true);
14162 }
14163
14164 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14165         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14166         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14167         return tag_ptr(ret_conv, true);
14168 }
14169
14170 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14171         if (!ptr_is_owned(_res)) return;
14172         void* _res_ptr = untag_ptr(_res);
14173         CHECK_ACCESS(_res_ptr);
14174         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14175         FREE(untag_ptr(_res));
14176         C2Tuple_u64u64Z_free(_res_conv);
14177 }
14178
14179 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14180         void* o_ptr = untag_ptr(o);
14181         CHECK_ACCESS(o_ptr);
14182         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14183         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14184         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14185         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14186         uint64_t ret_ref = tag_ptr(ret_copy, true);
14187         return ret_ref;
14188 }
14189
14190 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14191         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14192         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14193         uint64_t ret_ref = tag_ptr(ret_copy, true);
14194         return ret_ref;
14195 }
14196
14197 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14198         if (!ptr_is_owned(_res)) return;
14199         void* _res_ptr = untag_ptr(_res);
14200         CHECK_ACCESS(_res_ptr);
14201         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14202         FREE(untag_ptr(_res));
14203         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14204 }
14205
14206 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14207         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14208         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14209         uint64_t ret_ref = tag_ptr(ret_copy, true);
14210         return ret_ref;
14211 }
14212 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14213         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14214         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14215         return ret_conv;
14216 }
14217
14218 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14219         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14220         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14221         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14222         uint64_t ret_ref = tag_ptr(ret_copy, true);
14223         return ret_ref;
14224 }
14225
14226 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14227         LDKCVec_NodeIdZ _res_constr;
14228         _res_constr.datalen = _res->arr_len;
14229         if (_res_constr.datalen > 0)
14230                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14231         else
14232                 _res_constr.data = NULL;
14233         uint64_t* _res_vals = _res->elems;
14234         for (size_t i = 0; i < _res_constr.datalen; i++) {
14235                 uint64_t _res_conv_8 = _res_vals[i];
14236                 LDKNodeId _res_conv_8_conv;
14237                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14238                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14239                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14240                 _res_constr.data[i] = _res_conv_8_conv;
14241         }
14242         FREE(_res);
14243         CVec_NodeIdZ_free(_res_constr);
14244 }
14245
14246 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14247         LDKProbabilisticScorer o_conv;
14248         o_conv.inner = untag_ptr(o);
14249         o_conv.is_owned = ptr_is_owned(o);
14250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14251         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14252         
14253         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14254         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14255         return tag_ptr(ret_conv, true);
14256 }
14257
14258 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14259         void* e_ptr = untag_ptr(e);
14260         CHECK_ACCESS(e_ptr);
14261         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14262         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14263         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14264         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14265         return tag_ptr(ret_conv, true);
14266 }
14267
14268 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14269         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14270         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14271         return ret_conv;
14272 }
14273
14274 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14275         if (!ptr_is_owned(_res)) return;
14276         void* _res_ptr = untag_ptr(_res);
14277         CHECK_ACCESS(_res_ptr);
14278         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14279         FREE(untag_ptr(_res));
14280         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14281 }
14282
14283 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14284         LDKInitFeatures o_conv;
14285         o_conv.inner = untag_ptr(o);
14286         o_conv.is_owned = ptr_is_owned(o);
14287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14288         o_conv = InitFeatures_clone(&o_conv);
14289         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14290         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14291         return tag_ptr(ret_conv, true);
14292 }
14293
14294 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14295         void* e_ptr = untag_ptr(e);
14296         CHECK_ACCESS(e_ptr);
14297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14299         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14300         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14301         return tag_ptr(ret_conv, true);
14302 }
14303
14304 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14305         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14306         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14307         return ret_conv;
14308 }
14309
14310 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14311         if (!ptr_is_owned(_res)) return;
14312         void* _res_ptr = untag_ptr(_res);
14313         CHECK_ACCESS(_res_ptr);
14314         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14315         FREE(untag_ptr(_res));
14316         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14317 }
14318
14319 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14320         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14321         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14322         return tag_ptr(ret_conv, true);
14323 }
14324 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14325         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14326         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14327         return ret_conv;
14328 }
14329
14330 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14331         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14332         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14333         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14334         return tag_ptr(ret_conv, true);
14335 }
14336
14337 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14338         LDKChannelFeatures o_conv;
14339         o_conv.inner = untag_ptr(o);
14340         o_conv.is_owned = ptr_is_owned(o);
14341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14342         o_conv = ChannelFeatures_clone(&o_conv);
14343         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14344         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14345         return tag_ptr(ret_conv, true);
14346 }
14347
14348 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14349         void* e_ptr = untag_ptr(e);
14350         CHECK_ACCESS(e_ptr);
14351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14353         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14354         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14355         return tag_ptr(ret_conv, true);
14356 }
14357
14358 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14359         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14360         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14361         return ret_conv;
14362 }
14363
14364 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14365         if (!ptr_is_owned(_res)) return;
14366         void* _res_ptr = untag_ptr(_res);
14367         CHECK_ACCESS(_res_ptr);
14368         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14369         FREE(untag_ptr(_res));
14370         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14371 }
14372
14373 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14374         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14375         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14376         return tag_ptr(ret_conv, true);
14377 }
14378 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14379         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14380         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14381         return ret_conv;
14382 }
14383
14384 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14385         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14386         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14387         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14388         return tag_ptr(ret_conv, true);
14389 }
14390
14391 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14392         LDKNodeFeatures o_conv;
14393         o_conv.inner = untag_ptr(o);
14394         o_conv.is_owned = ptr_is_owned(o);
14395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14396         o_conv = NodeFeatures_clone(&o_conv);
14397         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14398         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14399         return tag_ptr(ret_conv, true);
14400 }
14401
14402 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14403         void* e_ptr = untag_ptr(e);
14404         CHECK_ACCESS(e_ptr);
14405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14407         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14408         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14409         return tag_ptr(ret_conv, true);
14410 }
14411
14412 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14413         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14414         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14415         return ret_conv;
14416 }
14417
14418 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14419         if (!ptr_is_owned(_res)) return;
14420         void* _res_ptr = untag_ptr(_res);
14421         CHECK_ACCESS(_res_ptr);
14422         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14423         FREE(untag_ptr(_res));
14424         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14425 }
14426
14427 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14428         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14429         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14430         return tag_ptr(ret_conv, true);
14431 }
14432 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14433         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14434         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14435         return ret_conv;
14436 }
14437
14438 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14439         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14440         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14441         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14442         return tag_ptr(ret_conv, true);
14443 }
14444
14445 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14446         LDKInvoiceFeatures o_conv;
14447         o_conv.inner = untag_ptr(o);
14448         o_conv.is_owned = ptr_is_owned(o);
14449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14450         o_conv = InvoiceFeatures_clone(&o_conv);
14451         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14452         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14453         return tag_ptr(ret_conv, true);
14454 }
14455
14456 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14457         void* e_ptr = untag_ptr(e);
14458         CHECK_ACCESS(e_ptr);
14459         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14460         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14461         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14462         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14463         return tag_ptr(ret_conv, true);
14464 }
14465
14466 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14467         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14468         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14469         return ret_conv;
14470 }
14471
14472 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14473         if (!ptr_is_owned(_res)) return;
14474         void* _res_ptr = untag_ptr(_res);
14475         CHECK_ACCESS(_res_ptr);
14476         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14477         FREE(untag_ptr(_res));
14478         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14479 }
14480
14481 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14482         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14483         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14484         return tag_ptr(ret_conv, true);
14485 }
14486 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14487         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14488         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14489         return ret_conv;
14490 }
14491
14492 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14493         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14494         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14495         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14496         return tag_ptr(ret_conv, true);
14497 }
14498
14499 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14500         LDKChannelTypeFeatures o_conv;
14501         o_conv.inner = untag_ptr(o);
14502         o_conv.is_owned = ptr_is_owned(o);
14503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14504         o_conv = ChannelTypeFeatures_clone(&o_conv);
14505         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14506         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14507         return tag_ptr(ret_conv, true);
14508 }
14509
14510 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14511         void* e_ptr = untag_ptr(e);
14512         CHECK_ACCESS(e_ptr);
14513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14515         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14516         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14517         return tag_ptr(ret_conv, true);
14518 }
14519
14520 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14521         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14522         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14523         return ret_conv;
14524 }
14525
14526 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14527         if (!ptr_is_owned(_res)) return;
14528         void* _res_ptr = untag_ptr(_res);
14529         CHECK_ACCESS(_res_ptr);
14530         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14531         FREE(untag_ptr(_res));
14532         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14533 }
14534
14535 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14536         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14537         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14538         return tag_ptr(ret_conv, true);
14539 }
14540 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14541         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14542         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14543         return ret_conv;
14544 }
14545
14546 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14547         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14548         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14549         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14550         return tag_ptr(ret_conv, true);
14551 }
14552
14553 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_ok(uint64_t o) {
14554         LDKOfferFeatures o_conv;
14555         o_conv.inner = untag_ptr(o);
14556         o_conv.is_owned = ptr_is_owned(o);
14557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14558         o_conv = OfferFeatures_clone(&o_conv);
14559         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14560         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_ok(o_conv);
14561         return tag_ptr(ret_conv, true);
14562 }
14563
14564 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_err(uint64_t e) {
14565         void* e_ptr = untag_ptr(e);
14566         CHECK_ACCESS(e_ptr);
14567         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14568         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14569         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14570         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_err(e_conv);
14571         return tag_ptr(ret_conv, true);
14572 }
14573
14574 jboolean  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_is_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14575         LDKCResult_OfferFeaturesDecodeErrorZ* o_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(o);
14576         jboolean ret_conv = CResult_OfferFeaturesDecodeErrorZ_is_ok(o_conv);
14577         return ret_conv;
14578 }
14579
14580 void  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_free"))) TS_CResult_OfferFeaturesDecodeErrorZ_free(uint64_t _res) {
14581         if (!ptr_is_owned(_res)) return;
14582         void* _res_ptr = untag_ptr(_res);
14583         CHECK_ACCESS(_res_ptr);
14584         LDKCResult_OfferFeaturesDecodeErrorZ _res_conv = *(LDKCResult_OfferFeaturesDecodeErrorZ*)(_res_ptr);
14585         FREE(untag_ptr(_res));
14586         CResult_OfferFeaturesDecodeErrorZ_free(_res_conv);
14587 }
14588
14589 static inline uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14590         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14591         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(arg);
14592         return tag_ptr(ret_conv, true);
14593 }
14594 int64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14595         LDKCResult_OfferFeaturesDecodeErrorZ* arg_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(arg);
14596         int64_t ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14597         return ret_conv;
14598 }
14599
14600 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone(uint64_t orig) {
14601         LDKCResult_OfferFeaturesDecodeErrorZ* orig_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(orig);
14602         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14603         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(orig_conv);
14604         return tag_ptr(ret_conv, true);
14605 }
14606
14607 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(uint64_t o) {
14608         LDKInvoiceRequestFeatures o_conv;
14609         o_conv.inner = untag_ptr(o);
14610         o_conv.is_owned = ptr_is_owned(o);
14611         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14612         o_conv = InvoiceRequestFeatures_clone(&o_conv);
14613         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14614         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o_conv);
14615         return tag_ptr(ret_conv, true);
14616 }
14617
14618 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err(uint64_t e) {
14619         void* e_ptr = untag_ptr(e);
14620         CHECK_ACCESS(e_ptr);
14621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14623         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14624         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e_conv);
14625         return tag_ptr(ret_conv, true);
14626 }
14627
14628 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14629         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(o);
14630         jboolean ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o_conv);
14631         return ret_conv;
14632 }
14633
14634 void  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free(uint64_t _res) {
14635         if (!ptr_is_owned(_res)) return;
14636         void* _res_ptr = untag_ptr(_res);
14637         CHECK_ACCESS(_res_ptr);
14638         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)(_res_ptr);
14639         FREE(untag_ptr(_res));
14640         CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv);
14641 }
14642
14643 static inline uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14644         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14645         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(arg);
14646         return tag_ptr(ret_conv, true);
14647 }
14648 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14649         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(arg);
14650         int64_t ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14651         return ret_conv;
14652 }
14653
14654 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(uint64_t orig) {
14655         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(orig);
14656         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14657         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig_conv);
14658         return tag_ptr(ret_conv, true);
14659 }
14660
14661 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14662         LDKNodeId o_conv;
14663         o_conv.inner = untag_ptr(o);
14664         o_conv.is_owned = ptr_is_owned(o);
14665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14666         o_conv = NodeId_clone(&o_conv);
14667         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14668         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14669         return tag_ptr(ret_conv, true);
14670 }
14671
14672 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14673         void* e_ptr = untag_ptr(e);
14674         CHECK_ACCESS(e_ptr);
14675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14677         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14678         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14679         return tag_ptr(ret_conv, true);
14680 }
14681
14682 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14683         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14684         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14685         return ret_conv;
14686 }
14687
14688 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14689         if (!ptr_is_owned(_res)) return;
14690         void* _res_ptr = untag_ptr(_res);
14691         CHECK_ACCESS(_res_ptr);
14692         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14693         FREE(untag_ptr(_res));
14694         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14695 }
14696
14697 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14698         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14699         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14700         return tag_ptr(ret_conv, true);
14701 }
14702 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14703         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14704         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14705         return ret_conv;
14706 }
14707
14708 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14709         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14710         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14711         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14712         return tag_ptr(ret_conv, true);
14713 }
14714
14715 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14716         void* o_ptr = untag_ptr(o);
14717         CHECK_ACCESS(o_ptr);
14718         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14719         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14720         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14721         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14722         return tag_ptr(ret_conv, true);
14723 }
14724
14725 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14726         void* e_ptr = untag_ptr(e);
14727         CHECK_ACCESS(e_ptr);
14728         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14729         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14730         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14731         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14732         return tag_ptr(ret_conv, true);
14733 }
14734
14735 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14736         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14737         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14738         return ret_conv;
14739 }
14740
14741 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14742         if (!ptr_is_owned(_res)) return;
14743         void* _res_ptr = untag_ptr(_res);
14744         CHECK_ACCESS(_res_ptr);
14745         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14746         FREE(untag_ptr(_res));
14747         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14748 }
14749
14750 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14751         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14752         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14753         return tag_ptr(ret_conv, true);
14754 }
14755 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14756         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14757         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14758         return ret_conv;
14759 }
14760
14761 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14762         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14763         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14764         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14765         return tag_ptr(ret_conv, true);
14766 }
14767
14768 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14769         void* o_ptr = untag_ptr(o);
14770         CHECK_ACCESS(o_ptr);
14771         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14772         if (o_conv.free == LDKAccess_JCalls_free) {
14773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14774                 LDKAccess_JCalls_cloned(&o_conv);
14775         }
14776         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14777         *ret_copy = COption_AccessZ_some(o_conv);
14778         uint64_t ret_ref = tag_ptr(ret_copy, true);
14779         return ret_ref;
14780 }
14781
14782 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14783         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14784         *ret_copy = COption_AccessZ_none();
14785         uint64_t ret_ref = tag_ptr(ret_copy, true);
14786         return ret_ref;
14787 }
14788
14789 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14790         if (!ptr_is_owned(_res)) return;
14791         void* _res_ptr = untag_ptr(_res);
14792         CHECK_ACCESS(_res_ptr);
14793         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14794         FREE(untag_ptr(_res));
14795         COption_AccessZ_free(_res_conv);
14796 }
14797
14798 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14799         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14800         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14801         return tag_ptr(ret_conv, true);
14802 }
14803
14804 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14805         LDKLightningError e_conv;
14806         e_conv.inner = untag_ptr(e);
14807         e_conv.is_owned = ptr_is_owned(e);
14808         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14809         e_conv = LightningError_clone(&e_conv);
14810         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14811         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14812         return tag_ptr(ret_conv, true);
14813 }
14814
14815 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14816         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14817         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14818         return ret_conv;
14819 }
14820
14821 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14822         if (!ptr_is_owned(_res)) return;
14823         void* _res_ptr = untag_ptr(_res);
14824         CHECK_ACCESS(_res_ptr);
14825         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14826         FREE(untag_ptr(_res));
14827         CResult_boolLightningErrorZ_free(_res_conv);
14828 }
14829
14830 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14831         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14832         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14833         return tag_ptr(ret_conv, true);
14834 }
14835 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14836         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14837         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14838         return ret_conv;
14839 }
14840
14841 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14842         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14843         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14844         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14845         return tag_ptr(ret_conv, true);
14846 }
14847
14848 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14849         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14850         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14851         return tag_ptr(ret_conv, true);
14852 }
14853 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14854         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14855         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14856         return ret_conv;
14857 }
14858
14859 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14860         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14861         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14862         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14863         return tag_ptr(ret_conv, true);
14864 }
14865
14866 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14867         LDKChannelAnnouncement a_conv;
14868         a_conv.inner = untag_ptr(a);
14869         a_conv.is_owned = ptr_is_owned(a);
14870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14871         a_conv = ChannelAnnouncement_clone(&a_conv);
14872         LDKChannelUpdate b_conv;
14873         b_conv.inner = untag_ptr(b);
14874         b_conv.is_owned = ptr_is_owned(b);
14875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14876         b_conv = ChannelUpdate_clone(&b_conv);
14877         LDKChannelUpdate c_conv;
14878         c_conv.inner = untag_ptr(c);
14879         c_conv.is_owned = ptr_is_owned(c);
14880         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14881         c_conv = ChannelUpdate_clone(&c_conv);
14882         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14883         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14884         return tag_ptr(ret_conv, true);
14885 }
14886
14887 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14888         if (!ptr_is_owned(_res)) return;
14889         void* _res_ptr = untag_ptr(_res);
14890         CHECK_ACCESS(_res_ptr);
14891         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14892         FREE(untag_ptr(_res));
14893         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14894 }
14895
14896 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14897         void* o_ptr = untag_ptr(o);
14898         CHECK_ACCESS(o_ptr);
14899         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14900         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14901         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14902         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14903         uint64_t ret_ref = tag_ptr(ret_copy, true);
14904         return ret_ref;
14905 }
14906
14907 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14908         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14909         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14910         uint64_t ret_ref = tag_ptr(ret_copy, true);
14911         return ret_ref;
14912 }
14913
14914 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14915         if (!ptr_is_owned(_res)) return;
14916         void* _res_ptr = untag_ptr(_res);
14917         CHECK_ACCESS(_res_ptr);
14918         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14919         FREE(untag_ptr(_res));
14920         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14921 }
14922
14923 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14924         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14925         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14926         uint64_t ret_ref = tag_ptr(ret_copy, true);
14927         return ret_ref;
14928 }
14929 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14930         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14931         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14932         return ret_conv;
14933 }
14934
14935 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14936         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14937         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14938         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14939         uint64_t ret_ref = tag_ptr(ret_copy, true);
14940         return ret_ref;
14941 }
14942
14943 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14944         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14945         *ret_conv = CResult_NoneLightningErrorZ_ok();
14946         return tag_ptr(ret_conv, true);
14947 }
14948
14949 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14950         LDKLightningError e_conv;
14951         e_conv.inner = untag_ptr(e);
14952         e_conv.is_owned = ptr_is_owned(e);
14953         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14954         e_conv = LightningError_clone(&e_conv);
14955         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14956         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14957         return tag_ptr(ret_conv, true);
14958 }
14959
14960 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14961         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14962         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14963         return ret_conv;
14964 }
14965
14966 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14967         if (!ptr_is_owned(_res)) return;
14968         void* _res_ptr = untag_ptr(_res);
14969         CHECK_ACCESS(_res_ptr);
14970         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14971         FREE(untag_ptr(_res));
14972         CResult_NoneLightningErrorZ_free(_res_conv);
14973 }
14974
14975 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14976         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14977         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14978         return tag_ptr(ret_conv, true);
14979 }
14980 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14981         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14982         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14983         return ret_conv;
14984 }
14985
14986 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14987         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14988         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14989         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14990         return tag_ptr(ret_conv, true);
14991 }
14992
14993 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14994         LDKChannelUpdateInfo o_conv;
14995         o_conv.inner = untag_ptr(o);
14996         o_conv.is_owned = ptr_is_owned(o);
14997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14998         o_conv = ChannelUpdateInfo_clone(&o_conv);
14999         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15000         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15001         return tag_ptr(ret_conv, true);
15002 }
15003
15004 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15005         void* e_ptr = untag_ptr(e);
15006         CHECK_ACCESS(e_ptr);
15007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15009         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15010         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15011         return tag_ptr(ret_conv, true);
15012 }
15013
15014 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15015         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15016         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15017         return ret_conv;
15018 }
15019
15020 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15021         if (!ptr_is_owned(_res)) return;
15022         void* _res_ptr = untag_ptr(_res);
15023         CHECK_ACCESS(_res_ptr);
15024         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15025         FREE(untag_ptr(_res));
15026         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15027 }
15028
15029 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15030         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15031         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15032         return tag_ptr(ret_conv, true);
15033 }
15034 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15035         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15036         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15037         return ret_conv;
15038 }
15039
15040 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15041         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15042         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15043         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15044         return tag_ptr(ret_conv, true);
15045 }
15046
15047 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15048         LDKChannelInfo o_conv;
15049         o_conv.inner = untag_ptr(o);
15050         o_conv.is_owned = ptr_is_owned(o);
15051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15052         o_conv = ChannelInfo_clone(&o_conv);
15053         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15054         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15055         return tag_ptr(ret_conv, true);
15056 }
15057
15058 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15059         void* e_ptr = untag_ptr(e);
15060         CHECK_ACCESS(e_ptr);
15061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15063         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15064         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15065         return tag_ptr(ret_conv, true);
15066 }
15067
15068 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15069         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15070         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15071         return ret_conv;
15072 }
15073
15074 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15075         if (!ptr_is_owned(_res)) return;
15076         void* _res_ptr = untag_ptr(_res);
15077         CHECK_ACCESS(_res_ptr);
15078         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15079         FREE(untag_ptr(_res));
15080         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15081 }
15082
15083 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15084         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15085         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15086         return tag_ptr(ret_conv, true);
15087 }
15088 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15089         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15090         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15091         return ret_conv;
15092 }
15093
15094 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15095         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15096         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15097         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15098         return tag_ptr(ret_conv, true);
15099 }
15100
15101 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15102         LDKRoutingFees o_conv;
15103         o_conv.inner = untag_ptr(o);
15104         o_conv.is_owned = ptr_is_owned(o);
15105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15106         o_conv = RoutingFees_clone(&o_conv);
15107         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15108         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15109         return tag_ptr(ret_conv, true);
15110 }
15111
15112 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15113         void* e_ptr = untag_ptr(e);
15114         CHECK_ACCESS(e_ptr);
15115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15117         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15118         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15119         return tag_ptr(ret_conv, true);
15120 }
15121
15122 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15123         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15124         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15125         return ret_conv;
15126 }
15127
15128 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15129         if (!ptr_is_owned(_res)) return;
15130         void* _res_ptr = untag_ptr(_res);
15131         CHECK_ACCESS(_res_ptr);
15132         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15133         FREE(untag_ptr(_res));
15134         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15135 }
15136
15137 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15138         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15139         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15140         return tag_ptr(ret_conv, true);
15141 }
15142 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15143         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15144         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15145         return ret_conv;
15146 }
15147
15148 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15149         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15150         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15151         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15152         return tag_ptr(ret_conv, true);
15153 }
15154
15155 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15156         LDKCVec_NetAddressZ _res_constr;
15157         _res_constr.datalen = _res->arr_len;
15158         if (_res_constr.datalen > 0)
15159                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15160         else
15161                 _res_constr.data = NULL;
15162         uint64_t* _res_vals = _res->elems;
15163         for (size_t m = 0; m < _res_constr.datalen; m++) {
15164                 uint64_t _res_conv_12 = _res_vals[m];
15165                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15166                 CHECK_ACCESS(_res_conv_12_ptr);
15167                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15168                 FREE(untag_ptr(_res_conv_12));
15169                 _res_constr.data[m] = _res_conv_12_conv;
15170         }
15171         FREE(_res);
15172         CVec_NetAddressZ_free(_res_constr);
15173 }
15174
15175 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15176         LDKNodeAnnouncementInfo o_conv;
15177         o_conv.inner = untag_ptr(o);
15178         o_conv.is_owned = ptr_is_owned(o);
15179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15180         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15181         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15182         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15183         return tag_ptr(ret_conv, true);
15184 }
15185
15186 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15187         void* e_ptr = untag_ptr(e);
15188         CHECK_ACCESS(e_ptr);
15189         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15190         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15191         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15192         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15193         return tag_ptr(ret_conv, true);
15194 }
15195
15196 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15197         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15198         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15199         return ret_conv;
15200 }
15201
15202 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15203         if (!ptr_is_owned(_res)) return;
15204         void* _res_ptr = untag_ptr(_res);
15205         CHECK_ACCESS(_res_ptr);
15206         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15207         FREE(untag_ptr(_res));
15208         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15209 }
15210
15211 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
15212         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15213         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
15214         return tag_ptr(ret_conv, true);
15215 }
15216 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15217         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
15218         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
15219         return ret_conv;
15220 }
15221
15222 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
15223         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
15224         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15225         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
15226         return tag_ptr(ret_conv, true);
15227 }
15228
15229 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
15230         LDKNodeAlias o_conv;
15231         o_conv.inner = untag_ptr(o);
15232         o_conv.is_owned = ptr_is_owned(o);
15233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15234         o_conv = NodeAlias_clone(&o_conv);
15235         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15236         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
15237         return tag_ptr(ret_conv, true);
15238 }
15239
15240 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
15241         void* e_ptr = untag_ptr(e);
15242         CHECK_ACCESS(e_ptr);
15243         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15244         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15245         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15246         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
15247         return tag_ptr(ret_conv, true);
15248 }
15249
15250 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
15251         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
15252         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
15253         return ret_conv;
15254 }
15255
15256 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
15257         if (!ptr_is_owned(_res)) return;
15258         void* _res_ptr = untag_ptr(_res);
15259         CHECK_ACCESS(_res_ptr);
15260         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
15261         FREE(untag_ptr(_res));
15262         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
15263 }
15264
15265 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
15266         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15267         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
15268         return tag_ptr(ret_conv, true);
15269 }
15270 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
15271         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
15272         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
15273         return ret_conv;
15274 }
15275
15276 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
15277         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
15278         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15279         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
15280         return tag_ptr(ret_conv, true);
15281 }
15282
15283 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
15284         LDKNodeInfo o_conv;
15285         o_conv.inner = untag_ptr(o);
15286         o_conv.is_owned = ptr_is_owned(o);
15287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15288         o_conv = NodeInfo_clone(&o_conv);
15289         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15290         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
15291         return tag_ptr(ret_conv, true);
15292 }
15293
15294 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
15295         void* e_ptr = untag_ptr(e);
15296         CHECK_ACCESS(e_ptr);
15297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15299         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15300         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
15301         return tag_ptr(ret_conv, true);
15302 }
15303
15304 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
15305         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
15306         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
15307         return ret_conv;
15308 }
15309
15310 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
15311         if (!ptr_is_owned(_res)) return;
15312         void* _res_ptr = untag_ptr(_res);
15313         CHECK_ACCESS(_res_ptr);
15314         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
15315         FREE(untag_ptr(_res));
15316         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
15317 }
15318
15319 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
15320         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15321         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
15322         return tag_ptr(ret_conv, true);
15323 }
15324 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15325         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
15326         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
15327         return ret_conv;
15328 }
15329
15330 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
15331         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
15332         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15333         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
15334         return tag_ptr(ret_conv, true);
15335 }
15336
15337 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
15338         LDKNetworkGraph o_conv;
15339         o_conv.inner = untag_ptr(o);
15340         o_conv.is_owned = ptr_is_owned(o);
15341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15342         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
15343         
15344         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15345         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
15346         return tag_ptr(ret_conv, true);
15347 }
15348
15349 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
15350         void* e_ptr = untag_ptr(e);
15351         CHECK_ACCESS(e_ptr);
15352         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15353         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15354         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15355         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
15356         return tag_ptr(ret_conv, true);
15357 }
15358
15359 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
15360         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
15361         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
15362         return ret_conv;
15363 }
15364
15365 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
15366         if (!ptr_is_owned(_res)) return;
15367         void* _res_ptr = untag_ptr(_res);
15368         CHECK_ACCESS(_res_ptr);
15369         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
15370         FREE(untag_ptr(_res));
15371         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
15372 }
15373
15374 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
15375         LDKCVec_NetAddressZ o_constr;
15376         o_constr.datalen = o->arr_len;
15377         if (o_constr.datalen > 0)
15378                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15379         else
15380                 o_constr.data = NULL;
15381         uint64_t* o_vals = o->elems;
15382         for (size_t m = 0; m < o_constr.datalen; m++) {
15383                 uint64_t o_conv_12 = o_vals[m];
15384                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
15385                 CHECK_ACCESS(o_conv_12_ptr);
15386                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
15387                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
15388                 o_constr.data[m] = o_conv_12_conv;
15389         }
15390         FREE(o);
15391         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15392         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
15393         uint64_t ret_ref = tag_ptr(ret_copy, true);
15394         return ret_ref;
15395 }
15396
15397 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
15398         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15399         *ret_copy = COption_CVec_NetAddressZZ_none();
15400         uint64_t ret_ref = tag_ptr(ret_copy, true);
15401         return ret_ref;
15402 }
15403
15404 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
15405         if (!ptr_is_owned(_res)) return;
15406         void* _res_ptr = untag_ptr(_res);
15407         CHECK_ACCESS(_res_ptr);
15408         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
15409         FREE(untag_ptr(_res));
15410         COption_CVec_NetAddressZZ_free(_res_conv);
15411 }
15412
15413 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
15414         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15415         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
15416         uint64_t ret_ref = tag_ptr(ret_copy, true);
15417         return ret_ref;
15418 }
15419 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
15420         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
15421         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
15422         return ret_conv;
15423 }
15424
15425 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
15426         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
15427         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15428         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
15429         uint64_t ret_ref = tag_ptr(ret_copy, true);
15430         return ret_ref;
15431 }
15432
15433 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15434         LDKDelayedPaymentOutputDescriptor o_conv;
15435         o_conv.inner = untag_ptr(o);
15436         o_conv.is_owned = ptr_is_owned(o);
15437         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15438         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15439         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15440         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15441         return tag_ptr(ret_conv, true);
15442 }
15443
15444 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15445         void* e_ptr = untag_ptr(e);
15446         CHECK_ACCESS(e_ptr);
15447         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15448         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15449         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15450         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15451         return tag_ptr(ret_conv, true);
15452 }
15453
15454 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15455         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15456         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15457         return ret_conv;
15458 }
15459
15460 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15461         if (!ptr_is_owned(_res)) return;
15462         void* _res_ptr = untag_ptr(_res);
15463         CHECK_ACCESS(_res_ptr);
15464         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15465         FREE(untag_ptr(_res));
15466         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15467 }
15468
15469 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15470         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15471         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15472         return tag_ptr(ret_conv, true);
15473 }
15474 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15475         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15476         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15477         return ret_conv;
15478 }
15479
15480 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15481         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15482         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15483         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15484         return tag_ptr(ret_conv, true);
15485 }
15486
15487 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15488         LDKStaticPaymentOutputDescriptor o_conv;
15489         o_conv.inner = untag_ptr(o);
15490         o_conv.is_owned = ptr_is_owned(o);
15491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15492         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15493         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15494         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15495         return tag_ptr(ret_conv, true);
15496 }
15497
15498 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15499         void* e_ptr = untag_ptr(e);
15500         CHECK_ACCESS(e_ptr);
15501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15503         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15504         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15505         return tag_ptr(ret_conv, true);
15506 }
15507
15508 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15509         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15510         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15511         return ret_conv;
15512 }
15513
15514 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15515         if (!ptr_is_owned(_res)) return;
15516         void* _res_ptr = untag_ptr(_res);
15517         CHECK_ACCESS(_res_ptr);
15518         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15519         FREE(untag_ptr(_res));
15520         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15521 }
15522
15523 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15524         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15525         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15526         return tag_ptr(ret_conv, true);
15527 }
15528 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15529         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15530         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15531         return ret_conv;
15532 }
15533
15534 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15535         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15536         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15537         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15538         return tag_ptr(ret_conv, true);
15539 }
15540
15541 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15542         void* o_ptr = untag_ptr(o);
15543         CHECK_ACCESS(o_ptr);
15544         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15545         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15546         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15547         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15548         return tag_ptr(ret_conv, true);
15549 }
15550
15551 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15552         void* e_ptr = untag_ptr(e);
15553         CHECK_ACCESS(e_ptr);
15554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15556         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15557         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15558         return tag_ptr(ret_conv, true);
15559 }
15560
15561 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15562         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15563         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15564         return ret_conv;
15565 }
15566
15567 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15568         if (!ptr_is_owned(_res)) return;
15569         void* _res_ptr = untag_ptr(_res);
15570         CHECK_ACCESS(_res_ptr);
15571         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15572         FREE(untag_ptr(_res));
15573         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15574 }
15575
15576 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15577         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15578         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15579         return tag_ptr(ret_conv, true);
15580 }
15581 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15582         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15583         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15584         return ret_conv;
15585 }
15586
15587 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15588         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15589         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15590         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15591         return tag_ptr(ret_conv, true);
15592 }
15593
15594 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
15595         LDKCVec_PaymentPreimageZ _res_constr;
15596         _res_constr.datalen = _res->arr_len;
15597         if (_res_constr.datalen > 0)
15598                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15599         else
15600                 _res_constr.data = NULL;
15601         int8_tArray* _res_vals = (void*) _res->elems;
15602         for (size_t m = 0; m < _res_constr.datalen; m++) {
15603                 int8_tArray _res_conv_12 = _res_vals[m];
15604                 LDKThirtyTwoBytes _res_conv_12_ref;
15605                 CHECK(_res_conv_12->arr_len == 32);
15606                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15607                 _res_constr.data[m] = _res_conv_12_ref;
15608         }
15609         FREE(_res);
15610         CVec_PaymentPreimageZ_free(_res_constr);
15611 }
15612
15613 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15614         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15615         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15616         return tag_ptr(ret_conv, true);
15617 }
15618 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15619         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15620         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15621         return ret_conv;
15622 }
15623
15624 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15625         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15626         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15627         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15628         return tag_ptr(ret_conv, true);
15629 }
15630
15631 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15632         LDKSignature a_ref;
15633         CHECK(a->arr_len == 64);
15634         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15635         LDKCVec_SignatureZ b_constr;
15636         b_constr.datalen = b->arr_len;
15637         if (b_constr.datalen > 0)
15638                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15639         else
15640                 b_constr.data = NULL;
15641         int8_tArray* b_vals = (void*) b->elems;
15642         for (size_t m = 0; m < b_constr.datalen; m++) {
15643                 int8_tArray b_conv_12 = b_vals[m];
15644                 LDKSignature b_conv_12_ref;
15645                 CHECK(b_conv_12->arr_len == 64);
15646                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15647                 b_constr.data[m] = b_conv_12_ref;
15648         }
15649         FREE(b);
15650         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15651         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15652         return tag_ptr(ret_conv, true);
15653 }
15654
15655 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15656         if (!ptr_is_owned(_res)) return;
15657         void* _res_ptr = untag_ptr(_res);
15658         CHECK_ACCESS(_res_ptr);
15659         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15660         FREE(untag_ptr(_res));
15661         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15662 }
15663
15664 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15665         void* o_ptr = untag_ptr(o);
15666         CHECK_ACCESS(o_ptr);
15667         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15668         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15669         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15670         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15671         return tag_ptr(ret_conv, true);
15672 }
15673
15674 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15675         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15676         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15677         return tag_ptr(ret_conv, true);
15678 }
15679
15680 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15681         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15682         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15683         return ret_conv;
15684 }
15685
15686 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15687         if (!ptr_is_owned(_res)) return;
15688         void* _res_ptr = untag_ptr(_res);
15689         CHECK_ACCESS(_res_ptr);
15690         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15691         FREE(untag_ptr(_res));
15692         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15693 }
15694
15695 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15696         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15697         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15698         return tag_ptr(ret_conv, true);
15699 }
15700 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15701         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15702         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15703         return ret_conv;
15704 }
15705
15706 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15707         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15708         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15709         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15710         return tag_ptr(ret_conv, true);
15711 }
15712
15713 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15714         LDKSignature o_ref;
15715         CHECK(o->arr_len == 64);
15716         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15717         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15718         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15719         return tag_ptr(ret_conv, true);
15720 }
15721
15722 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15723         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15724         *ret_conv = CResult_SignatureNoneZ_err();
15725         return tag_ptr(ret_conv, true);
15726 }
15727
15728 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15729         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15730         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15731         return ret_conv;
15732 }
15733
15734 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15735         if (!ptr_is_owned(_res)) return;
15736         void* _res_ptr = untag_ptr(_res);
15737         CHECK_ACCESS(_res_ptr);
15738         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15739         FREE(untag_ptr(_res));
15740         CResult_SignatureNoneZ_free(_res_conv);
15741 }
15742
15743 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15744         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15745         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15746         return tag_ptr(ret_conv, true);
15747 }
15748 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15749         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15750         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15751         return ret_conv;
15752 }
15753
15754 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15755         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15756         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15757         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15758         return tag_ptr(ret_conv, true);
15759 }
15760
15761 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15762         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15763         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15764         return tag_ptr(ret_conv, true);
15765 }
15766 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15767         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15768         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15769         return ret_conv;
15770 }
15771
15772 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15773         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15774         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15775         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15776         return tag_ptr(ret_conv, true);
15777 }
15778
15779 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15780         LDKSignature a_ref;
15781         CHECK(a->arr_len == 64);
15782         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15783         LDKSignature b_ref;
15784         CHECK(b->arr_len == 64);
15785         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15786         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15787         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15788         return tag_ptr(ret_conv, true);
15789 }
15790
15791 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15792         if (!ptr_is_owned(_res)) return;
15793         void* _res_ptr = untag_ptr(_res);
15794         CHECK_ACCESS(_res_ptr);
15795         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15796         FREE(untag_ptr(_res));
15797         C2Tuple_SignatureSignatureZ_free(_res_conv);
15798 }
15799
15800 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15801         void* o_ptr = untag_ptr(o);
15802         CHECK_ACCESS(o_ptr);
15803         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15804         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15805         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15806         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15807         return tag_ptr(ret_conv, true);
15808 }
15809
15810 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15811         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15812         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15813         return tag_ptr(ret_conv, true);
15814 }
15815
15816 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15817         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15818         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15819         return ret_conv;
15820 }
15821
15822 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15823         if (!ptr_is_owned(_res)) return;
15824         void* _res_ptr = untag_ptr(_res);
15825         CHECK_ACCESS(_res_ptr);
15826         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15827         FREE(untag_ptr(_res));
15828         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15829 }
15830
15831 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15832         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15833         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15834         return tag_ptr(ret_conv, true);
15835 }
15836 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15837         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15838         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15839         return ret_conv;
15840 }
15841
15842 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15843         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15844         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15845         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15846         return tag_ptr(ret_conv, true);
15847 }
15848
15849 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15850         LDKSecretKey o_ref;
15851         CHECK(o->arr_len == 32);
15852         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15853         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15854         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15855         return tag_ptr(ret_conv, true);
15856 }
15857
15858 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15859         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15860         *ret_conv = CResult_SecretKeyNoneZ_err();
15861         return tag_ptr(ret_conv, true);
15862 }
15863
15864 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15865         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15866         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15867         return ret_conv;
15868 }
15869
15870 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15871         if (!ptr_is_owned(_res)) return;
15872         void* _res_ptr = untag_ptr(_res);
15873         CHECK_ACCESS(_res_ptr);
15874         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15875         FREE(untag_ptr(_res));
15876         CResult_SecretKeyNoneZ_free(_res_conv);
15877 }
15878
15879 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15880         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15881         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15882         return tag_ptr(ret_conv, true);
15883 }
15884 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15885         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15886         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15887         return ret_conv;
15888 }
15889
15890 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15891         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15892         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15893         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15894         return tag_ptr(ret_conv, true);
15895 }
15896
15897 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15898         LDKPublicKey o_ref;
15899         CHECK(o->arr_len == 33);
15900         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15901         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15902         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15903         return tag_ptr(ret_conv, true);
15904 }
15905
15906 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15907         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15908         *ret_conv = CResult_PublicKeyNoneZ_err();
15909         return tag_ptr(ret_conv, true);
15910 }
15911
15912 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15913         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15914         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15915         return ret_conv;
15916 }
15917
15918 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15919         if (!ptr_is_owned(_res)) return;
15920         void* _res_ptr = untag_ptr(_res);
15921         CHECK_ACCESS(_res_ptr);
15922         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15923         FREE(untag_ptr(_res));
15924         CResult_PublicKeyNoneZ_free(_res_conv);
15925 }
15926
15927 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15928         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15929         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15930         return tag_ptr(ret_conv, true);
15931 }
15932 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15933         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15934         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15935         return ret_conv;
15936 }
15937
15938 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
15939         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
15940         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15941         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
15942         return tag_ptr(ret_conv, true);
15943 }
15944
15945 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15946         void* o_ptr = untag_ptr(o);
15947         CHECK_ACCESS(o_ptr);
15948         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15949         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15950         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15951         *ret_copy = COption_ScalarZ_some(o_conv);
15952         uint64_t ret_ref = tag_ptr(ret_copy, true);
15953         return ret_ref;
15954 }
15955
15956 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15957         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15958         *ret_copy = COption_ScalarZ_none();
15959         uint64_t ret_ref = tag_ptr(ret_copy, true);
15960         return ret_ref;
15961 }
15962
15963 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15964         if (!ptr_is_owned(_res)) return;
15965         void* _res_ptr = untag_ptr(_res);
15966         CHECK_ACCESS(_res_ptr);
15967         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15968         FREE(untag_ptr(_res));
15969         COption_ScalarZ_free(_res_conv);
15970 }
15971
15972 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15973         LDKThirtyTwoBytes o_ref;
15974         CHECK(o->arr_len == 32);
15975         memcpy(o_ref.data, o->elems, 32); FREE(o);
15976         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15977         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15978         return tag_ptr(ret_conv, true);
15979 }
15980
15981 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15982         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15983         *ret_conv = CResult_SharedSecretNoneZ_err();
15984         return tag_ptr(ret_conv, true);
15985 }
15986
15987 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15988         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15989         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15990         return ret_conv;
15991 }
15992
15993 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15994         if (!ptr_is_owned(_res)) return;
15995         void* _res_ptr = untag_ptr(_res);
15996         CHECK_ACCESS(_res_ptr);
15997         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
15998         FREE(untag_ptr(_res));
15999         CResult_SharedSecretNoneZ_free(_res_conv);
16000 }
16001
16002 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16003         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16004         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16005         return tag_ptr(ret_conv, true);
16006 }
16007 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16008         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16009         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16010         return ret_conv;
16011 }
16012
16013 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16014         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16015         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16016         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16017         return tag_ptr(ret_conv, true);
16018 }
16019
16020 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
16021         void* o_ptr = untag_ptr(o);
16022         CHECK_ACCESS(o_ptr);
16023         LDKSign o_conv = *(LDKSign*)(o_ptr);
16024         if (o_conv.free == LDKSign_JCalls_free) {
16025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16026                 LDKSign_JCalls_cloned(&o_conv);
16027         }
16028         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16029         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
16030         return tag_ptr(ret_conv, true);
16031 }
16032
16033 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
16034         void* e_ptr = untag_ptr(e);
16035         CHECK_ACCESS(e_ptr);
16036         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16037         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16038         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16039         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
16040         return tag_ptr(ret_conv, true);
16041 }
16042
16043 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
16044         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
16045         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
16046         return ret_conv;
16047 }
16048
16049 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
16050         if (!ptr_is_owned(_res)) return;
16051         void* _res_ptr = untag_ptr(_res);
16052         CHECK_ACCESS(_res_ptr);
16053         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
16054         FREE(untag_ptr(_res));
16055         CResult_SignDecodeErrorZ_free(_res_conv);
16056 }
16057
16058 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
16059         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16060         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
16061         return tag_ptr(ret_conv, true);
16062 }
16063 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
16064         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
16065         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
16066         return ret_conv;
16067 }
16068
16069 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
16070         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
16071         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16072         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
16073         return tag_ptr(ret_conv, true);
16074 }
16075
16076 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16077         LDKCVec_U5Z _res_constr;
16078         _res_constr.datalen = _res->arr_len;
16079         if (_res_constr.datalen > 0)
16080                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16081         else
16082                 _res_constr.data = NULL;
16083         int8_t* _res_vals = (void*) _res->elems;
16084         for (size_t h = 0; h < _res_constr.datalen; h++) {
16085                 int8_t _res_conv_7 = _res_vals[h];
16086                 
16087                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16088         }
16089         FREE(_res);
16090         CVec_U5Z_free(_res_constr);
16091 }
16092
16093 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16094         LDKRecoverableSignature o_ref;
16095         CHECK(o->arr_len == 68);
16096         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16097         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16098         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16099         return tag_ptr(ret_conv, true);
16100 }
16101
16102 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16103         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16104         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16105         return tag_ptr(ret_conv, true);
16106 }
16107
16108 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16109         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16110         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16111         return ret_conv;
16112 }
16113
16114 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16115         if (!ptr_is_owned(_res)) return;
16116         void* _res_ptr = untag_ptr(_res);
16117         CHECK_ACCESS(_res_ptr);
16118         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16119         FREE(untag_ptr(_res));
16120         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16121 }
16122
16123 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16124         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16125         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16126         return tag_ptr(ret_conv, true);
16127 }
16128 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16129         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16130         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16131         return ret_conv;
16132 }
16133
16134 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16135         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16136         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16137         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16138         return tag_ptr(ret_conv, true);
16139 }
16140
16141 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16142         LDKCVec_u8Z _res_ref;
16143         _res_ref.datalen = _res->arr_len;
16144         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16145         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16146         CVec_u8Z_free(_res_ref);
16147 }
16148
16149 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16150         LDKCVec_CVec_u8ZZ _res_constr;
16151         _res_constr.datalen = _res->arr_len;
16152         if (_res_constr.datalen > 0)
16153                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16154         else
16155                 _res_constr.data = NULL;
16156         int8_tArray* _res_vals = (void*) _res->elems;
16157         for (size_t m = 0; m < _res_constr.datalen; m++) {
16158                 int8_tArray _res_conv_12 = _res_vals[m];
16159                 LDKCVec_u8Z _res_conv_12_ref;
16160                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16161                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16162                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16163                 _res_constr.data[m] = _res_conv_12_ref;
16164         }
16165         FREE(_res);
16166         CVec_CVec_u8ZZ_free(_res_constr);
16167 }
16168
16169 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16170         LDKCVec_CVec_u8ZZ o_constr;
16171         o_constr.datalen = o->arr_len;
16172         if (o_constr.datalen > 0)
16173                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16174         else
16175                 o_constr.data = NULL;
16176         int8_tArray* o_vals = (void*) o->elems;
16177         for (size_t m = 0; m < o_constr.datalen; m++) {
16178                 int8_tArray o_conv_12 = o_vals[m];
16179                 LDKCVec_u8Z o_conv_12_ref;
16180                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16181                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16182                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16183                 o_constr.data[m] = o_conv_12_ref;
16184         }
16185         FREE(o);
16186         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16187         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16188         return tag_ptr(ret_conv, true);
16189 }
16190
16191 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16192         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16193         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16194         return tag_ptr(ret_conv, true);
16195 }
16196
16197 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16198         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16199         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16200         return ret_conv;
16201 }
16202
16203 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16204         if (!ptr_is_owned(_res)) return;
16205         void* _res_ptr = untag_ptr(_res);
16206         CHECK_ACCESS(_res_ptr);
16207         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16208         FREE(untag_ptr(_res));
16209         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16210 }
16211
16212 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16213         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16214         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16215         return tag_ptr(ret_conv, true);
16216 }
16217 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16218         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16219         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16220         return ret_conv;
16221 }
16222
16223 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16224         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16225         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16226         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16227         return tag_ptr(ret_conv, true);
16228 }
16229
16230 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16231         LDKInMemorySigner o_conv;
16232         o_conv.inner = untag_ptr(o);
16233         o_conv.is_owned = ptr_is_owned(o);
16234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16235         o_conv = InMemorySigner_clone(&o_conv);
16236         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16237         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16238         return tag_ptr(ret_conv, true);
16239 }
16240
16241 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16242         void* e_ptr = untag_ptr(e);
16243         CHECK_ACCESS(e_ptr);
16244         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16245         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16246         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16247         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16248         return tag_ptr(ret_conv, true);
16249 }
16250
16251 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16252         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16253         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16254         return ret_conv;
16255 }
16256
16257 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16258         if (!ptr_is_owned(_res)) return;
16259         void* _res_ptr = untag_ptr(_res);
16260         CHECK_ACCESS(_res_ptr);
16261         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16262         FREE(untag_ptr(_res));
16263         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16264 }
16265
16266 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16267         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16268         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16269         return tag_ptr(ret_conv, true);
16270 }
16271 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16272         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16273         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16274         return ret_conv;
16275 }
16276
16277 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16278         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16279         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16280         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16281         return tag_ptr(ret_conv, true);
16282 }
16283
16284 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16285         LDKCVec_TxOutZ _res_constr;
16286         _res_constr.datalen = _res->arr_len;
16287         if (_res_constr.datalen > 0)
16288                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16289         else
16290                 _res_constr.data = NULL;
16291         uint64_t* _res_vals = _res->elems;
16292         for (size_t h = 0; h < _res_constr.datalen; h++) {
16293                 uint64_t _res_conv_7 = _res_vals[h];
16294                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16295                 CHECK_ACCESS(_res_conv_7_ptr);
16296                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16297                 FREE(untag_ptr(_res_conv_7));
16298                 _res_constr.data[h] = _res_conv_7_conv;
16299         }
16300         FREE(_res);
16301         CVec_TxOutZ_free(_res_constr);
16302 }
16303
16304 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16305         LDKTransaction o_ref;
16306         o_ref.datalen = o->arr_len;
16307         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16308         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16309         o_ref.data_is_owned = true;
16310         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16311         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16312         return tag_ptr(ret_conv, true);
16313 }
16314
16315 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16316         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16317         *ret_conv = CResult_TransactionNoneZ_err();
16318         return tag_ptr(ret_conv, true);
16319 }
16320
16321 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16322         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16323         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16324         return ret_conv;
16325 }
16326
16327 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16328         if (!ptr_is_owned(_res)) return;
16329         void* _res_ptr = untag_ptr(_res);
16330         CHECK_ACCESS(_res_ptr);
16331         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16332         FREE(untag_ptr(_res));
16333         CResult_TransactionNoneZ_free(_res_conv);
16334 }
16335
16336 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16337         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16338         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16339         return tag_ptr(ret_conv, true);
16340 }
16341 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16342         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16343         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16344         return ret_conv;
16345 }
16346
16347 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16348         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16349         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16350         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16351         return tag_ptr(ret_conv, true);
16352 }
16353
16354 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16355         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16356         *ret_copy = COption_u16Z_some(o);
16357         uint64_t ret_ref = tag_ptr(ret_copy, true);
16358         return ret_ref;
16359 }
16360
16361 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16362         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16363         *ret_copy = COption_u16Z_none();
16364         uint64_t ret_ref = tag_ptr(ret_copy, true);
16365         return ret_ref;
16366 }
16367
16368 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16369         if (!ptr_is_owned(_res)) return;
16370         void* _res_ptr = untag_ptr(_res);
16371         CHECK_ACCESS(_res_ptr);
16372         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16373         FREE(untag_ptr(_res));
16374         COption_u16Z_free(_res_conv);
16375 }
16376
16377 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16378         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16379         *ret_copy = COption_u16Z_clone(arg);
16380         uint64_t ret_ref = tag_ptr(ret_copy, true);
16381         return ret_ref;
16382 }
16383 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16384         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16385         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16386         return ret_conv;
16387 }
16388
16389 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16390         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16391         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16392         *ret_copy = COption_u16Z_clone(orig_conv);
16393         uint64_t ret_ref = tag_ptr(ret_copy, true);
16394         return ret_ref;
16395 }
16396
16397 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
16398         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16399         *ret_conv = CResult_NoneAPIErrorZ_ok();
16400         return tag_ptr(ret_conv, true);
16401 }
16402
16403 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
16404         void* e_ptr = untag_ptr(e);
16405         CHECK_ACCESS(e_ptr);
16406         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16407         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16408         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16409         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
16410         return tag_ptr(ret_conv, true);
16411 }
16412
16413 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
16414         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
16415         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
16416         return ret_conv;
16417 }
16418
16419 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
16420         if (!ptr_is_owned(_res)) return;
16421         void* _res_ptr = untag_ptr(_res);
16422         CHECK_ACCESS(_res_ptr);
16423         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
16424         FREE(untag_ptr(_res));
16425         CResult_NoneAPIErrorZ_free(_res_conv);
16426 }
16427
16428 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
16429         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16430         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
16431         return tag_ptr(ret_conv, true);
16432 }
16433 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
16434         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
16435         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
16436         return ret_conv;
16437 }
16438
16439 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
16440         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
16441         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16442         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
16443         return tag_ptr(ret_conv, true);
16444 }
16445
16446 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
16447         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
16448         _res_constr.datalen = _res->arr_len;
16449         if (_res_constr.datalen > 0)
16450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16451         else
16452                 _res_constr.data = NULL;
16453         uint64_t* _res_vals = _res->elems;
16454         for (size_t w = 0; w < _res_constr.datalen; w++) {
16455                 uint64_t _res_conv_22 = _res_vals[w];
16456                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16457                 CHECK_ACCESS(_res_conv_22_ptr);
16458                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
16459                 FREE(untag_ptr(_res_conv_22));
16460                 _res_constr.data[w] = _res_conv_22_conv;
16461         }
16462         FREE(_res);
16463         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
16464 }
16465
16466 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
16467         LDKCVec_APIErrorZ _res_constr;
16468         _res_constr.datalen = _res->arr_len;
16469         if (_res_constr.datalen > 0)
16470                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16471         else
16472                 _res_constr.data = NULL;
16473         uint64_t* _res_vals = _res->elems;
16474         for (size_t k = 0; k < _res_constr.datalen; k++) {
16475                 uint64_t _res_conv_10 = _res_vals[k];
16476                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
16477                 CHECK_ACCESS(_res_conv_10_ptr);
16478                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
16479                 FREE(untag_ptr(_res_conv_10));
16480                 _res_constr.data[k] = _res_conv_10_conv;
16481         }
16482         FREE(_res);
16483         CVec_APIErrorZ_free(_res_constr);
16484 }
16485
16486 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
16487         LDKThirtyTwoBytes o_ref;
16488         CHECK(o->arr_len == 32);
16489         memcpy(o_ref.data, o->elems, 32); FREE(o);
16490         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16491         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
16492         return tag_ptr(ret_conv, true);
16493 }
16494
16495 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
16496         void* e_ptr = untag_ptr(e);
16497         CHECK_ACCESS(e_ptr);
16498         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16499         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16500         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16501         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
16502         return tag_ptr(ret_conv, true);
16503 }
16504
16505 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
16506         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
16507         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
16508         return ret_conv;
16509 }
16510
16511 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
16512         if (!ptr_is_owned(_res)) return;
16513         void* _res_ptr = untag_ptr(_res);
16514         CHECK_ACCESS(_res_ptr);
16515         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
16516         FREE(untag_ptr(_res));
16517         CResult__u832APIErrorZ_free(_res_conv);
16518 }
16519
16520 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
16521         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16522         *ret_conv = CResult__u832APIErrorZ_clone(arg);
16523         return tag_ptr(ret_conv, true);
16524 }
16525 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
16526         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
16527         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
16528         return ret_conv;
16529 }
16530
16531 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
16532         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
16533         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16534         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
16535         return tag_ptr(ret_conv, true);
16536 }
16537
16538 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
16539         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16540         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
16541         return tag_ptr(ret_conv, true);
16542 }
16543
16544 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
16545         void* e_ptr = untag_ptr(e);
16546         CHECK_ACCESS(e_ptr);
16547         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16548         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16549         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16550         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16551         return tag_ptr(ret_conv, true);
16552 }
16553
16554 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
16555         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
16556         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16557         return ret_conv;
16558 }
16559
16560 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16561         if (!ptr_is_owned(_res)) return;
16562         void* _res_ptr = untag_ptr(_res);
16563         CHECK_ACCESS(_res_ptr);
16564         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16565         FREE(untag_ptr(_res));
16566         CResult_NonePaymentSendFailureZ_free(_res_conv);
16567 }
16568
16569 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16570         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16571         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16572         return tag_ptr(ret_conv, true);
16573 }
16574 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16575         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16576         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16577         return ret_conv;
16578 }
16579
16580 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16581         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16582         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16583         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16584         return tag_ptr(ret_conv, true);
16585 }
16586
16587 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
16588         LDKThirtyTwoBytes o_ref;
16589         CHECK(o->arr_len == 32);
16590         memcpy(o_ref.data, o->elems, 32); FREE(o);
16591         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16592         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
16593         return tag_ptr(ret_conv, true);
16594 }
16595
16596 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
16597         void* e_ptr = untag_ptr(e);
16598         CHECK_ACCESS(e_ptr);
16599         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16600         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16601         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16602         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
16603         return tag_ptr(ret_conv, true);
16604 }
16605
16606 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
16607         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
16608         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
16609         return ret_conv;
16610 }
16611
16612 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
16613         if (!ptr_is_owned(_res)) return;
16614         void* _res_ptr = untag_ptr(_res);
16615         CHECK_ACCESS(_res_ptr);
16616         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
16617         FREE(untag_ptr(_res));
16618         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
16619 }
16620
16621 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
16622         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16623         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
16624         return tag_ptr(ret_conv, true);
16625 }
16626 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16627         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
16628         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
16629         return ret_conv;
16630 }
16631
16632 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
16633         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
16634         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16635         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
16636         return tag_ptr(ret_conv, true);
16637 }
16638
16639 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16640         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16641         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16642         return tag_ptr(ret_conv, true);
16643 }
16644 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16645         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16646         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16647         return ret_conv;
16648 }
16649
16650 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16651         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16652         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16653         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16654         return tag_ptr(ret_conv, true);
16655 }
16656
16657 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16658         LDKThirtyTwoBytes a_ref;
16659         CHECK(a->arr_len == 32);
16660         memcpy(a_ref.data, a->elems, 32); FREE(a);
16661         LDKThirtyTwoBytes b_ref;
16662         CHECK(b->arr_len == 32);
16663         memcpy(b_ref.data, b->elems, 32); FREE(b);
16664         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16665         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16666         return tag_ptr(ret_conv, true);
16667 }
16668
16669 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16670         if (!ptr_is_owned(_res)) return;
16671         void* _res_ptr = untag_ptr(_res);
16672         CHECK_ACCESS(_res_ptr);
16673         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16674         FREE(untag_ptr(_res));
16675         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16676 }
16677
16678 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16679         void* o_ptr = untag_ptr(o);
16680         CHECK_ACCESS(o_ptr);
16681         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16682         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16683         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16684         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16685         return tag_ptr(ret_conv, true);
16686 }
16687
16688 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16689         void* e_ptr = untag_ptr(e);
16690         CHECK_ACCESS(e_ptr);
16691         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16692         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16693         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16694         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16695         return tag_ptr(ret_conv, true);
16696 }
16697
16698 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16699         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16700         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16701         return ret_conv;
16702 }
16703
16704 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16705         if (!ptr_is_owned(_res)) return;
16706         void* _res_ptr = untag_ptr(_res);
16707         CHECK_ACCESS(_res_ptr);
16708         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16709         FREE(untag_ptr(_res));
16710         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16711 }
16712
16713 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16714         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16715         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16716         return tag_ptr(ret_conv, true);
16717 }
16718 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16719         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16720         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16721         return ret_conv;
16722 }
16723
16724 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16725         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16726         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16727         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16728         return tag_ptr(ret_conv, true);
16729 }
16730
16731 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16732         LDKCVec_ThirtyTwoBytesZ _res_constr;
16733         _res_constr.datalen = _res->arr_len;
16734         if (_res_constr.datalen > 0)
16735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16736         else
16737                 _res_constr.data = NULL;
16738         int8_tArray* _res_vals = (void*) _res->elems;
16739         for (size_t m = 0; m < _res_constr.datalen; m++) {
16740                 int8_tArray _res_conv_12 = _res_vals[m];
16741                 LDKThirtyTwoBytes _res_conv_12_ref;
16742                 CHECK(_res_conv_12->arr_len == 32);
16743                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16744                 _res_constr.data[m] = _res_conv_12_ref;
16745         }
16746         FREE(_res);
16747         CVec_ThirtyTwoBytesZ_free(_res_constr);
16748 }
16749
16750 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16751         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16752         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16753         return tag_ptr(ret_conv, true);
16754 }
16755 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16756         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16757         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16758         return ret_conv;
16759 }
16760
16761 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16762         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16763         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16764         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16765         return tag_ptr(ret_conv, true);
16766 }
16767
16768 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16769         LDKThirtyTwoBytes a_ref;
16770         CHECK(a->arr_len == 32);
16771         memcpy(a_ref.data, a->elems, 32); FREE(a);
16772         LDKThirtyTwoBytes b_ref;
16773         CHECK(b->arr_len == 32);
16774         memcpy(b_ref.data, b->elems, 32); FREE(b);
16775         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16776         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16777         return tag_ptr(ret_conv, true);
16778 }
16779
16780 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16781         if (!ptr_is_owned(_res)) return;
16782         void* _res_ptr = untag_ptr(_res);
16783         CHECK_ACCESS(_res_ptr);
16784         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16785         FREE(untag_ptr(_res));
16786         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16787 }
16788
16789 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16790         void* o_ptr = untag_ptr(o);
16791         CHECK_ACCESS(o_ptr);
16792         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16793         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16794         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16795         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16796         return tag_ptr(ret_conv, true);
16797 }
16798
16799 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16800         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16801         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16802         return tag_ptr(ret_conv, true);
16803 }
16804
16805 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16806         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16807         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16808         return ret_conv;
16809 }
16810
16811 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16812         if (!ptr_is_owned(_res)) return;
16813         void* _res_ptr = untag_ptr(_res);
16814         CHECK_ACCESS(_res_ptr);
16815         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16816         FREE(untag_ptr(_res));
16817         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16818 }
16819
16820 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16821         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16822         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16823         return tag_ptr(ret_conv, true);
16824 }
16825 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16826         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16827         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16828         return ret_conv;
16829 }
16830
16831 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16832         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16833         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16834         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16835         return tag_ptr(ret_conv, true);
16836 }
16837
16838 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16839         void* o_ptr = untag_ptr(o);
16840         CHECK_ACCESS(o_ptr);
16841         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16842         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16843         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16844         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16845         return tag_ptr(ret_conv, true);
16846 }
16847
16848 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16849         void* e_ptr = untag_ptr(e);
16850         CHECK_ACCESS(e_ptr);
16851         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16852         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16853         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16854         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16855         return tag_ptr(ret_conv, true);
16856 }
16857
16858 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16859         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16860         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16861         return ret_conv;
16862 }
16863
16864 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16865         if (!ptr_is_owned(_res)) return;
16866         void* _res_ptr = untag_ptr(_res);
16867         CHECK_ACCESS(_res_ptr);
16868         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16869         FREE(untag_ptr(_res));
16870         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16871 }
16872
16873 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16874         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16875         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16876         return tag_ptr(ret_conv, true);
16877 }
16878 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16879         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16880         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16881         return ret_conv;
16882 }
16883
16884 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16885         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16886         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16887         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16888         return tag_ptr(ret_conv, true);
16889 }
16890
16891 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16892         LDKThirtyTwoBytes o_ref;
16893         CHECK(o->arr_len == 32);
16894         memcpy(o_ref.data, o->elems, 32); FREE(o);
16895         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16896         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16897         return tag_ptr(ret_conv, true);
16898 }
16899
16900 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16901         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16902         *ret_conv = CResult_PaymentSecretNoneZ_err();
16903         return tag_ptr(ret_conv, true);
16904 }
16905
16906 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16907         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16908         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16909         return ret_conv;
16910 }
16911
16912 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16913         if (!ptr_is_owned(_res)) return;
16914         void* _res_ptr = untag_ptr(_res);
16915         CHECK_ACCESS(_res_ptr);
16916         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16917         FREE(untag_ptr(_res));
16918         CResult_PaymentSecretNoneZ_free(_res_conv);
16919 }
16920
16921 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16922         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16923         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16924         return tag_ptr(ret_conv, true);
16925 }
16926 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16927         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16928         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16929         return ret_conv;
16930 }
16931
16932 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16933         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16934         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16935         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16936         return tag_ptr(ret_conv, true);
16937 }
16938
16939 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16940         LDKThirtyTwoBytes o_ref;
16941         CHECK(o->arr_len == 32);
16942         memcpy(o_ref.data, o->elems, 32); FREE(o);
16943         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16944         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16945         return tag_ptr(ret_conv, true);
16946 }
16947
16948 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16949         void* e_ptr = untag_ptr(e);
16950         CHECK_ACCESS(e_ptr);
16951         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16952         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16953         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16954         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16955         return tag_ptr(ret_conv, true);
16956 }
16957
16958 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16959         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16960         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16961         return ret_conv;
16962 }
16963
16964 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16965         if (!ptr_is_owned(_res)) return;
16966         void* _res_ptr = untag_ptr(_res);
16967         CHECK_ACCESS(_res_ptr);
16968         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16969         FREE(untag_ptr(_res));
16970         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16971 }
16972
16973 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16974         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16975         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16976         return tag_ptr(ret_conv, true);
16977 }
16978 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16979         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16980         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16981         return ret_conv;
16982 }
16983
16984 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16985         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16986         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16987         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16988         return tag_ptr(ret_conv, true);
16989 }
16990
16991 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16992         LDKThirtyTwoBytes o_ref;
16993         CHECK(o->arr_len == 32);
16994         memcpy(o_ref.data, o->elems, 32); FREE(o);
16995         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16996         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16997         return tag_ptr(ret_conv, true);
16998 }
16999
17000 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17001         void* e_ptr = untag_ptr(e);
17002         CHECK_ACCESS(e_ptr);
17003         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17004         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17005         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17006         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17007         return tag_ptr(ret_conv, true);
17008 }
17009
17010 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17011         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17012         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17013         return ret_conv;
17014 }
17015
17016 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17017         if (!ptr_is_owned(_res)) return;
17018         void* _res_ptr = untag_ptr(_res);
17019         CHECK_ACCESS(_res_ptr);
17020         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17021         FREE(untag_ptr(_res));
17022         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17023 }
17024
17025 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17026         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17027         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17028         return tag_ptr(ret_conv, true);
17029 }
17030 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17031         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17032         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17033         return ret_conv;
17034 }
17035
17036 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17037         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17038         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17039         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17040         return tag_ptr(ret_conv, true);
17041 }
17042
17043 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17044         LDKCounterpartyForwardingInfo o_conv;
17045         o_conv.inner = untag_ptr(o);
17046         o_conv.is_owned = ptr_is_owned(o);
17047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17048         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17049         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17050         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17051         return tag_ptr(ret_conv, true);
17052 }
17053
17054 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17055         void* e_ptr = untag_ptr(e);
17056         CHECK_ACCESS(e_ptr);
17057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17059         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17060         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17061         return tag_ptr(ret_conv, true);
17062 }
17063
17064 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17065         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17066         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17067         return ret_conv;
17068 }
17069
17070 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17071         if (!ptr_is_owned(_res)) return;
17072         void* _res_ptr = untag_ptr(_res);
17073         CHECK_ACCESS(_res_ptr);
17074         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17075         FREE(untag_ptr(_res));
17076         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17077 }
17078
17079 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17080         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17081         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17082         return tag_ptr(ret_conv, true);
17083 }
17084 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17085         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17086         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17087         return ret_conv;
17088 }
17089
17090 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17091         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17092         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17093         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17094         return tag_ptr(ret_conv, true);
17095 }
17096
17097 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17098         LDKChannelCounterparty o_conv;
17099         o_conv.inner = untag_ptr(o);
17100         o_conv.is_owned = ptr_is_owned(o);
17101         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17102         o_conv = ChannelCounterparty_clone(&o_conv);
17103         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17104         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17105         return tag_ptr(ret_conv, true);
17106 }
17107
17108 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17109         void* e_ptr = untag_ptr(e);
17110         CHECK_ACCESS(e_ptr);
17111         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17112         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17113         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17114         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17115         return tag_ptr(ret_conv, true);
17116 }
17117
17118 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17119         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17120         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17121         return ret_conv;
17122 }
17123
17124 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17125         if (!ptr_is_owned(_res)) return;
17126         void* _res_ptr = untag_ptr(_res);
17127         CHECK_ACCESS(_res_ptr);
17128         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17129         FREE(untag_ptr(_res));
17130         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17131 }
17132
17133 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17134         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17135         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17136         return tag_ptr(ret_conv, true);
17137 }
17138 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17139         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17140         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17141         return ret_conv;
17142 }
17143
17144 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17145         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17146         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17147         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17148         return tag_ptr(ret_conv, true);
17149 }
17150
17151 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17152         LDKChannelDetails o_conv;
17153         o_conv.inner = untag_ptr(o);
17154         o_conv.is_owned = ptr_is_owned(o);
17155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17156         o_conv = ChannelDetails_clone(&o_conv);
17157         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17158         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17159         return tag_ptr(ret_conv, true);
17160 }
17161
17162 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17163         void* e_ptr = untag_ptr(e);
17164         CHECK_ACCESS(e_ptr);
17165         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17166         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17167         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17168         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17169         return tag_ptr(ret_conv, true);
17170 }
17171
17172 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17173         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17174         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17175         return ret_conv;
17176 }
17177
17178 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17179         if (!ptr_is_owned(_res)) return;
17180         void* _res_ptr = untag_ptr(_res);
17181         CHECK_ACCESS(_res_ptr);
17182         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17183         FREE(untag_ptr(_res));
17184         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17185 }
17186
17187 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17188         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17189         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17190         return tag_ptr(ret_conv, true);
17191 }
17192 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17193         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17194         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17195         return ret_conv;
17196 }
17197
17198 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17199         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17200         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17201         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17202         return tag_ptr(ret_conv, true);
17203 }
17204
17205 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17206         LDKPhantomRouteHints o_conv;
17207         o_conv.inner = untag_ptr(o);
17208         o_conv.is_owned = ptr_is_owned(o);
17209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17210         o_conv = PhantomRouteHints_clone(&o_conv);
17211         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17212         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17213         return tag_ptr(ret_conv, true);
17214 }
17215
17216 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17217         void* e_ptr = untag_ptr(e);
17218         CHECK_ACCESS(e_ptr);
17219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17221         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17222         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17223         return tag_ptr(ret_conv, true);
17224 }
17225
17226 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17227         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17228         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17229         return ret_conv;
17230 }
17231
17232 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17233         if (!ptr_is_owned(_res)) return;
17234         void* _res_ptr = untag_ptr(_res);
17235         CHECK_ACCESS(_res_ptr);
17236         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17237         FREE(untag_ptr(_res));
17238         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17239 }
17240
17241 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17242         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17243         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17244         return tag_ptr(ret_conv, true);
17245 }
17246 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17247         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17248         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17249         return ret_conv;
17250 }
17251
17252 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17253         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17254         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17255         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17256         return tag_ptr(ret_conv, true);
17257 }
17258
17259 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17260         LDKCVec_ChannelMonitorZ _res_constr;
17261         _res_constr.datalen = _res->arr_len;
17262         if (_res_constr.datalen > 0)
17263                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17264         else
17265                 _res_constr.data = NULL;
17266         uint64_t* _res_vals = _res->elems;
17267         for (size_t q = 0; q < _res_constr.datalen; q++) {
17268                 uint64_t _res_conv_16 = _res_vals[q];
17269                 LDKChannelMonitor _res_conv_16_conv;
17270                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17271                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17272                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17273                 _res_constr.data[q] = _res_conv_16_conv;
17274         }
17275         FREE(_res);
17276         CVec_ChannelMonitorZ_free(_res_constr);
17277 }
17278
17279 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17280         LDKThirtyTwoBytes a_ref;
17281         CHECK(a->arr_len == 32);
17282         memcpy(a_ref.data, a->elems, 32); FREE(a);
17283         LDKChannelManager b_conv;
17284         b_conv.inner = untag_ptr(b);
17285         b_conv.is_owned = ptr_is_owned(b);
17286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17287         // WARNING: we need a move here but no clone is available for LDKChannelManager
17288         
17289         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17290         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17291         return tag_ptr(ret_conv, true);
17292 }
17293
17294 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17295         if (!ptr_is_owned(_res)) return;
17296         void* _res_ptr = untag_ptr(_res);
17297         CHECK_ACCESS(_res_ptr);
17298         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17299         FREE(untag_ptr(_res));
17300         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17301 }
17302
17303 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17304         void* o_ptr = untag_ptr(o);
17305         CHECK_ACCESS(o_ptr);
17306         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17307         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17308         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17309         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17310         return tag_ptr(ret_conv, true);
17311 }
17312
17313 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17314         void* e_ptr = untag_ptr(e);
17315         CHECK_ACCESS(e_ptr);
17316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17318         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17319         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17320         return tag_ptr(ret_conv, true);
17321 }
17322
17323 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17324         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17325         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17326         return ret_conv;
17327 }
17328
17329 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
17330         if (!ptr_is_owned(_res)) return;
17331         void* _res_ptr = untag_ptr(_res);
17332         CHECK_ACCESS(_res_ptr);
17333         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
17334         FREE(untag_ptr(_res));
17335         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
17336 }
17337
17338 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
17339         LDKChannelConfig o_conv;
17340         o_conv.inner = untag_ptr(o);
17341         o_conv.is_owned = ptr_is_owned(o);
17342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17343         o_conv = ChannelConfig_clone(&o_conv);
17344         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17345         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
17346         return tag_ptr(ret_conv, true);
17347 }
17348
17349 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
17350         void* e_ptr = untag_ptr(e);
17351         CHECK_ACCESS(e_ptr);
17352         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17353         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17354         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17355         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
17356         return tag_ptr(ret_conv, true);
17357 }
17358
17359 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
17360         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
17361         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
17362         return ret_conv;
17363 }
17364
17365 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
17366         if (!ptr_is_owned(_res)) return;
17367         void* _res_ptr = untag_ptr(_res);
17368         CHECK_ACCESS(_res_ptr);
17369         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
17370         FREE(untag_ptr(_res));
17371         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
17372 }
17373
17374 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
17375         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17376         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
17377         return tag_ptr(ret_conv, true);
17378 }
17379 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
17380         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
17381         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
17382         return ret_conv;
17383 }
17384
17385 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
17386         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
17387         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17388         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
17389         return tag_ptr(ret_conv, true);
17390 }
17391
17392 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
17393         LDKOutPoint o_conv;
17394         o_conv.inner = untag_ptr(o);
17395         o_conv.is_owned = ptr_is_owned(o);
17396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17397         o_conv = OutPoint_clone(&o_conv);
17398         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17399         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
17400         return tag_ptr(ret_conv, true);
17401 }
17402
17403 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
17404         void* e_ptr = untag_ptr(e);
17405         CHECK_ACCESS(e_ptr);
17406         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17407         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17408         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17409         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
17410         return tag_ptr(ret_conv, true);
17411 }
17412
17413 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
17414         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
17415         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
17416         return ret_conv;
17417 }
17418
17419 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
17420         if (!ptr_is_owned(_res)) return;
17421         void* _res_ptr = untag_ptr(_res);
17422         CHECK_ACCESS(_res_ptr);
17423         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
17424         FREE(untag_ptr(_res));
17425         CResult_OutPointDecodeErrorZ_free(_res_conv);
17426 }
17427
17428 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
17429         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17430         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
17431         return tag_ptr(ret_conv, true);
17432 }
17433 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
17434         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
17435         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
17436         return ret_conv;
17437 }
17438
17439 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
17440         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
17441         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17442         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
17443         return tag_ptr(ret_conv, true);
17444 }
17445
17446 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
17447         void* o_ptr = untag_ptr(o);
17448         CHECK_ACCESS(o_ptr);
17449         LDKType o_conv = *(LDKType*)(o_ptr);
17450         if (o_conv.free == LDKType_JCalls_free) {
17451                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17452                 LDKType_JCalls_cloned(&o_conv);
17453         }
17454         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17455         *ret_copy = COption_TypeZ_some(o_conv);
17456         uint64_t ret_ref = tag_ptr(ret_copy, true);
17457         return ret_ref;
17458 }
17459
17460 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
17461         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17462         *ret_copy = COption_TypeZ_none();
17463         uint64_t ret_ref = tag_ptr(ret_copy, true);
17464         return ret_ref;
17465 }
17466
17467 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
17468         if (!ptr_is_owned(_res)) return;
17469         void* _res_ptr = untag_ptr(_res);
17470         CHECK_ACCESS(_res_ptr);
17471         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
17472         FREE(untag_ptr(_res));
17473         COption_TypeZ_free(_res_conv);
17474 }
17475
17476 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
17477         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17478         *ret_copy = COption_TypeZ_clone(arg);
17479         uint64_t ret_ref = tag_ptr(ret_copy, true);
17480         return ret_ref;
17481 }
17482 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
17483         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
17484         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
17485         return ret_conv;
17486 }
17487
17488 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
17489         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
17490         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17491         *ret_copy = COption_TypeZ_clone(orig_conv);
17492         uint64_t ret_ref = tag_ptr(ret_copy, true);
17493         return ret_ref;
17494 }
17495
17496 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
17497         void* o_ptr = untag_ptr(o);
17498         CHECK_ACCESS(o_ptr);
17499         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
17500         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
17501         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17502         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
17503         return tag_ptr(ret_conv, true);
17504 }
17505
17506 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
17507         void* e_ptr = untag_ptr(e);
17508         CHECK_ACCESS(e_ptr);
17509         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17510         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17511         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17512         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
17513         return tag_ptr(ret_conv, true);
17514 }
17515
17516 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
17517         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
17518         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
17519         return ret_conv;
17520 }
17521
17522 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
17523         if (!ptr_is_owned(_res)) return;
17524         void* _res_ptr = untag_ptr(_res);
17525         CHECK_ACCESS(_res_ptr);
17526         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
17527         FREE(untag_ptr(_res));
17528         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
17529 }
17530
17531 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
17532         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17533         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
17534         return tag_ptr(ret_conv, true);
17535 }
17536 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
17537         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
17538         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
17539         return ret_conv;
17540 }
17541
17542 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
17543         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
17544         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17545         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
17546         return tag_ptr(ret_conv, true);
17547 }
17548
17549 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
17550         LDKThirtyTwoBytes o_ref;
17551         CHECK(o->arr_len == 32);
17552         memcpy(o_ref.data, o->elems, 32); FREE(o);
17553         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17554         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
17555         return tag_ptr(ret_conv, true);
17556 }
17557
17558 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
17559         void* e_ptr = untag_ptr(e);
17560         CHECK_ACCESS(e_ptr);
17561         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17562         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17563         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17564         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
17565         return tag_ptr(ret_conv, true);
17566 }
17567
17568 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
17569         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
17570         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
17571         return ret_conv;
17572 }
17573
17574 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_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_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
17579         FREE(untag_ptr(_res));
17580         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
17581 }
17582
17583 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
17584         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17585         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
17586         return tag_ptr(ret_conv, true);
17587 }
17588 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
17589         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
17590         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17591         return ret_conv;
17592 }
17593
17594 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
17595         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
17596         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17597         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17598         return tag_ptr(ret_conv, true);
17599 }
17600
17601 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
17602         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17603         *ret_conv = CResult_NonePaymentErrorZ_ok();
17604         return tag_ptr(ret_conv, true);
17605 }
17606
17607 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
17608         void* e_ptr = untag_ptr(e);
17609         CHECK_ACCESS(e_ptr);
17610         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17611         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17612         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17613         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
17614         return tag_ptr(ret_conv, true);
17615 }
17616
17617 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
17618         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
17619         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
17620         return ret_conv;
17621 }
17622
17623 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
17624         if (!ptr_is_owned(_res)) return;
17625         void* _res_ptr = untag_ptr(_res);
17626         CHECK_ACCESS(_res_ptr);
17627         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
17628         FREE(untag_ptr(_res));
17629         CResult_NonePaymentErrorZ_free(_res_conv);
17630 }
17631
17632 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
17633         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17634         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
17635         return tag_ptr(ret_conv, true);
17636 }
17637 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
17638         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
17639         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
17640         return ret_conv;
17641 }
17642
17643 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
17644         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
17645         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17646         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
17647         return tag_ptr(ret_conv, true);
17648 }
17649
17650 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17651         LDKStr o_conv = str_ref_to_owned_c(o);
17652         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17653         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17654         return tag_ptr(ret_conv, true);
17655 }
17656
17657 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17658         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17659         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17660         *ret_conv = CResult_StringErrorZ_err(e_conv);
17661         return tag_ptr(ret_conv, true);
17662 }
17663
17664 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17665         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17666         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17667         return ret_conv;
17668 }
17669
17670 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17671         if (!ptr_is_owned(_res)) return;
17672         void* _res_ptr = untag_ptr(_res);
17673         CHECK_ACCESS(_res_ptr);
17674         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17675         FREE(untag_ptr(_res));
17676         CResult_StringErrorZ_free(_res_conv);
17677 }
17678
17679 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17680         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17681         *ret_conv = CResult_StringErrorZ_clone(arg);
17682         return tag_ptr(ret_conv, true);
17683 }
17684 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17685         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17686         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17687         return ret_conv;
17688 }
17689
17690 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17691         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17692         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17693         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17694         return tag_ptr(ret_conv, true);
17695 }
17696
17697 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
17698         LDKPublicKey o_ref;
17699         CHECK(o->arr_len == 33);
17700         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17701         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17702         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
17703         return tag_ptr(ret_conv, true);
17704 }
17705
17706 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
17707         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17708         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17709         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
17710         return tag_ptr(ret_conv, true);
17711 }
17712
17713 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
17714         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
17715         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
17716         return ret_conv;
17717 }
17718
17719 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
17720         if (!ptr_is_owned(_res)) return;
17721         void* _res_ptr = untag_ptr(_res);
17722         CHECK_ACCESS(_res_ptr);
17723         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
17724         FREE(untag_ptr(_res));
17725         CResult_PublicKeyErrorZ_free(_res_conv);
17726 }
17727
17728 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
17729         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17730         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
17731         return tag_ptr(ret_conv, true);
17732 }
17733 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
17734         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
17735         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
17736         return ret_conv;
17737 }
17738
17739 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
17740         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
17741         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17742         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
17743         return tag_ptr(ret_conv, true);
17744 }
17745
17746 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17747         LDKChannelMonitorUpdate o_conv;
17748         o_conv.inner = untag_ptr(o);
17749         o_conv.is_owned = ptr_is_owned(o);
17750         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17751         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17752         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17753         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17754         return tag_ptr(ret_conv, true);
17755 }
17756
17757 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17758         void* e_ptr = untag_ptr(e);
17759         CHECK_ACCESS(e_ptr);
17760         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17761         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17762         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17763         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17764         return tag_ptr(ret_conv, true);
17765 }
17766
17767 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17768         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17769         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17770         return ret_conv;
17771 }
17772
17773 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17774         if (!ptr_is_owned(_res)) return;
17775         void* _res_ptr = untag_ptr(_res);
17776         CHECK_ACCESS(_res_ptr);
17777         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17778         FREE(untag_ptr(_res));
17779         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17780 }
17781
17782 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17783         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17784         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17785         return tag_ptr(ret_conv, true);
17786 }
17787 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17788         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17789         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17790         return ret_conv;
17791 }
17792
17793 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17794         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17795         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17796         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17797         return tag_ptr(ret_conv, true);
17798 }
17799
17800 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17801         void* o_ptr = untag_ptr(o);
17802         CHECK_ACCESS(o_ptr);
17803         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17804         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17805         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17806         *ret_copy = COption_MonitorEventZ_some(o_conv);
17807         uint64_t ret_ref = tag_ptr(ret_copy, true);
17808         return ret_ref;
17809 }
17810
17811 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17812         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17813         *ret_copy = COption_MonitorEventZ_none();
17814         uint64_t ret_ref = tag_ptr(ret_copy, true);
17815         return ret_ref;
17816 }
17817
17818 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17819         if (!ptr_is_owned(_res)) return;
17820         void* _res_ptr = untag_ptr(_res);
17821         CHECK_ACCESS(_res_ptr);
17822         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17823         FREE(untag_ptr(_res));
17824         COption_MonitorEventZ_free(_res_conv);
17825 }
17826
17827 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17828         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17829         *ret_copy = COption_MonitorEventZ_clone(arg);
17830         uint64_t ret_ref = tag_ptr(ret_copy, true);
17831         return ret_ref;
17832 }
17833 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17834         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17835         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17836         return ret_conv;
17837 }
17838
17839 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17840         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17841         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17842         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17843         uint64_t ret_ref = tag_ptr(ret_copy, true);
17844         return ret_ref;
17845 }
17846
17847 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17848         void* o_ptr = untag_ptr(o);
17849         CHECK_ACCESS(o_ptr);
17850         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17851         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17852         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17853         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17854         return tag_ptr(ret_conv, true);
17855 }
17856
17857 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17858         void* e_ptr = untag_ptr(e);
17859         CHECK_ACCESS(e_ptr);
17860         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17861         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17862         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17863         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17864         return tag_ptr(ret_conv, true);
17865 }
17866
17867 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17868         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17869         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17870         return ret_conv;
17871 }
17872
17873 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17874         if (!ptr_is_owned(_res)) return;
17875         void* _res_ptr = untag_ptr(_res);
17876         CHECK_ACCESS(_res_ptr);
17877         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17878         FREE(untag_ptr(_res));
17879         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17880 }
17881
17882 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17883         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17884         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17885         return tag_ptr(ret_conv, true);
17886 }
17887 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17888         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17889         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17890         return ret_conv;
17891 }
17892
17893 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17894         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17895         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17896         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17897         return tag_ptr(ret_conv, true);
17898 }
17899
17900 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17901         LDKHTLCUpdate o_conv;
17902         o_conv.inner = untag_ptr(o);
17903         o_conv.is_owned = ptr_is_owned(o);
17904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17905         o_conv = HTLCUpdate_clone(&o_conv);
17906         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17907         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17908         return tag_ptr(ret_conv, true);
17909 }
17910
17911 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17912         void* e_ptr = untag_ptr(e);
17913         CHECK_ACCESS(e_ptr);
17914         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17915         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17916         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17917         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17918         return tag_ptr(ret_conv, true);
17919 }
17920
17921 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17922         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17923         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17924         return ret_conv;
17925 }
17926
17927 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17928         if (!ptr_is_owned(_res)) return;
17929         void* _res_ptr = untag_ptr(_res);
17930         CHECK_ACCESS(_res_ptr);
17931         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17932         FREE(untag_ptr(_res));
17933         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17934 }
17935
17936 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17937         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17938         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17939         return tag_ptr(ret_conv, true);
17940 }
17941 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17942         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17943         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17944         return ret_conv;
17945 }
17946
17947 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17948         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17949         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17950         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17951         return tag_ptr(ret_conv, true);
17952 }
17953
17954 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17955         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17956         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17957         return tag_ptr(ret_conv, true);
17958 }
17959 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17960         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17961         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17962         return ret_conv;
17963 }
17964
17965 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17966         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17967         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17968         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17969         return tag_ptr(ret_conv, true);
17970 }
17971
17972 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17973         LDKOutPoint a_conv;
17974         a_conv.inner = untag_ptr(a);
17975         a_conv.is_owned = ptr_is_owned(a);
17976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17977         a_conv = OutPoint_clone(&a_conv);
17978         LDKCVec_u8Z b_ref;
17979         b_ref.datalen = b->arr_len;
17980         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17981         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17982         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17983         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17984         return tag_ptr(ret_conv, true);
17985 }
17986
17987 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17988         if (!ptr_is_owned(_res)) return;
17989         void* _res_ptr = untag_ptr(_res);
17990         CHECK_ACCESS(_res_ptr);
17991         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17992         FREE(untag_ptr(_res));
17993         C2Tuple_OutPointScriptZ_free(_res_conv);
17994 }
17995
17996 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17997         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17998         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17999         return tag_ptr(ret_conv, true);
18000 }
18001 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18002         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18003         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18004         return ret_conv;
18005 }
18006
18007 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18008         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18009         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18010         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18011         return tag_ptr(ret_conv, true);
18012 }
18013
18014 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18015         LDKCVec_u8Z b_ref;
18016         b_ref.datalen = b->arr_len;
18017         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18018         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18019         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18020         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18021         return tag_ptr(ret_conv, true);
18022 }
18023
18024 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18025         if (!ptr_is_owned(_res)) return;
18026         void* _res_ptr = untag_ptr(_res);
18027         CHECK_ACCESS(_res_ptr);
18028         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18029         FREE(untag_ptr(_res));
18030         C2Tuple_u32ScriptZ_free(_res_conv);
18031 }
18032
18033 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18034         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18035         _res_constr.datalen = _res->arr_len;
18036         if (_res_constr.datalen > 0)
18037                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18038         else
18039                 _res_constr.data = NULL;
18040         uint64_t* _res_vals = _res->elems;
18041         for (size_t v = 0; v < _res_constr.datalen; v++) {
18042                 uint64_t _res_conv_21 = _res_vals[v];
18043                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18044                 CHECK_ACCESS(_res_conv_21_ptr);
18045                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18046                 FREE(untag_ptr(_res_conv_21));
18047                 _res_constr.data[v] = _res_conv_21_conv;
18048         }
18049         FREE(_res);
18050         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18051 }
18052
18053 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18054         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18055         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18056         return tag_ptr(ret_conv, true);
18057 }
18058 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18059         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18060         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18061         return ret_conv;
18062 }
18063
18064 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18065         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18066         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18067         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18068         return tag_ptr(ret_conv, true);
18069 }
18070
18071 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18072         LDKThirtyTwoBytes a_ref;
18073         CHECK(a->arr_len == 32);
18074         memcpy(a_ref.data, a->elems, 32); FREE(a);
18075         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18076         b_constr.datalen = b->arr_len;
18077         if (b_constr.datalen > 0)
18078                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18079         else
18080                 b_constr.data = NULL;
18081         uint64_t* b_vals = b->elems;
18082         for (size_t v = 0; v < b_constr.datalen; v++) {
18083                 uint64_t b_conv_21 = b_vals[v];
18084                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18085                 CHECK_ACCESS(b_conv_21_ptr);
18086                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18087                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18088                 b_constr.data[v] = b_conv_21_conv;
18089         }
18090         FREE(b);
18091         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18092         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18093         return tag_ptr(ret_conv, true);
18094 }
18095
18096 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18097         if (!ptr_is_owned(_res)) return;
18098         void* _res_ptr = untag_ptr(_res);
18099         CHECK_ACCESS(_res_ptr);
18100         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18101         FREE(untag_ptr(_res));
18102         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18103 }
18104
18105 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18106         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18107         _res_constr.datalen = _res->arr_len;
18108         if (_res_constr.datalen > 0)
18109                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18110         else
18111                 _res_constr.data = NULL;
18112         uint64_t* _res_vals = _res->elems;
18113         for (size_t o = 0; o < _res_constr.datalen; o++) {
18114                 uint64_t _res_conv_40 = _res_vals[o];
18115                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18116                 CHECK_ACCESS(_res_conv_40_ptr);
18117                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18118                 FREE(untag_ptr(_res_conv_40));
18119                 _res_constr.data[o] = _res_conv_40_conv;
18120         }
18121         FREE(_res);
18122         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18123 }
18124
18125 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18126         LDKCVec_EventZ _res_constr;
18127         _res_constr.datalen = _res->arr_len;
18128         if (_res_constr.datalen > 0)
18129                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18130         else
18131                 _res_constr.data = NULL;
18132         uint64_t* _res_vals = _res->elems;
18133         for (size_t h = 0; h < _res_constr.datalen; h++) {
18134                 uint64_t _res_conv_7 = _res_vals[h];
18135                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18136                 CHECK_ACCESS(_res_conv_7_ptr);
18137                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18138                 FREE(untag_ptr(_res_conv_7));
18139                 _res_constr.data[h] = _res_conv_7_conv;
18140         }
18141         FREE(_res);
18142         CVec_EventZ_free(_res_constr);
18143 }
18144
18145 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18146         LDKCVec_TransactionZ _res_constr;
18147         _res_constr.datalen = _res->arr_len;
18148         if (_res_constr.datalen > 0)
18149                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18150         else
18151                 _res_constr.data = NULL;
18152         int8_tArray* _res_vals = (void*) _res->elems;
18153         for (size_t m = 0; m < _res_constr.datalen; m++) {
18154                 int8_tArray _res_conv_12 = _res_vals[m];
18155                 LDKTransaction _res_conv_12_ref;
18156                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18157                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18158                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18159                 _res_conv_12_ref.data_is_owned = true;
18160                 _res_constr.data[m] = _res_conv_12_ref;
18161         }
18162         FREE(_res);
18163         CVec_TransactionZ_free(_res_constr);
18164 }
18165
18166 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18167         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18168         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18169         return tag_ptr(ret_conv, true);
18170 }
18171 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18172         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18173         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18174         return ret_conv;
18175 }
18176
18177 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18178         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18179         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18180         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18181         return tag_ptr(ret_conv, true);
18182 }
18183
18184 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18185         void* b_ptr = untag_ptr(b);
18186         CHECK_ACCESS(b_ptr);
18187         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18188         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18189         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18190         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18191         return tag_ptr(ret_conv, true);
18192 }
18193
18194 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18195         if (!ptr_is_owned(_res)) return;
18196         void* _res_ptr = untag_ptr(_res);
18197         CHECK_ACCESS(_res_ptr);
18198         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18199         FREE(untag_ptr(_res));
18200         C2Tuple_u32TxOutZ_free(_res_conv);
18201 }
18202
18203 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18204         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18205         _res_constr.datalen = _res->arr_len;
18206         if (_res_constr.datalen > 0)
18207                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18208         else
18209                 _res_constr.data = NULL;
18210         uint64_t* _res_vals = _res->elems;
18211         for (size_t u = 0; u < _res_constr.datalen; u++) {
18212                 uint64_t _res_conv_20 = _res_vals[u];
18213                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18214                 CHECK_ACCESS(_res_conv_20_ptr);
18215                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18216                 FREE(untag_ptr(_res_conv_20));
18217                 _res_constr.data[u] = _res_conv_20_conv;
18218         }
18219         FREE(_res);
18220         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18221 }
18222
18223 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18224         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18225         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18226         return tag_ptr(ret_conv, true);
18227 }
18228 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18229         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18230         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18231         return ret_conv;
18232 }
18233
18234 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18235         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18236         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18237         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18238         return tag_ptr(ret_conv, true);
18239 }
18240
18241 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18242         LDKThirtyTwoBytes a_ref;
18243         CHECK(a->arr_len == 32);
18244         memcpy(a_ref.data, a->elems, 32); FREE(a);
18245         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18246         b_constr.datalen = b->arr_len;
18247         if (b_constr.datalen > 0)
18248                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18249         else
18250                 b_constr.data = NULL;
18251         uint64_t* b_vals = b->elems;
18252         for (size_t u = 0; u < b_constr.datalen; u++) {
18253                 uint64_t b_conv_20 = b_vals[u];
18254                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18255                 CHECK_ACCESS(b_conv_20_ptr);
18256                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18257                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18258                 b_constr.data[u] = b_conv_20_conv;
18259         }
18260         FREE(b);
18261         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18262         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18263         return tag_ptr(ret_conv, true);
18264 }
18265
18266 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18267         if (!ptr_is_owned(_res)) return;
18268         void* _res_ptr = untag_ptr(_res);
18269         CHECK_ACCESS(_res_ptr);
18270         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18271         FREE(untag_ptr(_res));
18272         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18273 }
18274
18275 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18276         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18277         _res_constr.datalen = _res->arr_len;
18278         if (_res_constr.datalen > 0)
18279                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18280         else
18281                 _res_constr.data = NULL;
18282         uint64_t* _res_vals = _res->elems;
18283         for (size_t n = 0; n < _res_constr.datalen; n++) {
18284                 uint64_t _res_conv_39 = _res_vals[n];
18285                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18286                 CHECK_ACCESS(_res_conv_39_ptr);
18287                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18288                 FREE(untag_ptr(_res_conv_39));
18289                 _res_constr.data[n] = _res_conv_39_conv;
18290         }
18291         FREE(_res);
18292         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18293 }
18294
18295 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18296         LDKCVec_BalanceZ _res_constr;
18297         _res_constr.datalen = _res->arr_len;
18298         if (_res_constr.datalen > 0)
18299                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18300         else
18301                 _res_constr.data = NULL;
18302         uint64_t* _res_vals = _res->elems;
18303         for (size_t j = 0; j < _res_constr.datalen; j++) {
18304                 uint64_t _res_conv_9 = _res_vals[j];
18305                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18306                 CHECK_ACCESS(_res_conv_9_ptr);
18307                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18308                 FREE(untag_ptr(_res_conv_9));
18309                 _res_constr.data[j] = _res_conv_9_conv;
18310         }
18311         FREE(_res);
18312         CVec_BalanceZ_free(_res_constr);
18313 }
18314
18315 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18316         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18317         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18318         return tag_ptr(ret_conv, true);
18319 }
18320 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18321         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18322         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18323         return ret_conv;
18324 }
18325
18326 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18327         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18328         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18329         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18330         return tag_ptr(ret_conv, true);
18331 }
18332
18333 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18334         LDKThirtyTwoBytes a_ref;
18335         CHECK(a->arr_len == 32);
18336         memcpy(a_ref.data, a->elems, 32); FREE(a);
18337         LDKChannelMonitor b_conv;
18338         b_conv.inner = untag_ptr(b);
18339         b_conv.is_owned = ptr_is_owned(b);
18340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18341         b_conv = ChannelMonitor_clone(&b_conv);
18342         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18343         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18344         return tag_ptr(ret_conv, true);
18345 }
18346
18347 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18348         if (!ptr_is_owned(_res)) return;
18349         void* _res_ptr = untag_ptr(_res);
18350         CHECK_ACCESS(_res_ptr);
18351         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18352         FREE(untag_ptr(_res));
18353         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18354 }
18355
18356 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18357         void* o_ptr = untag_ptr(o);
18358         CHECK_ACCESS(o_ptr);
18359         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18360         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18361         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18362         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18363         return tag_ptr(ret_conv, true);
18364 }
18365
18366 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18367         void* e_ptr = untag_ptr(e);
18368         CHECK_ACCESS(e_ptr);
18369         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18370         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18371         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18372         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18377         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18378         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18379         return ret_conv;
18380 }
18381
18382 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18383         if (!ptr_is_owned(_res)) return;
18384         void* _res_ptr = untag_ptr(_res);
18385         CHECK_ACCESS(_res_ptr);
18386         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18387         FREE(untag_ptr(_res));
18388         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18389 }
18390
18391 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18392         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18393         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18394         return tag_ptr(ret_conv, true);
18395 }
18396 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18397         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18398         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18399         return ret_conv;
18400 }
18401
18402 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18403         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18404         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18405         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18406         return tag_ptr(ret_conv, true);
18407 }
18408
18409 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18410         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18411         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18412         return tag_ptr(ret_conv, true);
18413 }
18414 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18415         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18416         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18417         return ret_conv;
18418 }
18419
18420 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18421         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18422         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18423         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18424         return tag_ptr(ret_conv, true);
18425 }
18426
18427 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18428         LDKPublicKey a_ref;
18429         CHECK(a->arr_len == 33);
18430         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18431         void* b_ptr = untag_ptr(b);
18432         CHECK_ACCESS(b_ptr);
18433         LDKType b_conv = *(LDKType*)(b_ptr);
18434         if (b_conv.free == LDKType_JCalls_free) {
18435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18436                 LDKType_JCalls_cloned(&b_conv);
18437         }
18438         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18439         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18440         return tag_ptr(ret_conv, true);
18441 }
18442
18443 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18444         if (!ptr_is_owned(_res)) return;
18445         void* _res_ptr = untag_ptr(_res);
18446         CHECK_ACCESS(_res_ptr);
18447         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18448         FREE(untag_ptr(_res));
18449         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18450 }
18451
18452 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18453         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18454         _res_constr.datalen = _res->arr_len;
18455         if (_res_constr.datalen > 0)
18456                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18457         else
18458                 _res_constr.data = NULL;
18459         uint64_t* _res_vals = _res->elems;
18460         for (size_t z = 0; z < _res_constr.datalen; z++) {
18461                 uint64_t _res_conv_25 = _res_vals[z];
18462                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18463                 CHECK_ACCESS(_res_conv_25_ptr);
18464                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18465                 FREE(untag_ptr(_res_conv_25));
18466                 _res_constr.data[z] = _res_conv_25_conv;
18467         }
18468         FREE(_res);
18469         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18470 }
18471
18472 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18473         void* o_ptr = untag_ptr(o);
18474         CHECK_ACCESS(o_ptr);
18475         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18476         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18478                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18479         }
18480         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18481         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18482         uint64_t ret_ref = tag_ptr(ret_copy, true);
18483         return ret_ref;
18484 }
18485
18486 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18487         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18488         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18489         uint64_t ret_ref = tag_ptr(ret_copy, true);
18490         return ret_ref;
18491 }
18492
18493 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18494         if (!ptr_is_owned(_res)) return;
18495         void* _res_ptr = untag_ptr(_res);
18496         CHECK_ACCESS(_res_ptr);
18497         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18498         FREE(untag_ptr(_res));
18499         COption_CustomOnionMessageContentsZ_free(_res_conv);
18500 }
18501
18502 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18503         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18504         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18505         uint64_t ret_ref = tag_ptr(ret_copy, true);
18506         return ret_ref;
18507 }
18508 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18509         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18510         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18511         return ret_conv;
18512 }
18513
18514 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18515         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18516         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18517         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18518         uint64_t ret_ref = tag_ptr(ret_copy, true);
18519         return ret_ref;
18520 }
18521
18522 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18523         void* o_ptr = untag_ptr(o);
18524         CHECK_ACCESS(o_ptr);
18525         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18526         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18527         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18528         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18529         return tag_ptr(ret_conv, true);
18530 }
18531
18532 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18533         void* e_ptr = untag_ptr(e);
18534         CHECK_ACCESS(e_ptr);
18535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18537         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18538         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18539         return tag_ptr(ret_conv, true);
18540 }
18541
18542 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18543         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18544         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18545         return ret_conv;
18546 }
18547
18548 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18549         if (!ptr_is_owned(_res)) return;
18550         void* _res_ptr = untag_ptr(_res);
18551         CHECK_ACCESS(_res_ptr);
18552         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18553         FREE(untag_ptr(_res));
18554         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18555 }
18556
18557 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18558         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18559         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18560         return tag_ptr(ret_conv, true);
18561 }
18562 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18563         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18564         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18565         return ret_conv;
18566 }
18567
18568 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18569         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18570         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18571         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18572         return tag_ptr(ret_conv, true);
18573 }
18574
18575 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18576         void* o_ptr = untag_ptr(o);
18577         CHECK_ACCESS(o_ptr);
18578         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18579         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18580         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18581         *ret_copy = COption_NetAddressZ_some(o_conv);
18582         uint64_t ret_ref = tag_ptr(ret_copy, true);
18583         return ret_ref;
18584 }
18585
18586 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18587         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18588         *ret_copy = COption_NetAddressZ_none();
18589         uint64_t ret_ref = tag_ptr(ret_copy, true);
18590         return ret_ref;
18591 }
18592
18593 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18594         if (!ptr_is_owned(_res)) return;
18595         void* _res_ptr = untag_ptr(_res);
18596         CHECK_ACCESS(_res_ptr);
18597         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18598         FREE(untag_ptr(_res));
18599         COption_NetAddressZ_free(_res_conv);
18600 }
18601
18602 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18603         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18604         *ret_copy = COption_NetAddressZ_clone(arg);
18605         uint64_t ret_ref = tag_ptr(ret_copy, true);
18606         return ret_ref;
18607 }
18608 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18609         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18610         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18611         return ret_conv;
18612 }
18613
18614 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18615         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18616         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18617         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18618         uint64_t ret_ref = tag_ptr(ret_copy, true);
18619         return ret_ref;
18620 }
18621
18622 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18623         LDKCVec_u8Z o_ref;
18624         o_ref.datalen = o->arr_len;
18625         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18626         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18627         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18628         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18629         return tag_ptr(ret_conv, true);
18630 }
18631
18632 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18633         LDKPeerHandleError e_conv;
18634         e_conv.inner = untag_ptr(e);
18635         e_conv.is_owned = ptr_is_owned(e);
18636         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18637         e_conv = PeerHandleError_clone(&e_conv);
18638         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18639         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18640         return tag_ptr(ret_conv, true);
18641 }
18642
18643 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18644         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18645         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18646         return ret_conv;
18647 }
18648
18649 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18650         if (!ptr_is_owned(_res)) return;
18651         void* _res_ptr = untag_ptr(_res);
18652         CHECK_ACCESS(_res_ptr);
18653         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18654         FREE(untag_ptr(_res));
18655         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18656 }
18657
18658 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18659         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18660         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18661         return tag_ptr(ret_conv, true);
18662 }
18663 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18664         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18665         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18666         return ret_conv;
18667 }
18668
18669 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18670         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18671         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18672         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18673         return tag_ptr(ret_conv, true);
18674 }
18675
18676 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18677         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18678         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18679         return tag_ptr(ret_conv, true);
18680 }
18681
18682 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18683         LDKPeerHandleError e_conv;
18684         e_conv.inner = untag_ptr(e);
18685         e_conv.is_owned = ptr_is_owned(e);
18686         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18687         e_conv = PeerHandleError_clone(&e_conv);
18688         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18689         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18690         return tag_ptr(ret_conv, true);
18691 }
18692
18693 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18694         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18695         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18696         return ret_conv;
18697 }
18698
18699 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18700         if (!ptr_is_owned(_res)) return;
18701         void* _res_ptr = untag_ptr(_res);
18702         CHECK_ACCESS(_res_ptr);
18703         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18704         FREE(untag_ptr(_res));
18705         CResult_NonePeerHandleErrorZ_free(_res_conv);
18706 }
18707
18708 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18709         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18710         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18711         return tag_ptr(ret_conv, true);
18712 }
18713 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18714         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18715         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18716         return ret_conv;
18717 }
18718
18719 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18720         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18721         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18722         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18723         return tag_ptr(ret_conv, true);
18724 }
18725
18726 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18727         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18728         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18729         return tag_ptr(ret_conv, true);
18730 }
18731
18732 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18733         LDKPeerHandleError e_conv;
18734         e_conv.inner = untag_ptr(e);
18735         e_conv.is_owned = ptr_is_owned(e);
18736         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18737         e_conv = PeerHandleError_clone(&e_conv);
18738         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18739         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18740         return tag_ptr(ret_conv, true);
18741 }
18742
18743 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18744         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18745         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18746         return ret_conv;
18747 }
18748
18749 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18750         if (!ptr_is_owned(_res)) return;
18751         void* _res_ptr = untag_ptr(_res);
18752         CHECK_ACCESS(_res_ptr);
18753         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18754         FREE(untag_ptr(_res));
18755         CResult_boolPeerHandleErrorZ_free(_res_conv);
18756 }
18757
18758 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18759         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18760         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18761         return tag_ptr(ret_conv, true);
18762 }
18763 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18764         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18765         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18766         return ret_conv;
18767 }
18768
18769 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18770         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18771         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18772         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18773         return tag_ptr(ret_conv, true);
18774 }
18775
18776 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18777         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18778         *ret_conv = CResult_NoneSendErrorZ_ok();
18779         return tag_ptr(ret_conv, true);
18780 }
18781
18782 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18783         void* e_ptr = untag_ptr(e);
18784         CHECK_ACCESS(e_ptr);
18785         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18786         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18787         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18788         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18789         return tag_ptr(ret_conv, true);
18790 }
18791
18792 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18793         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18794         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18795         return ret_conv;
18796 }
18797
18798 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18799         if (!ptr_is_owned(_res)) return;
18800         void* _res_ptr = untag_ptr(_res);
18801         CHECK_ACCESS(_res_ptr);
18802         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18803         FREE(untag_ptr(_res));
18804         CResult_NoneSendErrorZ_free(_res_conv);
18805 }
18806
18807 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18808         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18809         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18810         return tag_ptr(ret_conv, true);
18811 }
18812
18813 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18814         void* e_ptr = untag_ptr(e);
18815         CHECK_ACCESS(e_ptr);
18816         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18817         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18818         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18819         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18820         return tag_ptr(ret_conv, true);
18821 }
18822
18823 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18824         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18825         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18826         return ret_conv;
18827 }
18828
18829 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18830         if (!ptr_is_owned(_res)) return;
18831         void* _res_ptr = untag_ptr(_res);
18832         CHECK_ACCESS(_res_ptr);
18833         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18834         FREE(untag_ptr(_res));
18835         CResult_u32GraphSyncErrorZ_free(_res_conv);
18836 }
18837
18838 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
18839         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
18840         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18841         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
18842         return tag_ptr(ret_conv, true);
18843 }
18844
18845 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
18846         void* e_ptr = untag_ptr(e);
18847         CHECK_ACCESS(e_ptr);
18848         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18849         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
18850         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18851         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
18852         return tag_ptr(ret_conv, true);
18853 }
18854
18855 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
18856         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
18857         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
18858         return ret_conv;
18859 }
18860
18861 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
18862         if (!ptr_is_owned(_res)) return;
18863         void* _res_ptr = untag_ptr(_res);
18864         CHECK_ACCESS(_res_ptr);
18865         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
18866         FREE(untag_ptr(_res));
18867         CResult_SiPrefixParseErrorZ_free(_res_conv);
18868 }
18869
18870 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
18871         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18872         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
18873         return tag_ptr(ret_conv, true);
18874 }
18875 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
18876         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
18877         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
18878         return ret_conv;
18879 }
18880
18881 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
18882         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
18883         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18884         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
18885         return tag_ptr(ret_conv, true);
18886 }
18887
18888 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
18889         LDKInvoice o_conv;
18890         o_conv.inner = untag_ptr(o);
18891         o_conv.is_owned = ptr_is_owned(o);
18892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18893         o_conv = Invoice_clone(&o_conv);
18894         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18895         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
18896         return tag_ptr(ret_conv, true);
18897 }
18898
18899 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
18900         void* e_ptr = untag_ptr(e);
18901         CHECK_ACCESS(e_ptr);
18902         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
18903         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
18904         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18905         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
18906         return tag_ptr(ret_conv, true);
18907 }
18908
18909 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
18910         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
18911         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
18912         return ret_conv;
18913 }
18914
18915 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
18916         if (!ptr_is_owned(_res)) return;
18917         void* _res_ptr = untag_ptr(_res);
18918         CHECK_ACCESS(_res_ptr);
18919         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
18920         FREE(untag_ptr(_res));
18921         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
18922 }
18923
18924 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
18925         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18926         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
18927         return tag_ptr(ret_conv, true);
18928 }
18929 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
18930         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
18931         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
18932         return ret_conv;
18933 }
18934
18935 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
18936         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
18937         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18938         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
18939         return tag_ptr(ret_conv, true);
18940 }
18941
18942 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
18943         LDKSignedRawInvoice o_conv;
18944         o_conv.inner = untag_ptr(o);
18945         o_conv.is_owned = ptr_is_owned(o);
18946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18947         o_conv = SignedRawInvoice_clone(&o_conv);
18948         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18949         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
18950         return tag_ptr(ret_conv, true);
18951 }
18952
18953 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
18954         void* e_ptr = untag_ptr(e);
18955         CHECK_ACCESS(e_ptr);
18956         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18957         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
18958         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18959         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
18960         return tag_ptr(ret_conv, true);
18961 }
18962
18963 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
18964         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
18965         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
18966         return ret_conv;
18967 }
18968
18969 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
18970         if (!ptr_is_owned(_res)) return;
18971         void* _res_ptr = untag_ptr(_res);
18972         CHECK_ACCESS(_res_ptr);
18973         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
18974         FREE(untag_ptr(_res));
18975         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
18976 }
18977
18978 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
18979         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18980         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
18981         return tag_ptr(ret_conv, true);
18982 }
18983 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
18984         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
18985         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
18986         return ret_conv;
18987 }
18988
18989 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
18990         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
18991         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18992         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
18993         return tag_ptr(ret_conv, true);
18994 }
18995
18996 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18997         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18998         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
18999         return tag_ptr(ret_conv, true);
19000 }
19001 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
19002         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19003         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19004         return ret_conv;
19005 }
19006
19007 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
19008         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19009         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19010         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19011         return tag_ptr(ret_conv, true);
19012 }
19013
19014 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
19015         LDKRawInvoice a_conv;
19016         a_conv.inner = untag_ptr(a);
19017         a_conv.is_owned = ptr_is_owned(a);
19018         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19019         a_conv = RawInvoice_clone(&a_conv);
19020         LDKThirtyTwoBytes b_ref;
19021         CHECK(b->arr_len == 32);
19022         memcpy(b_ref.data, b->elems, 32); FREE(b);
19023         LDKInvoiceSignature c_conv;
19024         c_conv.inner = untag_ptr(c);
19025         c_conv.is_owned = ptr_is_owned(c);
19026         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19027         c_conv = InvoiceSignature_clone(&c_conv);
19028         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19029         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19030         return tag_ptr(ret_conv, true);
19031 }
19032
19033 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
19034         if (!ptr_is_owned(_res)) return;
19035         void* _res_ptr = untag_ptr(_res);
19036         CHECK_ACCESS(_res_ptr);
19037         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19038         FREE(untag_ptr(_res));
19039         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19040 }
19041
19042 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
19043         LDKPayeePubKey o_conv;
19044         o_conv.inner = untag_ptr(o);
19045         o_conv.is_owned = ptr_is_owned(o);
19046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19047         o_conv = PayeePubKey_clone(&o_conv);
19048         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19049         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19050         return tag_ptr(ret_conv, true);
19051 }
19052
19053 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
19054         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19055         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19056         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19057         return tag_ptr(ret_conv, true);
19058 }
19059
19060 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
19061         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19062         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19063         return ret_conv;
19064 }
19065
19066 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
19067         if (!ptr_is_owned(_res)) return;
19068         void* _res_ptr = untag_ptr(_res);
19069         CHECK_ACCESS(_res_ptr);
19070         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19071         FREE(untag_ptr(_res));
19072         CResult_PayeePubKeyErrorZ_free(_res_conv);
19073 }
19074
19075 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19076         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19077         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19078         return tag_ptr(ret_conv, true);
19079 }
19080 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
19081         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19082         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19083         return ret_conv;
19084 }
19085
19086 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
19087         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19088         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19089         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19090         return tag_ptr(ret_conv, true);
19091 }
19092
19093 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
19094         LDKCVec_PrivateRouteZ _res_constr;
19095         _res_constr.datalen = _res->arr_len;
19096         if (_res_constr.datalen > 0)
19097                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19098         else
19099                 _res_constr.data = NULL;
19100         uint64_t* _res_vals = _res->elems;
19101         for (size_t o = 0; o < _res_constr.datalen; o++) {
19102                 uint64_t _res_conv_14 = _res_vals[o];
19103                 LDKPrivateRoute _res_conv_14_conv;
19104                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19105                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19106                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19107                 _res_constr.data[o] = _res_conv_14_conv;
19108         }
19109         FREE(_res);
19110         CVec_PrivateRouteZ_free(_res_constr);
19111 }
19112
19113 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
19114         LDKPositiveTimestamp o_conv;
19115         o_conv.inner = untag_ptr(o);
19116         o_conv.is_owned = ptr_is_owned(o);
19117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19118         o_conv = PositiveTimestamp_clone(&o_conv);
19119         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19120         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19121         return tag_ptr(ret_conv, true);
19122 }
19123
19124 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
19125         LDKCreationError e_conv = LDKCreationError_from_js(e);
19126         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19127         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19128         return tag_ptr(ret_conv, true);
19129 }
19130
19131 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
19132         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19133         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19134         return ret_conv;
19135 }
19136
19137 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
19138         if (!ptr_is_owned(_res)) return;
19139         void* _res_ptr = untag_ptr(_res);
19140         CHECK_ACCESS(_res_ptr);
19141         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19142         FREE(untag_ptr(_res));
19143         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19144 }
19145
19146 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19147         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19148         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19149         return tag_ptr(ret_conv, true);
19150 }
19151 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
19152         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19153         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19154         return ret_conv;
19155 }
19156
19157 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
19158         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19159         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19160         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19161         return tag_ptr(ret_conv, true);
19162 }
19163
19164 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
19165         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19166         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19167         return tag_ptr(ret_conv, true);
19168 }
19169
19170 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
19171         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19172         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19173         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19174         return tag_ptr(ret_conv, true);
19175 }
19176
19177 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
19178         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19179         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19180         return ret_conv;
19181 }
19182
19183 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
19184         if (!ptr_is_owned(_res)) return;
19185         void* _res_ptr = untag_ptr(_res);
19186         CHECK_ACCESS(_res_ptr);
19187         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19188         FREE(untag_ptr(_res));
19189         CResult_NoneSemanticErrorZ_free(_res_conv);
19190 }
19191
19192 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19193         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19194         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19195         return tag_ptr(ret_conv, true);
19196 }
19197 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
19198         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19199         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19200         return ret_conv;
19201 }
19202
19203 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
19204         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19205         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19206         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19207         return tag_ptr(ret_conv, true);
19208 }
19209
19210 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
19211         LDKInvoice o_conv;
19212         o_conv.inner = untag_ptr(o);
19213         o_conv.is_owned = ptr_is_owned(o);
19214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19215         o_conv = Invoice_clone(&o_conv);
19216         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19217         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19218         return tag_ptr(ret_conv, true);
19219 }
19220
19221 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
19222         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19223         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19224         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19225         return tag_ptr(ret_conv, true);
19226 }
19227
19228 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
19229         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19230         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19231         return ret_conv;
19232 }
19233
19234 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
19235         if (!ptr_is_owned(_res)) return;
19236         void* _res_ptr = untag_ptr(_res);
19237         CHECK_ACCESS(_res_ptr);
19238         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19239         FREE(untag_ptr(_res));
19240         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19241 }
19242
19243 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19244         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19245         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19246         return tag_ptr(ret_conv, true);
19247 }
19248 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
19249         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
19250         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19251         return ret_conv;
19252 }
19253
19254 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
19255         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
19256         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19257         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19258         return tag_ptr(ret_conv, true);
19259 }
19260
19261 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
19262         LDKDescription o_conv;
19263         o_conv.inner = untag_ptr(o);
19264         o_conv.is_owned = ptr_is_owned(o);
19265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19266         o_conv = Description_clone(&o_conv);
19267         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19268         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19269         return tag_ptr(ret_conv, true);
19270 }
19271
19272 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
19273         LDKCreationError e_conv = LDKCreationError_from_js(e);
19274         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19275         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19276         return tag_ptr(ret_conv, true);
19277 }
19278
19279 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
19280         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
19281         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19282         return ret_conv;
19283 }
19284
19285 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
19286         if (!ptr_is_owned(_res)) return;
19287         void* _res_ptr = untag_ptr(_res);
19288         CHECK_ACCESS(_res_ptr);
19289         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19290         FREE(untag_ptr(_res));
19291         CResult_DescriptionCreationErrorZ_free(_res_conv);
19292 }
19293
19294 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19295         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19296         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19297         return tag_ptr(ret_conv, true);
19298 }
19299 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
19300         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
19301         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19302         return ret_conv;
19303 }
19304
19305 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
19306         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
19307         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19308         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19309         return tag_ptr(ret_conv, true);
19310 }
19311
19312 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
19313         LDKPrivateRoute o_conv;
19314         o_conv.inner = untag_ptr(o);
19315         o_conv.is_owned = ptr_is_owned(o);
19316         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19317         o_conv = PrivateRoute_clone(&o_conv);
19318         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19319         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19320         return tag_ptr(ret_conv, true);
19321 }
19322
19323 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
19324         LDKCreationError e_conv = LDKCreationError_from_js(e);
19325         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19326         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19327         return tag_ptr(ret_conv, true);
19328 }
19329
19330 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
19331         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
19332         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19333         return ret_conv;
19334 }
19335
19336 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
19337         if (!ptr_is_owned(_res)) return;
19338         void* _res_ptr = untag_ptr(_res);
19339         CHECK_ACCESS(_res_ptr);
19340         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19341         FREE(untag_ptr(_res));
19342         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19343 }
19344
19345 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19346         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19347         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19348         return tag_ptr(ret_conv, true);
19349 }
19350 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
19351         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
19352         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19353         return ret_conv;
19354 }
19355
19356 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
19357         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
19358         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19359         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19360         return tag_ptr(ret_conv, true);
19361 }
19362
19363 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19364         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19365         *ret_conv = CResult_NoneErrorZ_ok();
19366         return tag_ptr(ret_conv, true);
19367 }
19368
19369 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19370         LDKIOError e_conv = LDKIOError_from_js(e);
19371         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19372         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19373         return tag_ptr(ret_conv, true);
19374 }
19375
19376 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19377         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19378         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19379         return ret_conv;
19380 }
19381
19382 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19383         if (!ptr_is_owned(_res)) return;
19384         void* _res_ptr = untag_ptr(_res);
19385         CHECK_ACCESS(_res_ptr);
19386         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19387         FREE(untag_ptr(_res));
19388         CResult_NoneErrorZ_free(_res_conv);
19389 }
19390
19391 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19392         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19393         *ret_conv = CResult_NoneErrorZ_clone(arg);
19394         return tag_ptr(ret_conv, true);
19395 }
19396 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19397         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19398         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19399         return ret_conv;
19400 }
19401
19402 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19403         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19404         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19405         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19406         return tag_ptr(ret_conv, true);
19407 }
19408
19409 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19410         void* o_ptr = untag_ptr(o);
19411         CHECK_ACCESS(o_ptr);
19412         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19413         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19414         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19415         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19416         return tag_ptr(ret_conv, true);
19417 }
19418
19419 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19420         void* e_ptr = untag_ptr(e);
19421         CHECK_ACCESS(e_ptr);
19422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19424         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19425         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19426         return tag_ptr(ret_conv, true);
19427 }
19428
19429 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19430         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19431         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19432         return ret_conv;
19433 }
19434
19435 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19436         if (!ptr_is_owned(_res)) return;
19437         void* _res_ptr = untag_ptr(_res);
19438         CHECK_ACCESS(_res_ptr);
19439         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19440         FREE(untag_ptr(_res));
19441         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19442 }
19443
19444 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19445         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19446         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19447         return tag_ptr(ret_conv, true);
19448 }
19449 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19450         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19451         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19452         return ret_conv;
19453 }
19454
19455 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19456         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19457         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19458         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19459         return tag_ptr(ret_conv, true);
19460 }
19461
19462 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19463         LDKCVec_UpdateAddHTLCZ _res_constr;
19464         _res_constr.datalen = _res->arr_len;
19465         if (_res_constr.datalen > 0)
19466                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19467         else
19468                 _res_constr.data = NULL;
19469         uint64_t* _res_vals = _res->elems;
19470         for (size_t p = 0; p < _res_constr.datalen; p++) {
19471                 uint64_t _res_conv_15 = _res_vals[p];
19472                 LDKUpdateAddHTLC _res_conv_15_conv;
19473                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19474                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19476                 _res_constr.data[p] = _res_conv_15_conv;
19477         }
19478         FREE(_res);
19479         CVec_UpdateAddHTLCZ_free(_res_constr);
19480 }
19481
19482 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
19483         LDKCVec_UpdateFulfillHTLCZ _res_constr;
19484         _res_constr.datalen = _res->arr_len;
19485         if (_res_constr.datalen > 0)
19486                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19487         else
19488                 _res_constr.data = NULL;
19489         uint64_t* _res_vals = _res->elems;
19490         for (size_t t = 0; t < _res_constr.datalen; t++) {
19491                 uint64_t _res_conv_19 = _res_vals[t];
19492                 LDKUpdateFulfillHTLC _res_conv_19_conv;
19493                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
19494                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
19495                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
19496                 _res_constr.data[t] = _res_conv_19_conv;
19497         }
19498         FREE(_res);
19499         CVec_UpdateFulfillHTLCZ_free(_res_constr);
19500 }
19501
19502 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
19503         LDKCVec_UpdateFailHTLCZ _res_constr;
19504         _res_constr.datalen = _res->arr_len;
19505         if (_res_constr.datalen > 0)
19506                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19507         else
19508                 _res_constr.data = NULL;
19509         uint64_t* _res_vals = _res->elems;
19510         for (size_t q = 0; q < _res_constr.datalen; q++) {
19511                 uint64_t _res_conv_16 = _res_vals[q];
19512                 LDKUpdateFailHTLC _res_conv_16_conv;
19513                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19514                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19515                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19516                 _res_constr.data[q] = _res_conv_16_conv;
19517         }
19518         FREE(_res);
19519         CVec_UpdateFailHTLCZ_free(_res_constr);
19520 }
19521
19522 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
19523         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
19524         _res_constr.datalen = _res->arr_len;
19525         if (_res_constr.datalen > 0)
19526                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19527         else
19528                 _res_constr.data = NULL;
19529         uint64_t* _res_vals = _res->elems;
19530         for (size_t z = 0; z < _res_constr.datalen; z++) {
19531                 uint64_t _res_conv_25 = _res_vals[z];
19532                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
19533                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
19534                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
19535                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
19536                 _res_constr.data[z] = _res_conv_25_conv;
19537         }
19538         FREE(_res);
19539         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
19540 }
19541
19542 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
19543         LDKAcceptChannel o_conv;
19544         o_conv.inner = untag_ptr(o);
19545         o_conv.is_owned = ptr_is_owned(o);
19546         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19547         o_conv = AcceptChannel_clone(&o_conv);
19548         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19549         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
19550         return tag_ptr(ret_conv, true);
19551 }
19552
19553 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
19554         void* e_ptr = untag_ptr(e);
19555         CHECK_ACCESS(e_ptr);
19556         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19557         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19558         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19559         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
19560         return tag_ptr(ret_conv, true);
19561 }
19562
19563 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
19564         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
19565         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
19566         return ret_conv;
19567 }
19568
19569 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
19570         if (!ptr_is_owned(_res)) return;
19571         void* _res_ptr = untag_ptr(_res);
19572         CHECK_ACCESS(_res_ptr);
19573         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
19574         FREE(untag_ptr(_res));
19575         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
19576 }
19577
19578 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
19579         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19580         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
19581         return tag_ptr(ret_conv, true);
19582 }
19583 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19584         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
19585         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
19586         return ret_conv;
19587 }
19588
19589 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
19590         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
19591         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19592         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
19593         return tag_ptr(ret_conv, true);
19594 }
19595
19596 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
19597         LDKAnnouncementSignatures o_conv;
19598         o_conv.inner = untag_ptr(o);
19599         o_conv.is_owned = ptr_is_owned(o);
19600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19601         o_conv = AnnouncementSignatures_clone(&o_conv);
19602         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19603         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
19604         return tag_ptr(ret_conv, true);
19605 }
19606
19607 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
19608         void* e_ptr = untag_ptr(e);
19609         CHECK_ACCESS(e_ptr);
19610         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19611         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19612         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19613         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
19614         return tag_ptr(ret_conv, true);
19615 }
19616
19617 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
19618         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
19619         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
19620         return ret_conv;
19621 }
19622
19623 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
19624         if (!ptr_is_owned(_res)) return;
19625         void* _res_ptr = untag_ptr(_res);
19626         CHECK_ACCESS(_res_ptr);
19627         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
19628         FREE(untag_ptr(_res));
19629         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
19630 }
19631
19632 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
19633         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19634         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
19635         return tag_ptr(ret_conv, true);
19636 }
19637 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19638         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
19639         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
19640         return ret_conv;
19641 }
19642
19643 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
19644         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
19645         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19646         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
19647         return tag_ptr(ret_conv, true);
19648 }
19649
19650 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
19651         LDKChannelReestablish o_conv;
19652         o_conv.inner = untag_ptr(o);
19653         o_conv.is_owned = ptr_is_owned(o);
19654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19655         o_conv = ChannelReestablish_clone(&o_conv);
19656         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19657         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
19658         return tag_ptr(ret_conv, true);
19659 }
19660
19661 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
19662         void* e_ptr = untag_ptr(e);
19663         CHECK_ACCESS(e_ptr);
19664         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19665         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19666         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19667         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
19668         return tag_ptr(ret_conv, true);
19669 }
19670
19671 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19672         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19673         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19674         return ret_conv;
19675 }
19676
19677 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19678         if (!ptr_is_owned(_res)) return;
19679         void* _res_ptr = untag_ptr(_res);
19680         CHECK_ACCESS(_res_ptr);
19681         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19682         FREE(untag_ptr(_res));
19683         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19684 }
19685
19686 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19687         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19688         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19689         return tag_ptr(ret_conv, true);
19690 }
19691 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19692         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19693         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19694         return ret_conv;
19695 }
19696
19697 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19698         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19699         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19700         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19701         return tag_ptr(ret_conv, true);
19702 }
19703
19704 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
19705         LDKClosingSigned o_conv;
19706         o_conv.inner = untag_ptr(o);
19707         o_conv.is_owned = ptr_is_owned(o);
19708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19709         o_conv = ClosingSigned_clone(&o_conv);
19710         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19711         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
19712         return tag_ptr(ret_conv, true);
19713 }
19714
19715 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
19716         void* e_ptr = untag_ptr(e);
19717         CHECK_ACCESS(e_ptr);
19718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19720         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19721         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
19722         return tag_ptr(ret_conv, true);
19723 }
19724
19725 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
19726         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
19727         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
19728         return ret_conv;
19729 }
19730
19731 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
19732         if (!ptr_is_owned(_res)) return;
19733         void* _res_ptr = untag_ptr(_res);
19734         CHECK_ACCESS(_res_ptr);
19735         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
19736         FREE(untag_ptr(_res));
19737         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
19738 }
19739
19740 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
19741         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19742         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
19743         return tag_ptr(ret_conv, true);
19744 }
19745 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19746         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
19747         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
19748         return ret_conv;
19749 }
19750
19751 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
19752         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
19753         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19754         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
19755         return tag_ptr(ret_conv, true);
19756 }
19757
19758 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
19759         LDKClosingSignedFeeRange o_conv;
19760         o_conv.inner = untag_ptr(o);
19761         o_conv.is_owned = ptr_is_owned(o);
19762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19763         o_conv = ClosingSignedFeeRange_clone(&o_conv);
19764         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19765         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
19766         return tag_ptr(ret_conv, true);
19767 }
19768
19769 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
19770         void* e_ptr = untag_ptr(e);
19771         CHECK_ACCESS(e_ptr);
19772         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19773         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19774         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19775         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
19776         return tag_ptr(ret_conv, true);
19777 }
19778
19779 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
19780         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
19781         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
19782         return ret_conv;
19783 }
19784
19785 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
19786         if (!ptr_is_owned(_res)) return;
19787         void* _res_ptr = untag_ptr(_res);
19788         CHECK_ACCESS(_res_ptr);
19789         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19790         FREE(untag_ptr(_res));
19791         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19792 }
19793
19794 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19795         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19796         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19797         return tag_ptr(ret_conv, true);
19798 }
19799 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19800         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19801         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19802         return ret_conv;
19803 }
19804
19805 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19806         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19807         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19808         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19809         return tag_ptr(ret_conv, true);
19810 }
19811
19812 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19813         LDKCommitmentSigned o_conv;
19814         o_conv.inner = untag_ptr(o);
19815         o_conv.is_owned = ptr_is_owned(o);
19816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19817         o_conv = CommitmentSigned_clone(&o_conv);
19818         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19819         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19820         return tag_ptr(ret_conv, true);
19821 }
19822
19823 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19824         void* e_ptr = untag_ptr(e);
19825         CHECK_ACCESS(e_ptr);
19826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19828         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19829         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19830         return tag_ptr(ret_conv, true);
19831 }
19832
19833 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19834         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19835         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19836         return ret_conv;
19837 }
19838
19839 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19840         if (!ptr_is_owned(_res)) return;
19841         void* _res_ptr = untag_ptr(_res);
19842         CHECK_ACCESS(_res_ptr);
19843         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19844         FREE(untag_ptr(_res));
19845         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19846 }
19847
19848 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19849         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19850         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19851         return tag_ptr(ret_conv, true);
19852 }
19853 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19854         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19855         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19856         return ret_conv;
19857 }
19858
19859 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19860         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19861         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19862         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19863         return tag_ptr(ret_conv, true);
19864 }
19865
19866 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19867         LDKFundingCreated o_conv;
19868         o_conv.inner = untag_ptr(o);
19869         o_conv.is_owned = ptr_is_owned(o);
19870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19871         o_conv = FundingCreated_clone(&o_conv);
19872         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19873         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19874         return tag_ptr(ret_conv, true);
19875 }
19876
19877 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19878         void* e_ptr = untag_ptr(e);
19879         CHECK_ACCESS(e_ptr);
19880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19882         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19883         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19884         return tag_ptr(ret_conv, true);
19885 }
19886
19887 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19888         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19889         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19890         return ret_conv;
19891 }
19892
19893 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19894         if (!ptr_is_owned(_res)) return;
19895         void* _res_ptr = untag_ptr(_res);
19896         CHECK_ACCESS(_res_ptr);
19897         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19898         FREE(untag_ptr(_res));
19899         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19900 }
19901
19902 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19903         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19904         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19905         return tag_ptr(ret_conv, true);
19906 }
19907 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19908         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19909         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19910         return ret_conv;
19911 }
19912
19913 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19914         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19915         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19916         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19917         return tag_ptr(ret_conv, true);
19918 }
19919
19920 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19921         LDKFundingSigned o_conv;
19922         o_conv.inner = untag_ptr(o);
19923         o_conv.is_owned = ptr_is_owned(o);
19924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19925         o_conv = FundingSigned_clone(&o_conv);
19926         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19927         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19928         return tag_ptr(ret_conv, true);
19929 }
19930
19931 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19932         void* e_ptr = untag_ptr(e);
19933         CHECK_ACCESS(e_ptr);
19934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19936         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19937         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19938         return tag_ptr(ret_conv, true);
19939 }
19940
19941 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19942         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19943         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19944         return ret_conv;
19945 }
19946
19947 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19948         if (!ptr_is_owned(_res)) return;
19949         void* _res_ptr = untag_ptr(_res);
19950         CHECK_ACCESS(_res_ptr);
19951         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19952         FREE(untag_ptr(_res));
19953         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19954 }
19955
19956 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19957         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19958         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19959         return tag_ptr(ret_conv, true);
19960 }
19961 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19962         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19963         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19964         return ret_conv;
19965 }
19966
19967 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19968         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19969         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19970         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19971         return tag_ptr(ret_conv, true);
19972 }
19973
19974 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19975         LDKChannelReady o_conv;
19976         o_conv.inner = untag_ptr(o);
19977         o_conv.is_owned = ptr_is_owned(o);
19978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19979         o_conv = ChannelReady_clone(&o_conv);
19980         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19981         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19982         return tag_ptr(ret_conv, true);
19983 }
19984
19985 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19986         void* e_ptr = untag_ptr(e);
19987         CHECK_ACCESS(e_ptr);
19988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19990         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19991         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19992         return tag_ptr(ret_conv, true);
19993 }
19994
19995 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19996         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19997         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19998         return ret_conv;
19999 }
20000
20001 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20002         if (!ptr_is_owned(_res)) return;
20003         void* _res_ptr = untag_ptr(_res);
20004         CHECK_ACCESS(_res_ptr);
20005         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20006         FREE(untag_ptr(_res));
20007         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20008 }
20009
20010 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20011         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20012         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20013         return tag_ptr(ret_conv, true);
20014 }
20015 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20016         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20017         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20018         return ret_conv;
20019 }
20020
20021 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20022         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20023         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20024         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20025         return tag_ptr(ret_conv, true);
20026 }
20027
20028 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20029         LDKInit o_conv;
20030         o_conv.inner = untag_ptr(o);
20031         o_conv.is_owned = ptr_is_owned(o);
20032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20033         o_conv = Init_clone(&o_conv);
20034         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20035         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20036         return tag_ptr(ret_conv, true);
20037 }
20038
20039 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20040         void* e_ptr = untag_ptr(e);
20041         CHECK_ACCESS(e_ptr);
20042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20044         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20045         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20046         return tag_ptr(ret_conv, true);
20047 }
20048
20049 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20050         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20051         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20052         return ret_conv;
20053 }
20054
20055 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20056         if (!ptr_is_owned(_res)) return;
20057         void* _res_ptr = untag_ptr(_res);
20058         CHECK_ACCESS(_res_ptr);
20059         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20060         FREE(untag_ptr(_res));
20061         CResult_InitDecodeErrorZ_free(_res_conv);
20062 }
20063
20064 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20065         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20066         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20067         return tag_ptr(ret_conv, true);
20068 }
20069 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20070         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20071         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20072         return ret_conv;
20073 }
20074
20075 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20076         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20077         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20078         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20079         return tag_ptr(ret_conv, true);
20080 }
20081
20082 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20083         LDKOpenChannel o_conv;
20084         o_conv.inner = untag_ptr(o);
20085         o_conv.is_owned = ptr_is_owned(o);
20086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20087         o_conv = OpenChannel_clone(&o_conv);
20088         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20089         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20090         return tag_ptr(ret_conv, true);
20091 }
20092
20093 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20094         void* e_ptr = untag_ptr(e);
20095         CHECK_ACCESS(e_ptr);
20096         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20097         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20098         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20099         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20100         return tag_ptr(ret_conv, true);
20101 }
20102
20103 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20104         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20105         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20106         return ret_conv;
20107 }
20108
20109 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20110         if (!ptr_is_owned(_res)) return;
20111         void* _res_ptr = untag_ptr(_res);
20112         CHECK_ACCESS(_res_ptr);
20113         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20114         FREE(untag_ptr(_res));
20115         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20116 }
20117
20118 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20119         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20120         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20121         return tag_ptr(ret_conv, true);
20122 }
20123 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20124         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20125         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20126         return ret_conv;
20127 }
20128
20129 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20130         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20131         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20132         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20133         return tag_ptr(ret_conv, true);
20134 }
20135
20136 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20137         LDKRevokeAndACK o_conv;
20138         o_conv.inner = untag_ptr(o);
20139         o_conv.is_owned = ptr_is_owned(o);
20140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20141         o_conv = RevokeAndACK_clone(&o_conv);
20142         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20143         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20144         return tag_ptr(ret_conv, true);
20145 }
20146
20147 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20148         void* e_ptr = untag_ptr(e);
20149         CHECK_ACCESS(e_ptr);
20150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20152         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20153         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20154         return tag_ptr(ret_conv, true);
20155 }
20156
20157 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20158         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20159         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20160         return ret_conv;
20161 }
20162
20163 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20164         if (!ptr_is_owned(_res)) return;
20165         void* _res_ptr = untag_ptr(_res);
20166         CHECK_ACCESS(_res_ptr);
20167         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20168         FREE(untag_ptr(_res));
20169         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20170 }
20171
20172 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20173         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20174         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20175         return tag_ptr(ret_conv, true);
20176 }
20177 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20178         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20179         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20180         return ret_conv;
20181 }
20182
20183 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20184         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20185         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20186         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20187         return tag_ptr(ret_conv, true);
20188 }
20189
20190 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20191         LDKShutdown o_conv;
20192         o_conv.inner = untag_ptr(o);
20193         o_conv.is_owned = ptr_is_owned(o);
20194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20195         o_conv = Shutdown_clone(&o_conv);
20196         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20197         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20198         return tag_ptr(ret_conv, true);
20199 }
20200
20201 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20202         void* e_ptr = untag_ptr(e);
20203         CHECK_ACCESS(e_ptr);
20204         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20205         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20206         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20207         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20208         return tag_ptr(ret_conv, true);
20209 }
20210
20211 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20212         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20213         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20214         return ret_conv;
20215 }
20216
20217 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20218         if (!ptr_is_owned(_res)) return;
20219         void* _res_ptr = untag_ptr(_res);
20220         CHECK_ACCESS(_res_ptr);
20221         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20222         FREE(untag_ptr(_res));
20223         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20224 }
20225
20226 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20227         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20228         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20229         return tag_ptr(ret_conv, true);
20230 }
20231 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20232         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20233         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20234         return ret_conv;
20235 }
20236
20237 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20238         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20239         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20240         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20241         return tag_ptr(ret_conv, true);
20242 }
20243
20244 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20245         LDKUpdateFailHTLC o_conv;
20246         o_conv.inner = untag_ptr(o);
20247         o_conv.is_owned = ptr_is_owned(o);
20248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20249         o_conv = UpdateFailHTLC_clone(&o_conv);
20250         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20251         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20252         return tag_ptr(ret_conv, true);
20253 }
20254
20255 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20256         void* e_ptr = untag_ptr(e);
20257         CHECK_ACCESS(e_ptr);
20258         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20259         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20260         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20261         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20262         return tag_ptr(ret_conv, true);
20263 }
20264
20265 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20266         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20267         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20268         return ret_conv;
20269 }
20270
20271 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20272         if (!ptr_is_owned(_res)) return;
20273         void* _res_ptr = untag_ptr(_res);
20274         CHECK_ACCESS(_res_ptr);
20275         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20276         FREE(untag_ptr(_res));
20277         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20278 }
20279
20280 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20281         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20282         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20283         return tag_ptr(ret_conv, true);
20284 }
20285 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20286         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20287         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20288         return ret_conv;
20289 }
20290
20291 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20292         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20293         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20294         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20295         return tag_ptr(ret_conv, true);
20296 }
20297
20298 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20299         LDKUpdateFailMalformedHTLC o_conv;
20300         o_conv.inner = untag_ptr(o);
20301         o_conv.is_owned = ptr_is_owned(o);
20302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20303         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20304         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20305         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20306         return tag_ptr(ret_conv, true);
20307 }
20308
20309 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20310         void* e_ptr = untag_ptr(e);
20311         CHECK_ACCESS(e_ptr);
20312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20314         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20315         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20316         return tag_ptr(ret_conv, true);
20317 }
20318
20319 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20320         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20321         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20322         return ret_conv;
20323 }
20324
20325 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20326         if (!ptr_is_owned(_res)) return;
20327         void* _res_ptr = untag_ptr(_res);
20328         CHECK_ACCESS(_res_ptr);
20329         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20330         FREE(untag_ptr(_res));
20331         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20332 }
20333
20334 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20335         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20336         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20337         return tag_ptr(ret_conv, true);
20338 }
20339 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20340         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20341         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20342         return ret_conv;
20343 }
20344
20345 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20346         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20347         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20348         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20349         return tag_ptr(ret_conv, true);
20350 }
20351
20352 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20353         LDKUpdateFee o_conv;
20354         o_conv.inner = untag_ptr(o);
20355         o_conv.is_owned = ptr_is_owned(o);
20356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20357         o_conv = UpdateFee_clone(&o_conv);
20358         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20359         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20360         return tag_ptr(ret_conv, true);
20361 }
20362
20363 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20364         void* e_ptr = untag_ptr(e);
20365         CHECK_ACCESS(e_ptr);
20366         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20367         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20368         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20369         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20370         return tag_ptr(ret_conv, true);
20371 }
20372
20373 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20374         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20375         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20376         return ret_conv;
20377 }
20378
20379 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20380         if (!ptr_is_owned(_res)) return;
20381         void* _res_ptr = untag_ptr(_res);
20382         CHECK_ACCESS(_res_ptr);
20383         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20384         FREE(untag_ptr(_res));
20385         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20386 }
20387
20388 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20389         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20390         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20391         return tag_ptr(ret_conv, true);
20392 }
20393 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20394         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20395         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20396         return ret_conv;
20397 }
20398
20399 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20400         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20401         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20402         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20403         return tag_ptr(ret_conv, true);
20404 }
20405
20406 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20407         LDKUpdateFulfillHTLC o_conv;
20408         o_conv.inner = untag_ptr(o);
20409         o_conv.is_owned = ptr_is_owned(o);
20410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20411         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20412         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20413         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20414         return tag_ptr(ret_conv, true);
20415 }
20416
20417 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20418         void* e_ptr = untag_ptr(e);
20419         CHECK_ACCESS(e_ptr);
20420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20422         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20423         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20424         return tag_ptr(ret_conv, true);
20425 }
20426
20427 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20428         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20429         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20430         return ret_conv;
20431 }
20432
20433 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20434         if (!ptr_is_owned(_res)) return;
20435         void* _res_ptr = untag_ptr(_res);
20436         CHECK_ACCESS(_res_ptr);
20437         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20438         FREE(untag_ptr(_res));
20439         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20440 }
20441
20442 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20443         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20444         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20445         return tag_ptr(ret_conv, true);
20446 }
20447 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20448         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20449         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20450         return ret_conv;
20451 }
20452
20453 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20454         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20455         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20456         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20457         return tag_ptr(ret_conv, true);
20458 }
20459
20460 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20461         LDKUpdateAddHTLC o_conv;
20462         o_conv.inner = untag_ptr(o);
20463         o_conv.is_owned = ptr_is_owned(o);
20464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20465         o_conv = UpdateAddHTLC_clone(&o_conv);
20466         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20467         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20468         return tag_ptr(ret_conv, true);
20469 }
20470
20471 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20472         void* e_ptr = untag_ptr(e);
20473         CHECK_ACCESS(e_ptr);
20474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20476         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20477         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20478         return tag_ptr(ret_conv, true);
20479 }
20480
20481 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
20482         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
20483         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
20484         return ret_conv;
20485 }
20486
20487 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
20488         if (!ptr_is_owned(_res)) return;
20489         void* _res_ptr = untag_ptr(_res);
20490         CHECK_ACCESS(_res_ptr);
20491         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
20492         FREE(untag_ptr(_res));
20493         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
20494 }
20495
20496 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
20497         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20498         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
20499         return tag_ptr(ret_conv, true);
20500 }
20501 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20502         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
20503         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
20504         return ret_conv;
20505 }
20506
20507 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
20508         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
20509         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20510         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
20511         return tag_ptr(ret_conv, true);
20512 }
20513
20514 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
20515         LDKOnionMessage o_conv;
20516         o_conv.inner = untag_ptr(o);
20517         o_conv.is_owned = ptr_is_owned(o);
20518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20519         o_conv = OnionMessage_clone(&o_conv);
20520         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20521         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
20522         return tag_ptr(ret_conv, true);
20523 }
20524
20525 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
20526         void* e_ptr = untag_ptr(e);
20527         CHECK_ACCESS(e_ptr);
20528         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20529         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20530         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20531         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
20532         return tag_ptr(ret_conv, true);
20533 }
20534
20535 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
20536         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
20537         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
20538         return ret_conv;
20539 }
20540
20541 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
20542         if (!ptr_is_owned(_res)) return;
20543         void* _res_ptr = untag_ptr(_res);
20544         CHECK_ACCESS(_res_ptr);
20545         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
20546         FREE(untag_ptr(_res));
20547         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
20548 }
20549
20550 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
20551         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20552         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
20553         return tag_ptr(ret_conv, true);
20554 }
20555 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20556         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
20557         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
20558         return ret_conv;
20559 }
20560
20561 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
20562         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
20563         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20564         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
20565         return tag_ptr(ret_conv, true);
20566 }
20567
20568 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
20569         LDKPing o_conv;
20570         o_conv.inner = untag_ptr(o);
20571         o_conv.is_owned = ptr_is_owned(o);
20572         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20573         o_conv = Ping_clone(&o_conv);
20574         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20575         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
20576         return tag_ptr(ret_conv, true);
20577 }
20578
20579 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
20580         void* e_ptr = untag_ptr(e);
20581         CHECK_ACCESS(e_ptr);
20582         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20583         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20584         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20585         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
20586         return tag_ptr(ret_conv, true);
20587 }
20588
20589 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
20590         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
20591         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
20592         return ret_conv;
20593 }
20594
20595 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
20596         if (!ptr_is_owned(_res)) return;
20597         void* _res_ptr = untag_ptr(_res);
20598         CHECK_ACCESS(_res_ptr);
20599         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
20600         FREE(untag_ptr(_res));
20601         CResult_PingDecodeErrorZ_free(_res_conv);
20602 }
20603
20604 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
20605         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20606         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
20607         return tag_ptr(ret_conv, true);
20608 }
20609 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
20610         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
20611         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
20612         return ret_conv;
20613 }
20614
20615 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
20616         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
20617         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20618         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
20619         return tag_ptr(ret_conv, true);
20620 }
20621
20622 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
20623         LDKPong o_conv;
20624         o_conv.inner = untag_ptr(o);
20625         o_conv.is_owned = ptr_is_owned(o);
20626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20627         o_conv = Pong_clone(&o_conv);
20628         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20629         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
20630         return tag_ptr(ret_conv, true);
20631 }
20632
20633 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
20634         void* e_ptr = untag_ptr(e);
20635         CHECK_ACCESS(e_ptr);
20636         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20637         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20638         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20639         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
20640         return tag_ptr(ret_conv, true);
20641 }
20642
20643 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
20644         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
20645         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
20646         return ret_conv;
20647 }
20648
20649 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
20650         if (!ptr_is_owned(_res)) return;
20651         void* _res_ptr = untag_ptr(_res);
20652         CHECK_ACCESS(_res_ptr);
20653         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
20654         FREE(untag_ptr(_res));
20655         CResult_PongDecodeErrorZ_free(_res_conv);
20656 }
20657
20658 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
20659         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20660         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
20661         return tag_ptr(ret_conv, true);
20662 }
20663 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
20664         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
20665         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
20666         return ret_conv;
20667 }
20668
20669 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
20670         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
20671         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20672         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20673         return tag_ptr(ret_conv, true);
20674 }
20675
20676 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20677         LDKUnsignedChannelAnnouncement o_conv;
20678         o_conv.inner = untag_ptr(o);
20679         o_conv.is_owned = ptr_is_owned(o);
20680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20681         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20682         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20683         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20684         return tag_ptr(ret_conv, true);
20685 }
20686
20687 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20688         void* e_ptr = untag_ptr(e);
20689         CHECK_ACCESS(e_ptr);
20690         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20691         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20692         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20693         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20694         return tag_ptr(ret_conv, true);
20695 }
20696
20697 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20698         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20699         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20700         return ret_conv;
20701 }
20702
20703 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20704         if (!ptr_is_owned(_res)) return;
20705         void* _res_ptr = untag_ptr(_res);
20706         CHECK_ACCESS(_res_ptr);
20707         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20708         FREE(untag_ptr(_res));
20709         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
20710 }
20711
20712 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20713         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20714         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
20715         return tag_ptr(ret_conv, true);
20716 }
20717 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20718         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20719         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20720         return ret_conv;
20721 }
20722
20723 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20724         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20725         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20726         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20727         return tag_ptr(ret_conv, true);
20728 }
20729
20730 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20731         LDKChannelAnnouncement o_conv;
20732         o_conv.inner = untag_ptr(o);
20733         o_conv.is_owned = ptr_is_owned(o);
20734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20735         o_conv = ChannelAnnouncement_clone(&o_conv);
20736         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20737         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
20738         return tag_ptr(ret_conv, true);
20739 }
20740
20741 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20742         void* e_ptr = untag_ptr(e);
20743         CHECK_ACCESS(e_ptr);
20744         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20745         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20746         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20747         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
20748         return tag_ptr(ret_conv, true);
20749 }
20750
20751 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20752         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20753         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20754         return ret_conv;
20755 }
20756
20757 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20758         if (!ptr_is_owned(_res)) return;
20759         void* _res_ptr = untag_ptr(_res);
20760         CHECK_ACCESS(_res_ptr);
20761         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20762         FREE(untag_ptr(_res));
20763         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
20764 }
20765
20766 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20767         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20768         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
20769         return tag_ptr(ret_conv, true);
20770 }
20771 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20772         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20773         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20774         return ret_conv;
20775 }
20776
20777 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20778         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20779         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20780         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20781         return tag_ptr(ret_conv, true);
20782 }
20783
20784 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20785         LDKUnsignedChannelUpdate o_conv;
20786         o_conv.inner = untag_ptr(o);
20787         o_conv.is_owned = ptr_is_owned(o);
20788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20789         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20790         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20791         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20792         return tag_ptr(ret_conv, true);
20793 }
20794
20795 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20796         void* e_ptr = untag_ptr(e);
20797         CHECK_ACCESS(e_ptr);
20798         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20799         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20800         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20801         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20802         return tag_ptr(ret_conv, true);
20803 }
20804
20805 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20806         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20807         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20808         return ret_conv;
20809 }
20810
20811 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20812         if (!ptr_is_owned(_res)) return;
20813         void* _res_ptr = untag_ptr(_res);
20814         CHECK_ACCESS(_res_ptr);
20815         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20816         FREE(untag_ptr(_res));
20817         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20818 }
20819
20820 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20821         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20822         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20823         return tag_ptr(ret_conv, true);
20824 }
20825 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20826         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20827         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20828         return ret_conv;
20829 }
20830
20831 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20832         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20833         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20834         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20835         return tag_ptr(ret_conv, true);
20836 }
20837
20838 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20839         LDKChannelUpdate o_conv;
20840         o_conv.inner = untag_ptr(o);
20841         o_conv.is_owned = ptr_is_owned(o);
20842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20843         o_conv = ChannelUpdate_clone(&o_conv);
20844         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20845         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20846         return tag_ptr(ret_conv, true);
20847 }
20848
20849 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20850         void* e_ptr = untag_ptr(e);
20851         CHECK_ACCESS(e_ptr);
20852         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20853         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20854         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20855         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20856         return tag_ptr(ret_conv, true);
20857 }
20858
20859 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20860         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20861         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20862         return ret_conv;
20863 }
20864
20865 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20866         if (!ptr_is_owned(_res)) return;
20867         void* _res_ptr = untag_ptr(_res);
20868         CHECK_ACCESS(_res_ptr);
20869         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20870         FREE(untag_ptr(_res));
20871         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20872 }
20873
20874 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20875         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20876         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20877         return tag_ptr(ret_conv, true);
20878 }
20879 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20880         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20881         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20882         return ret_conv;
20883 }
20884
20885 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20886         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20887         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20888         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20889         return tag_ptr(ret_conv, true);
20890 }
20891
20892 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20893         LDKErrorMessage o_conv;
20894         o_conv.inner = untag_ptr(o);
20895         o_conv.is_owned = ptr_is_owned(o);
20896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20897         o_conv = ErrorMessage_clone(&o_conv);
20898         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20899         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20900         return tag_ptr(ret_conv, true);
20901 }
20902
20903 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20904         void* e_ptr = untag_ptr(e);
20905         CHECK_ACCESS(e_ptr);
20906         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20907         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20908         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20909         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20910         return tag_ptr(ret_conv, true);
20911 }
20912
20913 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20914         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20915         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20916         return ret_conv;
20917 }
20918
20919 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20920         if (!ptr_is_owned(_res)) return;
20921         void* _res_ptr = untag_ptr(_res);
20922         CHECK_ACCESS(_res_ptr);
20923         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20924         FREE(untag_ptr(_res));
20925         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20926 }
20927
20928 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20929         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20930         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20931         return tag_ptr(ret_conv, true);
20932 }
20933 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20934         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20935         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20936         return ret_conv;
20937 }
20938
20939 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20940         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20941         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20942         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20943         return tag_ptr(ret_conv, true);
20944 }
20945
20946 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20947         LDKWarningMessage o_conv;
20948         o_conv.inner = untag_ptr(o);
20949         o_conv.is_owned = ptr_is_owned(o);
20950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20951         o_conv = WarningMessage_clone(&o_conv);
20952         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20953         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20954         return tag_ptr(ret_conv, true);
20955 }
20956
20957 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20958         void* e_ptr = untag_ptr(e);
20959         CHECK_ACCESS(e_ptr);
20960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20962         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20963         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20964         return tag_ptr(ret_conv, true);
20965 }
20966
20967 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20968         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20969         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20970         return ret_conv;
20971 }
20972
20973 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20974         if (!ptr_is_owned(_res)) return;
20975         void* _res_ptr = untag_ptr(_res);
20976         CHECK_ACCESS(_res_ptr);
20977         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20978         FREE(untag_ptr(_res));
20979         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20980 }
20981
20982 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20983         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20984         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20985         return tag_ptr(ret_conv, true);
20986 }
20987 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20988         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20989         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20990         return ret_conv;
20991 }
20992
20993 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20994         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20995         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20996         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20997         return tag_ptr(ret_conv, true);
20998 }
20999
21000 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21001         LDKUnsignedNodeAnnouncement o_conv;
21002         o_conv.inner = untag_ptr(o);
21003         o_conv.is_owned = ptr_is_owned(o);
21004         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21005         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21006         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21007         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21008         return tag_ptr(ret_conv, true);
21009 }
21010
21011 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21012         void* e_ptr = untag_ptr(e);
21013         CHECK_ACCESS(e_ptr);
21014         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21015         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21016         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21017         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21018         return tag_ptr(ret_conv, true);
21019 }
21020
21021 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21022         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21023         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21024         return ret_conv;
21025 }
21026
21027 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21028         if (!ptr_is_owned(_res)) return;
21029         void* _res_ptr = untag_ptr(_res);
21030         CHECK_ACCESS(_res_ptr);
21031         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21032         FREE(untag_ptr(_res));
21033         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21034 }
21035
21036 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21037         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21038         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21039         return tag_ptr(ret_conv, true);
21040 }
21041 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21042         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21043         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21044         return ret_conv;
21045 }
21046
21047 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21048         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21049         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21050         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21051         return tag_ptr(ret_conv, true);
21052 }
21053
21054 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21055         LDKNodeAnnouncement o_conv;
21056         o_conv.inner = untag_ptr(o);
21057         o_conv.is_owned = ptr_is_owned(o);
21058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21059         o_conv = NodeAnnouncement_clone(&o_conv);
21060         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21061         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21062         return tag_ptr(ret_conv, true);
21063 }
21064
21065 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21066         void* e_ptr = untag_ptr(e);
21067         CHECK_ACCESS(e_ptr);
21068         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21069         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21070         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21071         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21072         return tag_ptr(ret_conv, true);
21073 }
21074
21075 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21076         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21077         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21078         return ret_conv;
21079 }
21080
21081 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21082         if (!ptr_is_owned(_res)) return;
21083         void* _res_ptr = untag_ptr(_res);
21084         CHECK_ACCESS(_res_ptr);
21085         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21086         FREE(untag_ptr(_res));
21087         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21088 }
21089
21090 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21091         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21092         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21093         return tag_ptr(ret_conv, true);
21094 }
21095 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21096         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21097         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21098         return ret_conv;
21099 }
21100
21101 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21102         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21103         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21104         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21105         return tag_ptr(ret_conv, true);
21106 }
21107
21108 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21109         LDKQueryShortChannelIds o_conv;
21110         o_conv.inner = untag_ptr(o);
21111         o_conv.is_owned = ptr_is_owned(o);
21112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21113         o_conv = QueryShortChannelIds_clone(&o_conv);
21114         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21115         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21116         return tag_ptr(ret_conv, true);
21117 }
21118
21119 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21120         void* e_ptr = untag_ptr(e);
21121         CHECK_ACCESS(e_ptr);
21122         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21123         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21124         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21125         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21126         return tag_ptr(ret_conv, true);
21127 }
21128
21129 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21130         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21131         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21132         return ret_conv;
21133 }
21134
21135 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21136         if (!ptr_is_owned(_res)) return;
21137         void* _res_ptr = untag_ptr(_res);
21138         CHECK_ACCESS(_res_ptr);
21139         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21140         FREE(untag_ptr(_res));
21141         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21142 }
21143
21144 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21145         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21146         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21147         return tag_ptr(ret_conv, true);
21148 }
21149 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21150         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21151         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21152         return ret_conv;
21153 }
21154
21155 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21156         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21157         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21158         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21159         return tag_ptr(ret_conv, true);
21160 }
21161
21162 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21163         LDKReplyShortChannelIdsEnd o_conv;
21164         o_conv.inner = untag_ptr(o);
21165         o_conv.is_owned = ptr_is_owned(o);
21166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21167         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21168         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21169         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21170         return tag_ptr(ret_conv, true);
21171 }
21172
21173 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21174         void* e_ptr = untag_ptr(e);
21175         CHECK_ACCESS(e_ptr);
21176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21178         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21179         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21180         return tag_ptr(ret_conv, true);
21181 }
21182
21183 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21184         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21185         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21186         return ret_conv;
21187 }
21188
21189 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21190         if (!ptr_is_owned(_res)) return;
21191         void* _res_ptr = untag_ptr(_res);
21192         CHECK_ACCESS(_res_ptr);
21193         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21194         FREE(untag_ptr(_res));
21195         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21196 }
21197
21198 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21199         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21200         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21201         return tag_ptr(ret_conv, true);
21202 }
21203 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21204         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21205         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21206         return ret_conv;
21207 }
21208
21209 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21210         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21211         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21212         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21213         return tag_ptr(ret_conv, true);
21214 }
21215
21216 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21217         LDKQueryChannelRange o_conv;
21218         o_conv.inner = untag_ptr(o);
21219         o_conv.is_owned = ptr_is_owned(o);
21220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21221         o_conv = QueryChannelRange_clone(&o_conv);
21222         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21223         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21224         return tag_ptr(ret_conv, true);
21225 }
21226
21227 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21228         void* e_ptr = untag_ptr(e);
21229         CHECK_ACCESS(e_ptr);
21230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21232         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21233         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21234         return tag_ptr(ret_conv, true);
21235 }
21236
21237 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21238         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21239         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21240         return ret_conv;
21241 }
21242
21243 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21244         if (!ptr_is_owned(_res)) return;
21245         void* _res_ptr = untag_ptr(_res);
21246         CHECK_ACCESS(_res_ptr);
21247         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21248         FREE(untag_ptr(_res));
21249         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21250 }
21251
21252 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21253         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21254         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21255         return tag_ptr(ret_conv, true);
21256 }
21257 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21258         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21259         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21260         return ret_conv;
21261 }
21262
21263 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21264         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21265         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21266         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21267         return tag_ptr(ret_conv, true);
21268 }
21269
21270 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21271         LDKReplyChannelRange o_conv;
21272         o_conv.inner = untag_ptr(o);
21273         o_conv.is_owned = ptr_is_owned(o);
21274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21275         o_conv = ReplyChannelRange_clone(&o_conv);
21276         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21277         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21278         return tag_ptr(ret_conv, true);
21279 }
21280
21281 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21282         void* e_ptr = untag_ptr(e);
21283         CHECK_ACCESS(e_ptr);
21284         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21285         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21286         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21287         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21288         return tag_ptr(ret_conv, true);
21289 }
21290
21291 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21292         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21293         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21294         return ret_conv;
21295 }
21296
21297 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21298         if (!ptr_is_owned(_res)) return;
21299         void* _res_ptr = untag_ptr(_res);
21300         CHECK_ACCESS(_res_ptr);
21301         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21302         FREE(untag_ptr(_res));
21303         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21304 }
21305
21306 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21307         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21308         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21309         return tag_ptr(ret_conv, true);
21310 }
21311 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21312         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21313         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21314         return ret_conv;
21315 }
21316
21317 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21318         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21319         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21320         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21321         return tag_ptr(ret_conv, true);
21322 }
21323
21324 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21325         LDKGossipTimestampFilter o_conv;
21326         o_conv.inner = untag_ptr(o);
21327         o_conv.is_owned = ptr_is_owned(o);
21328         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21329         o_conv = GossipTimestampFilter_clone(&o_conv);
21330         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21331         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21332         return tag_ptr(ret_conv, true);
21333 }
21334
21335 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21336         void* e_ptr = untag_ptr(e);
21337         CHECK_ACCESS(e_ptr);
21338         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21339         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21340         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21341         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21342         return tag_ptr(ret_conv, true);
21343 }
21344
21345 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21346         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21347         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21348         return ret_conv;
21349 }
21350
21351 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21352         if (!ptr_is_owned(_res)) return;
21353         void* _res_ptr = untag_ptr(_res);
21354         CHECK_ACCESS(_res_ptr);
21355         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21356         FREE(untag_ptr(_res));
21357         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21358 }
21359
21360 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21361         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21362         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21363         return tag_ptr(ret_conv, true);
21364 }
21365 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21366         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21367         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21368         return ret_conv;
21369 }
21370
21371 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21372         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21373         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21374         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21375         return tag_ptr(ret_conv, true);
21376 }
21377
21378 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
21379         LDKInvoice o_conv;
21380         o_conv.inner = untag_ptr(o);
21381         o_conv.is_owned = ptr_is_owned(o);
21382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21383         o_conv = Invoice_clone(&o_conv);
21384         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21385         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
21386         return tag_ptr(ret_conv, true);
21387 }
21388
21389 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
21390         void* e_ptr = untag_ptr(e);
21391         CHECK_ACCESS(e_ptr);
21392         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
21393         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
21394         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21395         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
21396         return tag_ptr(ret_conv, true);
21397 }
21398
21399 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
21400         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
21401         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
21402         return ret_conv;
21403 }
21404
21405 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
21406         if (!ptr_is_owned(_res)) return;
21407         void* _res_ptr = untag_ptr(_res);
21408         CHECK_ACCESS(_res_ptr);
21409         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
21410         FREE(untag_ptr(_res));
21411         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
21412 }
21413
21414 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
21415         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21416         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
21417         return tag_ptr(ret_conv, true);
21418 }
21419 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
21420         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
21421         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
21422         return ret_conv;
21423 }
21424
21425 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
21426         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
21427         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21428         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
21429         return tag_ptr(ret_conv, true);
21430 }
21431
21432 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21433         void* o_ptr = untag_ptr(o);
21434         CHECK_ACCESS(o_ptr);
21435         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21436         if (o_conv.free == LDKFilter_JCalls_free) {
21437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21438                 LDKFilter_JCalls_cloned(&o_conv);
21439         }
21440         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21441         *ret_copy = COption_FilterZ_some(o_conv);
21442         uint64_t ret_ref = tag_ptr(ret_copy, true);
21443         return ret_ref;
21444 }
21445
21446 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21447         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21448         *ret_copy = COption_FilterZ_none();
21449         uint64_t ret_ref = tag_ptr(ret_copy, true);
21450         return ret_ref;
21451 }
21452
21453 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21454         if (!ptr_is_owned(_res)) return;
21455         void* _res_ptr = untag_ptr(_res);
21456         CHECK_ACCESS(_res_ptr);
21457         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21458         FREE(untag_ptr(_res));
21459         COption_FilterZ_free(_res_conv);
21460 }
21461
21462 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21463         LDKLockedChannelMonitor o_conv;
21464         o_conv.inner = untag_ptr(o);
21465         o_conv.is_owned = ptr_is_owned(o);
21466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21467         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21468         
21469         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21470         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21471         return tag_ptr(ret_conv, true);
21472 }
21473
21474 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21475         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21476         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21477         return tag_ptr(ret_conv, true);
21478 }
21479
21480 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21481         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21482         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21483         return ret_conv;
21484 }
21485
21486 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21487         if (!ptr_is_owned(_res)) return;
21488         void* _res_ptr = untag_ptr(_res);
21489         CHECK_ACCESS(_res_ptr);
21490         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21491         FREE(untag_ptr(_res));
21492         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21493 }
21494
21495 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21496         LDKCVec_OutPointZ _res_constr;
21497         _res_constr.datalen = _res->arr_len;
21498         if (_res_constr.datalen > 0)
21499                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21500         else
21501                 _res_constr.data = NULL;
21502         uint64_t* _res_vals = _res->elems;
21503         for (size_t k = 0; k < _res_constr.datalen; k++) {
21504                 uint64_t _res_conv_10 = _res_vals[k];
21505                 LDKOutPoint _res_conv_10_conv;
21506                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21507                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21508                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21509                 _res_constr.data[k] = _res_conv_10_conv;
21510         }
21511         FREE(_res);
21512         CVec_OutPointZ_free(_res_constr);
21513 }
21514
21515 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21516         LDKCVec_MonitorUpdateIdZ _res_constr;
21517         _res_constr.datalen = _res->arr_len;
21518         if (_res_constr.datalen > 0)
21519                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21520         else
21521                 _res_constr.data = NULL;
21522         uint64_t* _res_vals = _res->elems;
21523         for (size_t r = 0; r < _res_constr.datalen; r++) {
21524                 uint64_t _res_conv_17 = _res_vals[r];
21525                 LDKMonitorUpdateId _res_conv_17_conv;
21526                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21527                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21528                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21529                 _res_constr.data[r] = _res_conv_17_conv;
21530         }
21531         FREE(_res);
21532         CVec_MonitorUpdateIdZ_free(_res_constr);
21533 }
21534
21535 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
21536         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21537         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
21538         return tag_ptr(ret_conv, true);
21539 }
21540 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
21541         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
21542         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
21543         return ret_conv;
21544 }
21545
21546 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
21547         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
21548         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21549         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
21550         return tag_ptr(ret_conv, true);
21551 }
21552
21553 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
21554         LDKOutPoint a_conv;
21555         a_conv.inner = untag_ptr(a);
21556         a_conv.is_owned = ptr_is_owned(a);
21557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21558         a_conv = OutPoint_clone(&a_conv);
21559         LDKCVec_MonitorUpdateIdZ b_constr;
21560         b_constr.datalen = b->arr_len;
21561         if (b_constr.datalen > 0)
21562                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21563         else
21564                 b_constr.data = NULL;
21565         uint64_t* b_vals = b->elems;
21566         for (size_t r = 0; r < b_constr.datalen; r++) {
21567                 uint64_t b_conv_17 = b_vals[r];
21568                 LDKMonitorUpdateId b_conv_17_conv;
21569                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
21570                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
21571                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
21572                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
21573                 b_constr.data[r] = b_conv_17_conv;
21574         }
21575         FREE(b);
21576         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21577         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
21578         return tag_ptr(ret_conv, true);
21579 }
21580
21581 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
21582         if (!ptr_is_owned(_res)) return;
21583         void* _res_ptr = untag_ptr(_res);
21584         CHECK_ACCESS(_res_ptr);
21585         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
21586         FREE(untag_ptr(_res));
21587         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
21588 }
21589
21590 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
21591         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
21592         _res_constr.datalen = _res->arr_len;
21593         if (_res_constr.datalen > 0)
21594                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
21595         else
21596                 _res_constr.data = NULL;
21597         uint64_t* _res_vals = _res->elems;
21598         for (size_t p = 0; p < _res_constr.datalen; p++) {
21599                 uint64_t _res_conv_41 = _res_vals[p];
21600                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
21601                 CHECK_ACCESS(_res_conv_41_ptr);
21602                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
21603                 FREE(untag_ptr(_res_conv_41));
21604                 _res_constr.data[p] = _res_conv_41_conv;
21605         }
21606         FREE(_res);
21607         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
21608 }
21609
21610 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
21611         if (!ptr_is_owned(this_ptr)) return;
21612         void* this_ptr_ptr = untag_ptr(this_ptr);
21613         CHECK_ACCESS(this_ptr_ptr);
21614         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
21615         FREE(untag_ptr(this_ptr));
21616         PaymentPurpose_free(this_ptr_conv);
21617 }
21618
21619 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
21620         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21621         *ret_copy = PaymentPurpose_clone(arg);
21622         uint64_t ret_ref = tag_ptr(ret_copy, true);
21623         return ret_ref;
21624 }
21625 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
21626         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
21627         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
21628         return ret_conv;
21629 }
21630
21631 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
21632         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
21633         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21634         *ret_copy = PaymentPurpose_clone(orig_conv);
21635         uint64_t ret_ref = tag_ptr(ret_copy, true);
21636         return ret_ref;
21637 }
21638
21639 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
21640         LDKThirtyTwoBytes payment_preimage_ref;
21641         CHECK(payment_preimage->arr_len == 32);
21642         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21643         LDKThirtyTwoBytes payment_secret_ref;
21644         CHECK(payment_secret->arr_len == 32);
21645         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
21646         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21647         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
21648         uint64_t ret_ref = tag_ptr(ret_copy, true);
21649         return ret_ref;
21650 }
21651
21652 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
21653         LDKThirtyTwoBytes a_ref;
21654         CHECK(a->arr_len == 32);
21655         memcpy(a_ref.data, a->elems, 32); FREE(a);
21656         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21657         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
21658         uint64_t ret_ref = tag_ptr(ret_copy, true);
21659         return ret_ref;
21660 }
21661
21662 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
21663         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
21664         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
21665         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21666         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21667         CVec_u8Z_free(ret_var);
21668         return ret_arr;
21669 }
21670
21671 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
21672         LDKu8slice ser_ref;
21673         ser_ref.datalen = ser->arr_len;
21674         ser_ref.data = ser->elems;
21675         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
21676         *ret_conv = PaymentPurpose_read(ser_ref);
21677         FREE(ser);
21678         return tag_ptr(ret_conv, true);
21679 }
21680
21681 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
21682         if (!ptr_is_owned(this_ptr)) return;
21683         void* this_ptr_ptr = untag_ptr(this_ptr);
21684         CHECK_ACCESS(this_ptr_ptr);
21685         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
21686         FREE(untag_ptr(this_ptr));
21687         ClosureReason_free(this_ptr_conv);
21688 }
21689
21690 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
21691         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21692         *ret_copy = ClosureReason_clone(arg);
21693         uint64_t ret_ref = tag_ptr(ret_copy, true);
21694         return ret_ref;
21695 }
21696 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
21697         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
21698         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
21699         return ret_conv;
21700 }
21701
21702 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
21703         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
21704         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21705         *ret_copy = ClosureReason_clone(orig_conv);
21706         uint64_t ret_ref = tag_ptr(ret_copy, true);
21707         return ret_ref;
21708 }
21709
21710 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
21711         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
21712         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21713         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
21714         uint64_t ret_ref = tag_ptr(ret_copy, true);
21715         return ret_ref;
21716 }
21717
21718 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
21719         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21720         *ret_copy = ClosureReason_holder_force_closed();
21721         uint64_t ret_ref = tag_ptr(ret_copy, true);
21722         return ret_ref;
21723 }
21724
21725 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
21726         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21727         *ret_copy = ClosureReason_cooperative_closure();
21728         uint64_t ret_ref = tag_ptr(ret_copy, true);
21729         return ret_ref;
21730 }
21731
21732 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
21733         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21734         *ret_copy = ClosureReason_commitment_tx_confirmed();
21735         uint64_t ret_ref = tag_ptr(ret_copy, true);
21736         return ret_ref;
21737 }
21738
21739 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
21740         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21741         *ret_copy = ClosureReason_funding_timed_out();
21742         uint64_t ret_ref = tag_ptr(ret_copy, true);
21743         return ret_ref;
21744 }
21745
21746 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
21747         LDKStr err_conv = str_ref_to_owned_c(err);
21748         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21749         *ret_copy = ClosureReason_processing_error(err_conv);
21750         uint64_t ret_ref = tag_ptr(ret_copy, true);
21751         return ret_ref;
21752 }
21753
21754 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
21755         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21756         *ret_copy = ClosureReason_disconnected_peer();
21757         uint64_t ret_ref = tag_ptr(ret_copy, true);
21758         return ret_ref;
21759 }
21760
21761 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
21762         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21763         *ret_copy = ClosureReason_outdated_channel_manager();
21764         uint64_t ret_ref = tag_ptr(ret_copy, true);
21765         return ret_ref;
21766 }
21767
21768 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
21769         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
21770         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
21771         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
21772         return ret_conv;
21773 }
21774
21775 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
21776         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
21777         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
21778         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21779         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21780         CVec_u8Z_free(ret_var);
21781         return ret_arr;
21782 }
21783
21784 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
21785         LDKu8slice ser_ref;
21786         ser_ref.datalen = ser->arr_len;
21787         ser_ref.data = ser->elems;
21788         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
21789         *ret_conv = ClosureReason_read(ser_ref);
21790         FREE(ser);
21791         return tag_ptr(ret_conv, true);
21792 }
21793
21794 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
21795         if (!ptr_is_owned(this_ptr)) return;
21796         void* this_ptr_ptr = untag_ptr(this_ptr);
21797         CHECK_ACCESS(this_ptr_ptr);
21798         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
21799         FREE(untag_ptr(this_ptr));
21800         HTLCDestination_free(this_ptr_conv);
21801 }
21802
21803 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
21804         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21805         *ret_copy = HTLCDestination_clone(arg);
21806         uint64_t ret_ref = tag_ptr(ret_copy, true);
21807         return ret_ref;
21808 }
21809 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
21810         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
21811         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
21812         return ret_conv;
21813 }
21814
21815 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
21816         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
21817         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21818         *ret_copy = HTLCDestination_clone(orig_conv);
21819         uint64_t ret_ref = tag_ptr(ret_copy, true);
21820         return ret_ref;
21821 }
21822
21823 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
21824         LDKPublicKey node_id_ref;
21825         CHECK(node_id->arr_len == 33);
21826         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21827         LDKThirtyTwoBytes channel_id_ref;
21828         CHECK(channel_id->arr_len == 32);
21829         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21830         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21831         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
21832         uint64_t ret_ref = tag_ptr(ret_copy, true);
21833         return ret_ref;
21834 }
21835
21836 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
21837         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21838         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
21839         uint64_t ret_ref = tag_ptr(ret_copy, true);
21840         return ret_ref;
21841 }
21842
21843 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
21844         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21845         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
21846         uint64_t ret_ref = tag_ptr(ret_copy, true);
21847         return ret_ref;
21848 }
21849
21850 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
21851         LDKThirtyTwoBytes payment_hash_ref;
21852         CHECK(payment_hash->arr_len == 32);
21853         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21854         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21855         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
21856         uint64_t ret_ref = tag_ptr(ret_copy, true);
21857         return ret_ref;
21858 }
21859
21860 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
21861         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
21862         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
21863         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
21864         return ret_conv;
21865 }
21866
21867 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
21868         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
21869         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
21870         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21871         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21872         CVec_u8Z_free(ret_var);
21873         return ret_arr;
21874 }
21875
21876 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21877         LDKu8slice ser_ref;
21878         ser_ref.datalen = ser->arr_len;
21879         ser_ref.data = ser->elems;
21880         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21881         *ret_conv = HTLCDestination_read(ser_ref);
21882         FREE(ser);
21883         return tag_ptr(ret_conv, true);
21884 }
21885
21886 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21887         if (!ptr_is_owned(this_ptr)) return;
21888         void* this_ptr_ptr = untag_ptr(this_ptr);
21889         CHECK_ACCESS(this_ptr_ptr);
21890         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21891         FREE(untag_ptr(this_ptr));
21892         Event_free(this_ptr_conv);
21893 }
21894
21895 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21896         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21897         *ret_copy = Event_clone(arg);
21898         uint64_t ret_ref = tag_ptr(ret_copy, true);
21899         return ret_ref;
21900 }
21901 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21902         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21903         int64_t ret_conv = Event_clone_ptr(arg_conv);
21904         return ret_conv;
21905 }
21906
21907 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21908         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21909         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21910         *ret_copy = Event_clone(orig_conv);
21911         uint64_t ret_ref = tag_ptr(ret_copy, true);
21912         return ret_ref;
21913 }
21914
21915 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, int8_tArray user_channel_id) {
21916         LDKThirtyTwoBytes temporary_channel_id_ref;
21917         CHECK(temporary_channel_id->arr_len == 32);
21918         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21919         LDKPublicKey counterparty_node_id_ref;
21920         CHECK(counterparty_node_id->arr_len == 33);
21921         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21922         LDKCVec_u8Z output_script_ref;
21923         output_script_ref.datalen = output_script->arr_len;
21924         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21925         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21926         LDKU128 user_channel_id_ref;
21927         CHECK(user_channel_id->arr_len == 16);
21928         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
21929         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21930         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
21931         uint64_t ret_ref = tag_ptr(ret_copy, true);
21932         return ret_ref;
21933 }
21934
21935 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id) {
21936         LDKPublicKey receiver_node_id_ref;
21937         CHECK(receiver_node_id->arr_len == 33);
21938         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
21939         LDKThirtyTwoBytes payment_hash_ref;
21940         CHECK(payment_hash->arr_len == 32);
21941         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21942         void* purpose_ptr = untag_ptr(purpose);
21943         CHECK_ACCESS(purpose_ptr);
21944         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21945         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21946         LDKThirtyTwoBytes via_channel_id_ref;
21947         CHECK(via_channel_id->arr_len == 32);
21948         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
21949         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
21950         CHECK_ACCESS(via_user_channel_id_ptr);
21951         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
21952         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
21953         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21954         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv);
21955         uint64_t ret_ref = tag_ptr(ret_copy, true);
21956         return ret_ref;
21957 }
21958
21959 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21960         LDKPublicKey receiver_node_id_ref;
21961         CHECK(receiver_node_id->arr_len == 33);
21962         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
21963         LDKThirtyTwoBytes payment_hash_ref;
21964         CHECK(payment_hash->arr_len == 32);
21965         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21966         void* purpose_ptr = untag_ptr(purpose);
21967         CHECK_ACCESS(purpose_ptr);
21968         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21969         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21970         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21971         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
21972         uint64_t ret_ref = tag_ptr(ret_copy, true);
21973         return ret_ref;
21974 }
21975
21976 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) {
21977         LDKThirtyTwoBytes payment_id_ref;
21978         CHECK(payment_id->arr_len == 32);
21979         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21980         LDKThirtyTwoBytes payment_preimage_ref;
21981         CHECK(payment_preimage->arr_len == 32);
21982         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21983         LDKThirtyTwoBytes payment_hash_ref;
21984         CHECK(payment_hash->arr_len == 32);
21985         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21986         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21987         CHECK_ACCESS(fee_paid_msat_ptr);
21988         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21989         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21990         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21991         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21992         uint64_t ret_ref = tag_ptr(ret_copy, true);
21993         return ret_ref;
21994 }
21995
21996 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21997         LDKThirtyTwoBytes payment_id_ref;
21998         CHECK(payment_id->arr_len == 32);
21999         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22000         LDKThirtyTwoBytes payment_hash_ref;
22001         CHECK(payment_hash->arr_len == 32);
22002         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22003         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22004         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
22005         uint64_t ret_ref = tag_ptr(ret_copy, true);
22006         return ret_ref;
22007 }
22008
22009 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) {
22010         LDKThirtyTwoBytes payment_id_ref;
22011         CHECK(payment_id->arr_len == 32);
22012         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22013         LDKThirtyTwoBytes payment_hash_ref;
22014         CHECK(payment_hash->arr_len == 32);
22015         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22016         LDKCVec_RouteHopZ path_constr;
22017         path_constr.datalen = path->arr_len;
22018         if (path_constr.datalen > 0)
22019                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22020         else
22021                 path_constr.data = NULL;
22022         uint64_t* path_vals = path->elems;
22023         for (size_t k = 0; k < path_constr.datalen; k++) {
22024                 uint64_t path_conv_10 = path_vals[k];
22025                 LDKRouteHop path_conv_10_conv;
22026                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22027                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22028                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22029                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22030                 path_constr.data[k] = path_conv_10_conv;
22031         }
22032         FREE(path);
22033         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22034         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
22035         uint64_t ret_ref = tag_ptr(ret_copy, true);
22036         return ret_ref;
22037 }
22038
22039 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) {
22040         LDKThirtyTwoBytes payment_id_ref;
22041         CHECK(payment_id->arr_len == 32);
22042         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22043         LDKThirtyTwoBytes payment_hash_ref;
22044         CHECK(payment_hash->arr_len == 32);
22045         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22046         void* network_update_ptr = untag_ptr(network_update);
22047         CHECK_ACCESS(network_update_ptr);
22048         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22049         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
22050         LDKCVec_RouteHopZ path_constr;
22051         path_constr.datalen = path->arr_len;
22052         if (path_constr.datalen > 0)
22053                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22054         else
22055                 path_constr.data = NULL;
22056         uint64_t* path_vals = path->elems;
22057         for (size_t k = 0; k < path_constr.datalen; k++) {
22058                 uint64_t path_conv_10 = path_vals[k];
22059                 LDKRouteHop path_conv_10_conv;
22060                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22061                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22063                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22064                 path_constr.data[k] = path_conv_10_conv;
22065         }
22066         FREE(path);
22067         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22068         CHECK_ACCESS(short_channel_id_ptr);
22069         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22070         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22071         LDKRouteParameters retry_conv;
22072         retry_conv.inner = untag_ptr(retry);
22073         retry_conv.is_owned = ptr_is_owned(retry);
22074         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22075         retry_conv = RouteParameters_clone(&retry_conv);
22076         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22077         *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);
22078         uint64_t ret_ref = tag_ptr(ret_copy, true);
22079         return ret_ref;
22080 }
22081
22082 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
22083         LDKThirtyTwoBytes payment_id_ref;
22084         CHECK(payment_id->arr_len == 32);
22085         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22086         LDKThirtyTwoBytes payment_hash_ref;
22087         CHECK(payment_hash->arr_len == 32);
22088         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22089         LDKCVec_RouteHopZ path_constr;
22090         path_constr.datalen = path->arr_len;
22091         if (path_constr.datalen > 0)
22092                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22093         else
22094                 path_constr.data = NULL;
22095         uint64_t* path_vals = path->elems;
22096         for (size_t k = 0; k < path_constr.datalen; k++) {
22097                 uint64_t path_conv_10 = path_vals[k];
22098                 LDKRouteHop path_conv_10_conv;
22099                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22100                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22101                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22102                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22103                 path_constr.data[k] = path_conv_10_conv;
22104         }
22105         FREE(path);
22106         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22107         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
22108         uint64_t ret_ref = tag_ptr(ret_copy, true);
22109         return ret_ref;
22110 }
22111
22112 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) {
22113         LDKThirtyTwoBytes payment_id_ref;
22114         CHECK(payment_id->arr_len == 32);
22115         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22116         LDKThirtyTwoBytes payment_hash_ref;
22117         CHECK(payment_hash->arr_len == 32);
22118         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22119         LDKCVec_RouteHopZ path_constr;
22120         path_constr.datalen = path->arr_len;
22121         if (path_constr.datalen > 0)
22122                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22123         else
22124                 path_constr.data = NULL;
22125         uint64_t* path_vals = path->elems;
22126         for (size_t k = 0; k < path_constr.datalen; k++) {
22127                 uint64_t path_conv_10 = path_vals[k];
22128                 LDKRouteHop path_conv_10_conv;
22129                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22130                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22131                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22132                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22133                 path_constr.data[k] = path_conv_10_conv;
22134         }
22135         FREE(path);
22136         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22137         CHECK_ACCESS(short_channel_id_ptr);
22138         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22139         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22140         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22141         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
22142         uint64_t ret_ref = tag_ptr(ret_copy, true);
22143         return ret_ref;
22144 }
22145
22146 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
22147         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22148         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
22149         uint64_t ret_ref = tag_ptr(ret_copy, true);
22150         return ret_ref;
22151 }
22152
22153 uint64_t  __attribute__((export_name("TS_Event_htlcintercepted"))) TS_Event_htlcintercepted(int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
22154         LDKThirtyTwoBytes intercept_id_ref;
22155         CHECK(intercept_id->arr_len == 32);
22156         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
22157         LDKThirtyTwoBytes payment_hash_ref;
22158         CHECK(payment_hash->arr_len == 32);
22159         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22160         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22161         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
22162         uint64_t ret_ref = tag_ptr(ret_copy, true);
22163         return ret_ref;
22164 }
22165
22166 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
22167         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
22168         outputs_constr.datalen = outputs->arr_len;
22169         if (outputs_constr.datalen > 0)
22170                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22171         else
22172                 outputs_constr.data = NULL;
22173         uint64_t* outputs_vals = outputs->elems;
22174         for (size_t b = 0; b < outputs_constr.datalen; b++) {
22175                 uint64_t outputs_conv_27 = outputs_vals[b];
22176                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
22177                 CHECK_ACCESS(outputs_conv_27_ptr);
22178                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
22179                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
22180                 outputs_constr.data[b] = outputs_conv_27_conv;
22181         }
22182         FREE(outputs);
22183         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22184         *ret_copy = Event_spendable_outputs(outputs_constr);
22185         uint64_t ret_ref = tag_ptr(ret_copy, true);
22186         return ret_ref;
22187 }
22188
22189 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) {
22190         LDKThirtyTwoBytes prev_channel_id_ref;
22191         CHECK(prev_channel_id->arr_len == 32);
22192         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22193         LDKThirtyTwoBytes next_channel_id_ref;
22194         CHECK(next_channel_id->arr_len == 32);
22195         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
22196         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
22197         CHECK_ACCESS(fee_earned_msat_ptr);
22198         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
22199         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
22200         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22201         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
22202         uint64_t ret_ref = tag_ptr(ret_copy, true);
22203         return ret_ref;
22204 }
22205
22206 uint64_t  __attribute__((export_name("TS_Event_channel_ready"))) TS_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, uint64_t channel_type) {
22207         LDKThirtyTwoBytes channel_id_ref;
22208         CHECK(channel_id->arr_len == 32);
22209         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22210         LDKU128 user_channel_id_ref;
22211         CHECK(user_channel_id->arr_len == 16);
22212         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22213         LDKPublicKey counterparty_node_id_ref;
22214         CHECK(counterparty_node_id->arr_len == 33);
22215         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22216         LDKChannelTypeFeatures channel_type_conv;
22217         channel_type_conv.inner = untag_ptr(channel_type);
22218         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22219         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22220         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22221         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22222         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
22223         uint64_t ret_ref = tag_ptr(ret_copy, true);
22224         return ret_ref;
22225 }
22226
22227 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason) {
22228         LDKThirtyTwoBytes channel_id_ref;
22229         CHECK(channel_id->arr_len == 32);
22230         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22231         LDKU128 user_channel_id_ref;
22232         CHECK(user_channel_id->arr_len == 16);
22233         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22234         void* reason_ptr = untag_ptr(reason);
22235         CHECK_ACCESS(reason_ptr);
22236         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
22237         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
22238         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22239         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
22240         uint64_t ret_ref = tag_ptr(ret_copy, true);
22241         return ret_ref;
22242 }
22243
22244 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
22245         LDKThirtyTwoBytes channel_id_ref;
22246         CHECK(channel_id->arr_len == 32);
22247         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22248         LDKTransaction transaction_ref;
22249         transaction_ref.datalen = transaction->arr_len;
22250         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
22251         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
22252         transaction_ref.data_is_owned = true;
22253         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22254         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
22255         uint64_t ret_ref = tag_ptr(ret_copy, true);
22256         return ret_ref;
22257 }
22258
22259 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) {
22260         LDKThirtyTwoBytes temporary_channel_id_ref;
22261         CHECK(temporary_channel_id->arr_len == 32);
22262         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22263         LDKPublicKey counterparty_node_id_ref;
22264         CHECK(counterparty_node_id->arr_len == 33);
22265         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22266         LDKChannelTypeFeatures channel_type_conv;
22267         channel_type_conv.inner = untag_ptr(channel_type);
22268         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22269         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22270         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22271         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22272         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
22273         uint64_t ret_ref = tag_ptr(ret_copy, true);
22274         return ret_ref;
22275 }
22276
22277 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
22278         LDKThirtyTwoBytes prev_channel_id_ref;
22279         CHECK(prev_channel_id->arr_len == 32);
22280         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22281         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
22282         CHECK_ACCESS(failed_next_destination_ptr);
22283         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
22284         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
22285         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22286         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
22287         uint64_t ret_ref = tag_ptr(ret_copy, true);
22288         return ret_ref;
22289 }
22290
22291 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
22292         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
22293         LDKCVec_u8Z ret_var = Event_write(obj_conv);
22294         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22295         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22296         CVec_u8Z_free(ret_var);
22297         return ret_arr;
22298 }
22299
22300 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
22301         LDKu8slice ser_ref;
22302         ser_ref.datalen = ser->arr_len;
22303         ser_ref.data = ser->elems;
22304         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
22305         *ret_conv = Event_read(ser_ref);
22306         FREE(ser);
22307         return tag_ptr(ret_conv, true);
22308 }
22309
22310 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
22311         if (!ptr_is_owned(this_ptr)) return;
22312         void* this_ptr_ptr = untag_ptr(this_ptr);
22313         CHECK_ACCESS(this_ptr_ptr);
22314         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
22315         FREE(untag_ptr(this_ptr));
22316         MessageSendEvent_free(this_ptr_conv);
22317 }
22318
22319 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
22320         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22321         *ret_copy = MessageSendEvent_clone(arg);
22322         uint64_t ret_ref = tag_ptr(ret_copy, true);
22323         return ret_ref;
22324 }
22325 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
22326         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
22327         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
22328         return ret_conv;
22329 }
22330
22331 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
22332         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
22333         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22334         *ret_copy = MessageSendEvent_clone(orig_conv);
22335         uint64_t ret_ref = tag_ptr(ret_copy, true);
22336         return ret_ref;
22337 }
22338
22339 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
22340         LDKPublicKey node_id_ref;
22341         CHECK(node_id->arr_len == 33);
22342         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22343         LDKAcceptChannel msg_conv;
22344         msg_conv.inner = untag_ptr(msg);
22345         msg_conv.is_owned = ptr_is_owned(msg);
22346         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22347         msg_conv = AcceptChannel_clone(&msg_conv);
22348         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22349         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
22350         uint64_t ret_ref = tag_ptr(ret_copy, true);
22351         return ret_ref;
22352 }
22353
22354 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
22355         LDKPublicKey node_id_ref;
22356         CHECK(node_id->arr_len == 33);
22357         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22358         LDKOpenChannel msg_conv;
22359         msg_conv.inner = untag_ptr(msg);
22360         msg_conv.is_owned = ptr_is_owned(msg);
22361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22362         msg_conv = OpenChannel_clone(&msg_conv);
22363         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22364         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
22365         uint64_t ret_ref = tag_ptr(ret_copy, true);
22366         return ret_ref;
22367 }
22368
22369 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
22370         LDKPublicKey node_id_ref;
22371         CHECK(node_id->arr_len == 33);
22372         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22373         LDKFundingCreated msg_conv;
22374         msg_conv.inner = untag_ptr(msg);
22375         msg_conv.is_owned = ptr_is_owned(msg);
22376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22377         msg_conv = FundingCreated_clone(&msg_conv);
22378         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22379         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
22380         uint64_t ret_ref = tag_ptr(ret_copy, true);
22381         return ret_ref;
22382 }
22383
22384 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
22385         LDKPublicKey node_id_ref;
22386         CHECK(node_id->arr_len == 33);
22387         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22388         LDKFundingSigned msg_conv;
22389         msg_conv.inner = untag_ptr(msg);
22390         msg_conv.is_owned = ptr_is_owned(msg);
22391         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22392         msg_conv = FundingSigned_clone(&msg_conv);
22393         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22394         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
22395         uint64_t ret_ref = tag_ptr(ret_copy, true);
22396         return ret_ref;
22397 }
22398
22399 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
22400         LDKPublicKey node_id_ref;
22401         CHECK(node_id->arr_len == 33);
22402         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22403         LDKChannelReady msg_conv;
22404         msg_conv.inner = untag_ptr(msg);
22405         msg_conv.is_owned = ptr_is_owned(msg);
22406         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22407         msg_conv = ChannelReady_clone(&msg_conv);
22408         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22409         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
22410         uint64_t ret_ref = tag_ptr(ret_copy, true);
22411         return ret_ref;
22412 }
22413
22414 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
22415         LDKPublicKey node_id_ref;
22416         CHECK(node_id->arr_len == 33);
22417         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22418         LDKAnnouncementSignatures msg_conv;
22419         msg_conv.inner = untag_ptr(msg);
22420         msg_conv.is_owned = ptr_is_owned(msg);
22421         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22422         msg_conv = AnnouncementSignatures_clone(&msg_conv);
22423         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22424         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
22425         uint64_t ret_ref = tag_ptr(ret_copy, true);
22426         return ret_ref;
22427 }
22428
22429 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
22430         LDKPublicKey node_id_ref;
22431         CHECK(node_id->arr_len == 33);
22432         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22433         LDKCommitmentUpdate updates_conv;
22434         updates_conv.inner = untag_ptr(updates);
22435         updates_conv.is_owned = ptr_is_owned(updates);
22436         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22437         updates_conv = CommitmentUpdate_clone(&updates_conv);
22438         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22439         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
22440         uint64_t ret_ref = tag_ptr(ret_copy, true);
22441         return ret_ref;
22442 }
22443
22444 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
22445         LDKPublicKey node_id_ref;
22446         CHECK(node_id->arr_len == 33);
22447         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22448         LDKRevokeAndACK msg_conv;
22449         msg_conv.inner = untag_ptr(msg);
22450         msg_conv.is_owned = ptr_is_owned(msg);
22451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22452         msg_conv = RevokeAndACK_clone(&msg_conv);
22453         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22454         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
22455         uint64_t ret_ref = tag_ptr(ret_copy, true);
22456         return ret_ref;
22457 }
22458
22459 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
22460         LDKPublicKey node_id_ref;
22461         CHECK(node_id->arr_len == 33);
22462         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22463         LDKClosingSigned msg_conv;
22464         msg_conv.inner = untag_ptr(msg);
22465         msg_conv.is_owned = ptr_is_owned(msg);
22466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22467         msg_conv = ClosingSigned_clone(&msg_conv);
22468         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22469         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
22470         uint64_t ret_ref = tag_ptr(ret_copy, true);
22471         return ret_ref;
22472 }
22473
22474 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
22475         LDKPublicKey node_id_ref;
22476         CHECK(node_id->arr_len == 33);
22477         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22478         LDKShutdown msg_conv;
22479         msg_conv.inner = untag_ptr(msg);
22480         msg_conv.is_owned = ptr_is_owned(msg);
22481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22482         msg_conv = Shutdown_clone(&msg_conv);
22483         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22484         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
22485         uint64_t ret_ref = tag_ptr(ret_copy, true);
22486         return ret_ref;
22487 }
22488
22489 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
22490         LDKPublicKey node_id_ref;
22491         CHECK(node_id->arr_len == 33);
22492         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22493         LDKChannelReestablish msg_conv;
22494         msg_conv.inner = untag_ptr(msg);
22495         msg_conv.is_owned = ptr_is_owned(msg);
22496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22497         msg_conv = ChannelReestablish_clone(&msg_conv);
22498         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22499         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
22500         uint64_t ret_ref = tag_ptr(ret_copy, true);
22501         return ret_ref;
22502 }
22503
22504 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) {
22505         LDKPublicKey node_id_ref;
22506         CHECK(node_id->arr_len == 33);
22507         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22508         LDKChannelAnnouncement msg_conv;
22509         msg_conv.inner = untag_ptr(msg);
22510         msg_conv.is_owned = ptr_is_owned(msg);
22511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22512         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22513         LDKChannelUpdate update_msg_conv;
22514         update_msg_conv.inner = untag_ptr(update_msg);
22515         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22516         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22517         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22518         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22519         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
22520         uint64_t ret_ref = tag_ptr(ret_copy, true);
22521         return ret_ref;
22522 }
22523
22524 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
22525         LDKChannelAnnouncement msg_conv;
22526         msg_conv.inner = untag_ptr(msg);
22527         msg_conv.is_owned = ptr_is_owned(msg);
22528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22529         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22530         LDKChannelUpdate update_msg_conv;
22531         update_msg_conv.inner = untag_ptr(update_msg);
22532         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22533         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22534         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22535         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22536         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
22537         uint64_t ret_ref = tag_ptr(ret_copy, true);
22538         return ret_ref;
22539 }
22540
22541 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
22542         LDKChannelUpdate msg_conv;
22543         msg_conv.inner = untag_ptr(msg);
22544         msg_conv.is_owned = ptr_is_owned(msg);
22545         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22546         msg_conv = ChannelUpdate_clone(&msg_conv);
22547         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22548         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
22549         uint64_t ret_ref = tag_ptr(ret_copy, true);
22550         return ret_ref;
22551 }
22552
22553 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
22554         LDKPublicKey node_id_ref;
22555         CHECK(node_id->arr_len == 33);
22556         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22557         LDKChannelUpdate msg_conv;
22558         msg_conv.inner = untag_ptr(msg);
22559         msg_conv.is_owned = ptr_is_owned(msg);
22560         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22561         msg_conv = ChannelUpdate_clone(&msg_conv);
22562         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22563         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
22564         uint64_t ret_ref = tag_ptr(ret_copy, true);
22565         return ret_ref;
22566 }
22567
22568 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
22569         LDKPublicKey node_id_ref;
22570         CHECK(node_id->arr_len == 33);
22571         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22572         void* action_ptr = untag_ptr(action);
22573         CHECK_ACCESS(action_ptr);
22574         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
22575         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
22576         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22577         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
22578         uint64_t ret_ref = tag_ptr(ret_copy, true);
22579         return ret_ref;
22580 }
22581
22582 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
22583         LDKPublicKey node_id_ref;
22584         CHECK(node_id->arr_len == 33);
22585         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22586         LDKQueryChannelRange msg_conv;
22587         msg_conv.inner = untag_ptr(msg);
22588         msg_conv.is_owned = ptr_is_owned(msg);
22589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22590         msg_conv = QueryChannelRange_clone(&msg_conv);
22591         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22592         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
22593         uint64_t ret_ref = tag_ptr(ret_copy, true);
22594         return ret_ref;
22595 }
22596
22597 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
22598         LDKPublicKey node_id_ref;
22599         CHECK(node_id->arr_len == 33);
22600         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22601         LDKQueryShortChannelIds msg_conv;
22602         msg_conv.inner = untag_ptr(msg);
22603         msg_conv.is_owned = ptr_is_owned(msg);
22604         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22605         msg_conv = QueryShortChannelIds_clone(&msg_conv);
22606         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22607         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
22608         uint64_t ret_ref = tag_ptr(ret_copy, true);
22609         return ret_ref;
22610 }
22611
22612 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
22613         LDKPublicKey node_id_ref;
22614         CHECK(node_id->arr_len == 33);
22615         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22616         LDKReplyChannelRange msg_conv;
22617         msg_conv.inner = untag_ptr(msg);
22618         msg_conv.is_owned = ptr_is_owned(msg);
22619         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22620         msg_conv = ReplyChannelRange_clone(&msg_conv);
22621         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22622         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
22623         uint64_t ret_ref = tag_ptr(ret_copy, true);
22624         return ret_ref;
22625 }
22626
22627 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
22628         LDKPublicKey node_id_ref;
22629         CHECK(node_id->arr_len == 33);
22630         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22631         LDKGossipTimestampFilter msg_conv;
22632         msg_conv.inner = untag_ptr(msg);
22633         msg_conv.is_owned = ptr_is_owned(msg);
22634         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22635         msg_conv = GossipTimestampFilter_clone(&msg_conv);
22636         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22637         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
22638         uint64_t ret_ref = tag_ptr(ret_copy, true);
22639         return ret_ref;
22640 }
22641
22642 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
22643         if (!ptr_is_owned(this_ptr)) return;
22644         void* this_ptr_ptr = untag_ptr(this_ptr);
22645         CHECK_ACCESS(this_ptr_ptr);
22646         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
22647         FREE(untag_ptr(this_ptr));
22648         MessageSendEventsProvider_free(this_ptr_conv);
22649 }
22650
22651 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
22652         if (!ptr_is_owned(this_ptr)) return;
22653         void* this_ptr_ptr = untag_ptr(this_ptr);
22654         CHECK_ACCESS(this_ptr_ptr);
22655         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
22656         FREE(untag_ptr(this_ptr));
22657         OnionMessageProvider_free(this_ptr_conv);
22658 }
22659
22660 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
22661         if (!ptr_is_owned(this_ptr)) return;
22662         void* this_ptr_ptr = untag_ptr(this_ptr);
22663         CHECK_ACCESS(this_ptr_ptr);
22664         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
22665         FREE(untag_ptr(this_ptr));
22666         EventsProvider_free(this_ptr_conv);
22667 }
22668
22669 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
22670         if (!ptr_is_owned(this_ptr)) return;
22671         void* this_ptr_ptr = untag_ptr(this_ptr);
22672         CHECK_ACCESS(this_ptr_ptr);
22673         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
22674         FREE(untag_ptr(this_ptr));
22675         EventHandler_free(this_ptr_conv);
22676 }
22677
22678 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22679         if (!ptr_is_owned(this_ptr)) return;
22680         void* this_ptr_ptr = untag_ptr(this_ptr);
22681         CHECK_ACCESS(this_ptr_ptr);
22682         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22683         FREE(untag_ptr(this_ptr));
22684         APIError_free(this_ptr_conv);
22685 }
22686
22687 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22688         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22689         *ret_copy = APIError_clone(arg);
22690         uint64_t ret_ref = tag_ptr(ret_copy, true);
22691         return ret_ref;
22692 }
22693 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22694         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22695         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22696         return ret_conv;
22697 }
22698
22699 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22700         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22701         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22702         *ret_copy = APIError_clone(orig_conv);
22703         uint64_t ret_ref = tag_ptr(ret_copy, true);
22704         return ret_ref;
22705 }
22706
22707 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22708         LDKStr err_conv = str_ref_to_owned_c(err);
22709         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22710         *ret_copy = APIError_apimisuse_error(err_conv);
22711         uint64_t ret_ref = tag_ptr(ret_copy, true);
22712         return ret_ref;
22713 }
22714
22715 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22716         LDKStr err_conv = str_ref_to_owned_c(err);
22717         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22718         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22719         uint64_t ret_ref = tag_ptr(ret_copy, true);
22720         return ret_ref;
22721 }
22722
22723 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22724         LDKStr err_conv = str_ref_to_owned_c(err);
22725         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22726         *ret_copy = APIError_invalid_route(err_conv);
22727         uint64_t ret_ref = tag_ptr(ret_copy, true);
22728         return ret_ref;
22729 }
22730
22731 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22732         LDKStr err_conv = str_ref_to_owned_c(err);
22733         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22734         *ret_copy = APIError_channel_unavailable(err_conv);
22735         uint64_t ret_ref = tag_ptr(ret_copy, true);
22736         return ret_ref;
22737 }
22738
22739 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22740         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22741         *ret_copy = APIError_monitor_update_in_progress();
22742         uint64_t ret_ref = tag_ptr(ret_copy, true);
22743         return ret_ref;
22744 }
22745
22746 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22747         LDKShutdownScript script_conv;
22748         script_conv.inner = untag_ptr(script);
22749         script_conv.is_owned = ptr_is_owned(script);
22750         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22751         script_conv = ShutdownScript_clone(&script_conv);
22752         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22753         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22754         uint64_t ret_ref = tag_ptr(ret_copy, true);
22755         return ret_ref;
22756 }
22757
22758 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22759         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22760         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22761         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22762         return ret_conv;
22763 }
22764
22765 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22766         LDKBigSize this_obj_conv;
22767         this_obj_conv.inner = untag_ptr(this_obj);
22768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22770         BigSize_free(this_obj_conv);
22771 }
22772
22773 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22774         LDKBigSize this_ptr_conv;
22775         this_ptr_conv.inner = untag_ptr(this_ptr);
22776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22778         this_ptr_conv.is_owned = false;
22779         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22780         return ret_conv;
22781 }
22782
22783 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22784         LDKBigSize this_ptr_conv;
22785         this_ptr_conv.inner = untag_ptr(this_ptr);
22786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22788         this_ptr_conv.is_owned = false;
22789         BigSize_set_a(&this_ptr_conv, val);
22790 }
22791
22792 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22793         LDKBigSize ret_var = BigSize_new(a_arg);
22794         uint64_t ret_ref = 0;
22795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22797         return ret_ref;
22798 }
22799
22800 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22801         LDKHostname this_obj_conv;
22802         this_obj_conv.inner = untag_ptr(this_obj);
22803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22805         Hostname_free(this_obj_conv);
22806 }
22807
22808 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22809         LDKHostname ret_var = Hostname_clone(arg);
22810         uint64_t ret_ref = 0;
22811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22813         return ret_ref;
22814 }
22815 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22816         LDKHostname arg_conv;
22817         arg_conv.inner = untag_ptr(arg);
22818         arg_conv.is_owned = ptr_is_owned(arg);
22819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22820         arg_conv.is_owned = false;
22821         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22822         return ret_conv;
22823 }
22824
22825 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22826         LDKHostname orig_conv;
22827         orig_conv.inner = untag_ptr(orig);
22828         orig_conv.is_owned = ptr_is_owned(orig);
22829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22830         orig_conv.is_owned = false;
22831         LDKHostname ret_var = Hostname_clone(&orig_conv);
22832         uint64_t ret_ref = 0;
22833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22835         return ret_ref;
22836 }
22837
22838 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22839         LDKHostname a_conv;
22840         a_conv.inner = untag_ptr(a);
22841         a_conv.is_owned = ptr_is_owned(a);
22842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22843         a_conv.is_owned = false;
22844         LDKHostname b_conv;
22845         b_conv.inner = untag_ptr(b);
22846         b_conv.is_owned = ptr_is_owned(b);
22847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22848         b_conv.is_owned = false;
22849         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22850         return ret_conv;
22851 }
22852
22853 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22854         LDKHostname this_arg_conv;
22855         this_arg_conv.inner = untag_ptr(this_arg);
22856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22858         this_arg_conv.is_owned = false;
22859         int8_t ret_conv = Hostname_len(&this_arg_conv);
22860         return ret_conv;
22861 }
22862
22863 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22864         LDKu8slice msg_ref;
22865         msg_ref.datalen = msg->arr_len;
22866         msg_ref.data = msg->elems;
22867         unsigned char sk_arr[32];
22868         CHECK(sk->arr_len == 32);
22869         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22870         unsigned char (*sk_ref)[32] = &sk_arr;
22871         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22872         *ret_conv = sign(msg_ref, sk_ref);
22873         FREE(msg);
22874         return tag_ptr(ret_conv, true);
22875 }
22876
22877 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22878         LDKu8slice msg_ref;
22879         msg_ref.datalen = msg->arr_len;
22880         msg_ref.data = msg->elems;
22881         LDKStr sig_conv = str_ref_to_owned_c(sig);
22882         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22883         *ret_conv = recover_pk(msg_ref, sig_conv);
22884         FREE(msg);
22885         return tag_ptr(ret_conv, true);
22886 }
22887
22888 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22889         LDKu8slice msg_ref;
22890         msg_ref.datalen = msg->arr_len;
22891         msg_ref.data = msg->elems;
22892         LDKStr sig_conv = str_ref_to_owned_c(sig);
22893         LDKPublicKey pk_ref;
22894         CHECK(pk->arr_len == 33);
22895         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22896         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22897         FREE(msg);
22898         return ret_conv;
22899 }
22900
22901 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22902         LDKu8slice hrp_bytes_ref;
22903         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22904         hrp_bytes_ref.data = hrp_bytes->elems;
22905         LDKCVec_U5Z data_without_signature_constr;
22906         data_without_signature_constr.datalen = data_without_signature->arr_len;
22907         if (data_without_signature_constr.datalen > 0)
22908                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22909         else
22910                 data_without_signature_constr.data = NULL;
22911         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22912         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22913                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22914                 
22915                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22916         }
22917         FREE(data_without_signature);
22918         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22921         CVec_u8Z_free(ret_var);
22922         FREE(hrp_bytes);
22923         return ret_arr;
22924 }
22925
22926 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22927         if (!ptr_is_owned(this_ptr)) return;
22928         void* this_ptr_ptr = untag_ptr(this_ptr);
22929         CHECK_ACCESS(this_ptr_ptr);
22930         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22931         FREE(untag_ptr(this_ptr));
22932         Persister_free(this_ptr_conv);
22933 }
22934
22935 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
22936         LDKPrintableString this_obj_conv;
22937         this_obj_conv.inner = untag_ptr(this_obj);
22938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22940         PrintableString_free(this_obj_conv);
22941 }
22942
22943 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
22944         LDKPrintableString this_ptr_conv;
22945         this_ptr_conv.inner = untag_ptr(this_ptr);
22946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22948         this_ptr_conv.is_owned = false;
22949         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
22950         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22951         Str_free(ret_str);
22952         return ret_conv;
22953 }
22954
22955 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
22956         LDKPrintableString this_ptr_conv;
22957         this_ptr_conv.inner = untag_ptr(this_ptr);
22958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22960         this_ptr_conv.is_owned = false;
22961         LDKStr val_conv = str_ref_to_owned_c(val);
22962         PrintableString_set_a(&this_ptr_conv, val_conv);
22963 }
22964
22965 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
22966         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
22967         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
22968         uint64_t ret_ref = 0;
22969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22971         return ret_ref;
22972 }
22973
22974 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
22975         if (!ptr_is_owned(this_ptr)) return;
22976         void* this_ptr_ptr = untag_ptr(this_ptr);
22977         CHECK_ACCESS(this_ptr_ptr);
22978         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
22979         FREE(untag_ptr(this_ptr));
22980         FutureCallback_free(this_ptr_conv);
22981 }
22982
22983 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
22984         LDKFuture this_obj_conv;
22985         this_obj_conv.inner = untag_ptr(this_obj);
22986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22988         Future_free(this_obj_conv);
22989 }
22990
22991 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22992         LDKFuture this_arg_conv;
22993         this_arg_conv.inner = untag_ptr(this_arg);
22994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22996         this_arg_conv.is_owned = false;
22997         void* callback_ptr = untag_ptr(callback);
22998         CHECK_ACCESS(callback_ptr);
22999         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23000         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23002                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23003         }
23004         Future_register_callback_fn(&this_arg_conv, callback_conv);
23005 }
23006
23007 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23008         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23009         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23010         return ret_conv;
23011 }
23012
23013 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23014         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23015         return ret_conv;
23016 }
23017
23018 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23019         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23020         return ret_conv;
23021 }
23022
23023 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23024         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23025         return ret_conv;
23026 }
23027
23028 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23029         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23030         return ret_conv;
23031 }
23032
23033 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23034         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23035         return ret_conv;
23036 }
23037
23038 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23039         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23040         return ret_conv;
23041 }
23042
23043 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23044         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23045         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23046         jboolean ret_conv = Level_eq(a_conv, b_conv);
23047         return ret_conv;
23048 }
23049
23050 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23051         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23052         int64_t ret_conv = Level_hash(o_conv);
23053         return ret_conv;
23054 }
23055
23056 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23057         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23058         return ret_conv;
23059 }
23060
23061 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23062         LDKRecord this_obj_conv;
23063         this_obj_conv.inner = untag_ptr(this_obj);
23064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23066         Record_free(this_obj_conv);
23067 }
23068
23069 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23070         LDKRecord this_ptr_conv;
23071         this_ptr_conv.inner = untag_ptr(this_ptr);
23072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23074         this_ptr_conv.is_owned = false;
23075         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23076         return ret_conv;
23077 }
23078
23079 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23080         LDKRecord this_ptr_conv;
23081         this_ptr_conv.inner = untag_ptr(this_ptr);
23082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23084         this_ptr_conv.is_owned = false;
23085         LDKLevel val_conv = LDKLevel_from_js(val);
23086         Record_set_level(&this_ptr_conv, val_conv);
23087 }
23088
23089 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23090         LDKRecord this_ptr_conv;
23091         this_ptr_conv.inner = untag_ptr(this_ptr);
23092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23094         this_ptr_conv.is_owned = false;
23095         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23096         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23097         Str_free(ret_str);
23098         return ret_conv;
23099 }
23100
23101 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23102         LDKRecord this_ptr_conv;
23103         this_ptr_conv.inner = untag_ptr(this_ptr);
23104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23106         this_ptr_conv.is_owned = false;
23107         LDKStr val_conv = str_ref_to_owned_c(val);
23108         Record_set_args(&this_ptr_conv, val_conv);
23109 }
23110
23111 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23112         LDKRecord this_ptr_conv;
23113         this_ptr_conv.inner = untag_ptr(this_ptr);
23114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23116         this_ptr_conv.is_owned = false;
23117         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23118         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23119         Str_free(ret_str);
23120         return ret_conv;
23121 }
23122
23123 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23124         LDKRecord 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         LDKStr val_conv = str_ref_to_owned_c(val);
23130         Record_set_module_path(&this_ptr_conv, val_conv);
23131 }
23132
23133 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23134         LDKRecord this_ptr_conv;
23135         this_ptr_conv.inner = untag_ptr(this_ptr);
23136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23138         this_ptr_conv.is_owned = false;
23139         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23140         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23141         Str_free(ret_str);
23142         return ret_conv;
23143 }
23144
23145 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23146         LDKRecord this_ptr_conv;
23147         this_ptr_conv.inner = untag_ptr(this_ptr);
23148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23150         this_ptr_conv.is_owned = false;
23151         LDKStr val_conv = str_ref_to_owned_c(val);
23152         Record_set_file(&this_ptr_conv, val_conv);
23153 }
23154
23155 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23156         LDKRecord this_ptr_conv;
23157         this_ptr_conv.inner = untag_ptr(this_ptr);
23158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23160         this_ptr_conv.is_owned = false;
23161         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23162         return ret_conv;
23163 }
23164
23165 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23166         LDKRecord this_ptr_conv;
23167         this_ptr_conv.inner = untag_ptr(this_ptr);
23168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23170         this_ptr_conv.is_owned = false;
23171         Record_set_line(&this_ptr_conv, val);
23172 }
23173
23174 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23175         LDKRecord ret_var = Record_clone(arg);
23176         uint64_t ret_ref = 0;
23177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23179         return ret_ref;
23180 }
23181 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23182         LDKRecord arg_conv;
23183         arg_conv.inner = untag_ptr(arg);
23184         arg_conv.is_owned = ptr_is_owned(arg);
23185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23186         arg_conv.is_owned = false;
23187         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23188         return ret_conv;
23189 }
23190
23191 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23192         LDKRecord orig_conv;
23193         orig_conv.inner = untag_ptr(orig);
23194         orig_conv.is_owned = ptr_is_owned(orig);
23195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23196         orig_conv.is_owned = false;
23197         LDKRecord ret_var = Record_clone(&orig_conv);
23198         uint64_t ret_ref = 0;
23199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23201         return ret_ref;
23202 }
23203
23204 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23205         if (!ptr_is_owned(this_ptr)) return;
23206         void* this_ptr_ptr = untag_ptr(this_ptr);
23207         CHECK_ACCESS(this_ptr_ptr);
23208         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23209         FREE(untag_ptr(this_ptr));
23210         Logger_free(this_ptr_conv);
23211 }
23212
23213 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23214         LDKChannelHandshakeConfig this_obj_conv;
23215         this_obj_conv.inner = untag_ptr(this_obj);
23216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23218         ChannelHandshakeConfig_free(this_obj_conv);
23219 }
23220
23221 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23222         LDKChannelHandshakeConfig this_ptr_conv;
23223         this_ptr_conv.inner = untag_ptr(this_ptr);
23224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23226         this_ptr_conv.is_owned = false;
23227         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23228         return ret_conv;
23229 }
23230
23231 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23232         LDKChannelHandshakeConfig this_ptr_conv;
23233         this_ptr_conv.inner = untag_ptr(this_ptr);
23234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23236         this_ptr_conv.is_owned = false;
23237         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23238 }
23239
23240 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23241         LDKChannelHandshakeConfig this_ptr_conv;
23242         this_ptr_conv.inner = untag_ptr(this_ptr);
23243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23245         this_ptr_conv.is_owned = false;
23246         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23247         return ret_conv;
23248 }
23249
23250 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) {
23251         LDKChannelHandshakeConfig this_ptr_conv;
23252         this_ptr_conv.inner = untag_ptr(this_ptr);
23253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23255         this_ptr_conv.is_owned = false;
23256         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23257 }
23258
23259 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23260         LDKChannelHandshakeConfig this_ptr_conv;
23261         this_ptr_conv.inner = untag_ptr(this_ptr);
23262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23264         this_ptr_conv.is_owned = false;
23265         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23266         return ret_conv;
23267 }
23268
23269 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) {
23270         LDKChannelHandshakeConfig this_ptr_conv;
23271         this_ptr_conv.inner = untag_ptr(this_ptr);
23272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23274         this_ptr_conv.is_owned = false;
23275         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23276 }
23277
23278 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) {
23279         LDKChannelHandshakeConfig this_ptr_conv;
23280         this_ptr_conv.inner = untag_ptr(this_ptr);
23281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23283         this_ptr_conv.is_owned = false;
23284         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23285         return ret_conv;
23286 }
23287
23288 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) {
23289         LDKChannelHandshakeConfig this_ptr_conv;
23290         this_ptr_conv.inner = untag_ptr(this_ptr);
23291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23293         this_ptr_conv.is_owned = false;
23294         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23295 }
23296
23297 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23298         LDKChannelHandshakeConfig this_ptr_conv;
23299         this_ptr_conv.inner = untag_ptr(this_ptr);
23300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23302         this_ptr_conv.is_owned = false;
23303         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23304         return ret_conv;
23305 }
23306
23307 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23308         LDKChannelHandshakeConfig this_ptr_conv;
23309         this_ptr_conv.inner = untag_ptr(this_ptr);
23310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23312         this_ptr_conv.is_owned = false;
23313         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23314 }
23315
23316 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23317         LDKChannelHandshakeConfig this_ptr_conv;
23318         this_ptr_conv.inner = untag_ptr(this_ptr);
23319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23321         this_ptr_conv.is_owned = false;
23322         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23323         return ret_conv;
23324 }
23325
23326 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23327         LDKChannelHandshakeConfig this_ptr_conv;
23328         this_ptr_conv.inner = untag_ptr(this_ptr);
23329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23331         this_ptr_conv.is_owned = false;
23332         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23333 }
23334
23335 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23336         LDKChannelHandshakeConfig this_ptr_conv;
23337         this_ptr_conv.inner = untag_ptr(this_ptr);
23338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23340         this_ptr_conv.is_owned = false;
23341         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23342         return ret_conv;
23343 }
23344
23345 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23346         LDKChannelHandshakeConfig this_ptr_conv;
23347         this_ptr_conv.inner = untag_ptr(this_ptr);
23348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23350         this_ptr_conv.is_owned = false;
23351         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23352 }
23353
23354 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) {
23355         LDKChannelHandshakeConfig this_ptr_conv;
23356         this_ptr_conv.inner = untag_ptr(this_ptr);
23357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23359         this_ptr_conv.is_owned = false;
23360         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23361         return ret_conv;
23362 }
23363
23364 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) {
23365         LDKChannelHandshakeConfig this_ptr_conv;
23366         this_ptr_conv.inner = untag_ptr(this_ptr);
23367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23369         this_ptr_conv.is_owned = false;
23370         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23371 }
23372
23373 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) {
23374         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);
23375         uint64_t ret_ref = 0;
23376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23378         return ret_ref;
23379 }
23380
23381 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23382         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23383         uint64_t ret_ref = 0;
23384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23386         return ret_ref;
23387 }
23388 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23389         LDKChannelHandshakeConfig arg_conv;
23390         arg_conv.inner = untag_ptr(arg);
23391         arg_conv.is_owned = ptr_is_owned(arg);
23392         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23393         arg_conv.is_owned = false;
23394         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23395         return ret_conv;
23396 }
23397
23398 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23399         LDKChannelHandshakeConfig orig_conv;
23400         orig_conv.inner = untag_ptr(orig);
23401         orig_conv.is_owned = ptr_is_owned(orig);
23402         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23403         orig_conv.is_owned = false;
23404         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23405         uint64_t ret_ref = 0;
23406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23408         return ret_ref;
23409 }
23410
23411 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23412         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23413         uint64_t ret_ref = 0;
23414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23416         return ret_ref;
23417 }
23418
23419 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23420         LDKChannelHandshakeLimits this_obj_conv;
23421         this_obj_conv.inner = untag_ptr(this_obj);
23422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23424         ChannelHandshakeLimits_free(this_obj_conv);
23425 }
23426
23427 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23428         LDKChannelHandshakeLimits this_ptr_conv;
23429         this_ptr_conv.inner = untag_ptr(this_ptr);
23430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23432         this_ptr_conv.is_owned = false;
23433         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23434         return ret_conv;
23435 }
23436
23437 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23438         LDKChannelHandshakeLimits this_ptr_conv;
23439         this_ptr_conv.inner = untag_ptr(this_ptr);
23440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23442         this_ptr_conv.is_owned = false;
23443         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23444 }
23445
23446 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23447         LDKChannelHandshakeLimits 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         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23453         return ret_conv;
23454 }
23455
23456 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23457         LDKChannelHandshakeLimits this_ptr_conv;
23458         this_ptr_conv.inner = untag_ptr(this_ptr);
23459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23461         this_ptr_conv.is_owned = false;
23462         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23463 }
23464
23465 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23466         LDKChannelHandshakeLimits this_ptr_conv;
23467         this_ptr_conv.inner = untag_ptr(this_ptr);
23468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23470         this_ptr_conv.is_owned = false;
23471         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23472         return ret_conv;
23473 }
23474
23475 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) {
23476         LDKChannelHandshakeLimits this_ptr_conv;
23477         this_ptr_conv.inner = untag_ptr(this_ptr);
23478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23480         this_ptr_conv.is_owned = false;
23481         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23482 }
23483
23484 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) {
23485         LDKChannelHandshakeLimits this_ptr_conv;
23486         this_ptr_conv.inner = untag_ptr(this_ptr);
23487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23489         this_ptr_conv.is_owned = false;
23490         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23491         return ret_conv;
23492 }
23493
23494 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) {
23495         LDKChannelHandshakeLimits this_ptr_conv;
23496         this_ptr_conv.inner = untag_ptr(this_ptr);
23497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23499         this_ptr_conv.is_owned = false;
23500         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23501 }
23502
23503 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23504         LDKChannelHandshakeLimits this_ptr_conv;
23505         this_ptr_conv.inner = untag_ptr(this_ptr);
23506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23508         this_ptr_conv.is_owned = false;
23509         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23510         return ret_conv;
23511 }
23512
23513 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) {
23514         LDKChannelHandshakeLimits this_ptr_conv;
23515         this_ptr_conv.inner = untag_ptr(this_ptr);
23516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23518         this_ptr_conv.is_owned = false;
23519         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23520 }
23521
23522 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23523         LDKChannelHandshakeLimits this_ptr_conv;
23524         this_ptr_conv.inner = untag_ptr(this_ptr);
23525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23527         this_ptr_conv.is_owned = false;
23528         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23529         return ret_conv;
23530 }
23531
23532 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) {
23533         LDKChannelHandshakeLimits this_ptr_conv;
23534         this_ptr_conv.inner = untag_ptr(this_ptr);
23535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23537         this_ptr_conv.is_owned = false;
23538         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23539 }
23540
23541 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23542         LDKChannelHandshakeLimits this_ptr_conv;
23543         this_ptr_conv.inner = untag_ptr(this_ptr);
23544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23546         this_ptr_conv.is_owned = false;
23547         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23548         return ret_conv;
23549 }
23550
23551 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23552         LDKChannelHandshakeLimits this_ptr_conv;
23553         this_ptr_conv.inner = untag_ptr(this_ptr);
23554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23556         this_ptr_conv.is_owned = false;
23557         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23558 }
23559
23560 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23561         LDKChannelHandshakeLimits this_ptr_conv;
23562         this_ptr_conv.inner = untag_ptr(this_ptr);
23563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23565         this_ptr_conv.is_owned = false;
23566         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23567         return ret_conv;
23568 }
23569
23570 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23571         LDKChannelHandshakeLimits this_ptr_conv;
23572         this_ptr_conv.inner = untag_ptr(this_ptr);
23573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23575         this_ptr_conv.is_owned = false;
23576         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23577 }
23578
23579 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23580         LDKChannelHandshakeLimits this_ptr_conv;
23581         this_ptr_conv.inner = untag_ptr(this_ptr);
23582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23584         this_ptr_conv.is_owned = false;
23585         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23586         return ret_conv;
23587 }
23588
23589 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23590         LDKChannelHandshakeLimits this_ptr_conv;
23591         this_ptr_conv.inner = untag_ptr(this_ptr);
23592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23594         this_ptr_conv.is_owned = false;
23595         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23596 }
23597
23598 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23599         LDKChannelHandshakeLimits this_ptr_conv;
23600         this_ptr_conv.inner = untag_ptr(this_ptr);
23601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23603         this_ptr_conv.is_owned = false;
23604         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23605         return ret_conv;
23606 }
23607
23608 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) {
23609         LDKChannelHandshakeLimits this_ptr_conv;
23610         this_ptr_conv.inner = untag_ptr(this_ptr);
23611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23613         this_ptr_conv.is_owned = false;
23614         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23615 }
23616
23617 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) {
23618         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);
23619         uint64_t ret_ref = 0;
23620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23622         return ret_ref;
23623 }
23624
23625 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23626         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23627         uint64_t ret_ref = 0;
23628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23630         return ret_ref;
23631 }
23632 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23633         LDKChannelHandshakeLimits arg_conv;
23634         arg_conv.inner = untag_ptr(arg);
23635         arg_conv.is_owned = ptr_is_owned(arg);
23636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23637         arg_conv.is_owned = false;
23638         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23639         return ret_conv;
23640 }
23641
23642 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23643         LDKChannelHandshakeLimits orig_conv;
23644         orig_conv.inner = untag_ptr(orig);
23645         orig_conv.is_owned = ptr_is_owned(orig);
23646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23647         orig_conv.is_owned = false;
23648         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23649         uint64_t ret_ref = 0;
23650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23652         return ret_ref;
23653 }
23654
23655 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23656         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23657         uint64_t ret_ref = 0;
23658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23660         return ret_ref;
23661 }
23662
23663 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23664         LDKChannelConfig this_obj_conv;
23665         this_obj_conv.inner = untag_ptr(this_obj);
23666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23668         ChannelConfig_free(this_obj_conv);
23669 }
23670
23671 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23672         LDKChannelConfig this_ptr_conv;
23673         this_ptr_conv.inner = untag_ptr(this_ptr);
23674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23676         this_ptr_conv.is_owned = false;
23677         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23678         return ret_conv;
23679 }
23680
23681 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) {
23682         LDKChannelConfig this_ptr_conv;
23683         this_ptr_conv.inner = untag_ptr(this_ptr);
23684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23686         this_ptr_conv.is_owned = false;
23687         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23688 }
23689
23690 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23691         LDKChannelConfig this_ptr_conv;
23692         this_ptr_conv.inner = untag_ptr(this_ptr);
23693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23695         this_ptr_conv.is_owned = false;
23696         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23697         return ret_conv;
23698 }
23699
23700 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) {
23701         LDKChannelConfig this_ptr_conv;
23702         this_ptr_conv.inner = untag_ptr(this_ptr);
23703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23705         this_ptr_conv.is_owned = false;
23706         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23707 }
23708
23709 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23710         LDKChannelConfig this_ptr_conv;
23711         this_ptr_conv.inner = untag_ptr(this_ptr);
23712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23714         this_ptr_conv.is_owned = false;
23715         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23716         return ret_conv;
23717 }
23718
23719 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23720         LDKChannelConfig this_ptr_conv;
23721         this_ptr_conv.inner = untag_ptr(this_ptr);
23722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23724         this_ptr_conv.is_owned = false;
23725         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23726 }
23727
23728 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) {
23729         LDKChannelConfig this_ptr_conv;
23730         this_ptr_conv.inner = untag_ptr(this_ptr);
23731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23733         this_ptr_conv.is_owned = false;
23734         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23735         return ret_conv;
23736 }
23737
23738 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) {
23739         LDKChannelConfig this_ptr_conv;
23740         this_ptr_conv.inner = untag_ptr(this_ptr);
23741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23743         this_ptr_conv.is_owned = false;
23744         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23745 }
23746
23747 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) {
23748         LDKChannelConfig this_ptr_conv;
23749         this_ptr_conv.inner = untag_ptr(this_ptr);
23750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23752         this_ptr_conv.is_owned = false;
23753         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23754         return ret_conv;
23755 }
23756
23757 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) {
23758         LDKChannelConfig this_ptr_conv;
23759         this_ptr_conv.inner = untag_ptr(this_ptr);
23760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23762         this_ptr_conv.is_owned = false;
23763         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23764 }
23765
23766 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) {
23767         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);
23768         uint64_t ret_ref = 0;
23769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23771         return ret_ref;
23772 }
23773
23774 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23775         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23776         uint64_t ret_ref = 0;
23777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23779         return ret_ref;
23780 }
23781 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23782         LDKChannelConfig arg_conv;
23783         arg_conv.inner = untag_ptr(arg);
23784         arg_conv.is_owned = ptr_is_owned(arg);
23785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23786         arg_conv.is_owned = false;
23787         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23788         return ret_conv;
23789 }
23790
23791 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23792         LDKChannelConfig orig_conv;
23793         orig_conv.inner = untag_ptr(orig);
23794         orig_conv.is_owned = ptr_is_owned(orig);
23795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23796         orig_conv.is_owned = false;
23797         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
23798         uint64_t ret_ref = 0;
23799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23801         return ret_ref;
23802 }
23803
23804 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
23805         LDKChannelConfig a_conv;
23806         a_conv.inner = untag_ptr(a);
23807         a_conv.is_owned = ptr_is_owned(a);
23808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23809         a_conv.is_owned = false;
23810         LDKChannelConfig b_conv;
23811         b_conv.inner = untag_ptr(b);
23812         b_conv.is_owned = ptr_is_owned(b);
23813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23814         b_conv.is_owned = false;
23815         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
23816         return ret_conv;
23817 }
23818
23819 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
23820         LDKChannelConfig ret_var = ChannelConfig_default();
23821         uint64_t ret_ref = 0;
23822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23824         return ret_ref;
23825 }
23826
23827 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
23828         LDKChannelConfig obj_conv;
23829         obj_conv.inner = untag_ptr(obj);
23830         obj_conv.is_owned = ptr_is_owned(obj);
23831         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23832         obj_conv.is_owned = false;
23833         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
23834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23836         CVec_u8Z_free(ret_var);
23837         return ret_arr;
23838 }
23839
23840 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
23841         LDKu8slice ser_ref;
23842         ser_ref.datalen = ser->arr_len;
23843         ser_ref.data = ser->elems;
23844         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23845         *ret_conv = ChannelConfig_read(ser_ref);
23846         FREE(ser);
23847         return tag_ptr(ret_conv, true);
23848 }
23849
23850 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
23851         LDKUserConfig this_obj_conv;
23852         this_obj_conv.inner = untag_ptr(this_obj);
23853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23855         UserConfig_free(this_obj_conv);
23856 }
23857
23858 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
23859         LDKUserConfig this_ptr_conv;
23860         this_ptr_conv.inner = untag_ptr(this_ptr);
23861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23863         this_ptr_conv.is_owned = false;
23864         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
23865         uint64_t ret_ref = 0;
23866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23868         return ret_ref;
23869 }
23870
23871 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
23872         LDKUserConfig this_ptr_conv;
23873         this_ptr_conv.inner = untag_ptr(this_ptr);
23874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23876         this_ptr_conv.is_owned = false;
23877         LDKChannelHandshakeConfig val_conv;
23878         val_conv.inner = untag_ptr(val);
23879         val_conv.is_owned = ptr_is_owned(val);
23880         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23881         val_conv = ChannelHandshakeConfig_clone(&val_conv);
23882         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
23883 }
23884
23885 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
23886         LDKUserConfig this_ptr_conv;
23887         this_ptr_conv.inner = untag_ptr(this_ptr);
23888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23890         this_ptr_conv.is_owned = false;
23891         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
23892         uint64_t ret_ref = 0;
23893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23895         return ret_ref;
23896 }
23897
23898 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
23899         LDKUserConfig this_ptr_conv;
23900         this_ptr_conv.inner = untag_ptr(this_ptr);
23901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23903         this_ptr_conv.is_owned = false;
23904         LDKChannelHandshakeLimits val_conv;
23905         val_conv.inner = untag_ptr(val);
23906         val_conv.is_owned = ptr_is_owned(val);
23907         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23908         val_conv = ChannelHandshakeLimits_clone(&val_conv);
23909         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
23910 }
23911
23912 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
23913         LDKUserConfig this_ptr_conv;
23914         this_ptr_conv.inner = untag_ptr(this_ptr);
23915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23917         this_ptr_conv.is_owned = false;
23918         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
23919         uint64_t ret_ref = 0;
23920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23922         return ret_ref;
23923 }
23924
23925 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
23926         LDKUserConfig this_ptr_conv;
23927         this_ptr_conv.inner = untag_ptr(this_ptr);
23928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23930         this_ptr_conv.is_owned = false;
23931         LDKChannelConfig val_conv;
23932         val_conv.inner = untag_ptr(val);
23933         val_conv.is_owned = ptr_is_owned(val);
23934         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23935         val_conv = ChannelConfig_clone(&val_conv);
23936         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
23937 }
23938
23939 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
23940         LDKUserConfig this_ptr_conv;
23941         this_ptr_conv.inner = untag_ptr(this_ptr);
23942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23944         this_ptr_conv.is_owned = false;
23945         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
23946         return ret_conv;
23947 }
23948
23949 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) {
23950         LDKUserConfig this_ptr_conv;
23951         this_ptr_conv.inner = untag_ptr(this_ptr);
23952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23954         this_ptr_conv.is_owned = false;
23955         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
23956 }
23957
23958 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
23959         LDKUserConfig this_ptr_conv;
23960         this_ptr_conv.inner = untag_ptr(this_ptr);
23961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23963         this_ptr_conv.is_owned = false;
23964         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
23965         return ret_conv;
23966 }
23967
23968 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23969         LDKUserConfig this_ptr_conv;
23970         this_ptr_conv.inner = untag_ptr(this_ptr);
23971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23973         this_ptr_conv.is_owned = false;
23974         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
23975 }
23976
23977 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
23978         LDKUserConfig this_ptr_conv;
23979         this_ptr_conv.inner = untag_ptr(this_ptr);
23980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23982         this_ptr_conv.is_owned = false;
23983         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
23984         return ret_conv;
23985 }
23986
23987 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23988         LDKUserConfig this_ptr_conv;
23989         this_ptr_conv.inner = untag_ptr(this_ptr);
23990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23992         this_ptr_conv.is_owned = false;
23993         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
23994 }
23995
23996 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
23997         LDKUserConfig this_ptr_conv;
23998         this_ptr_conv.inner = untag_ptr(this_ptr);
23999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24001         this_ptr_conv.is_owned = false;
24002         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24003         return ret_conv;
24004 }
24005
24006 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24007         LDKUserConfig this_ptr_conv;
24008         this_ptr_conv.inner = untag_ptr(this_ptr);
24009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24011         this_ptr_conv.is_owned = false;
24012         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24013 }
24014
24015 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, jboolean accept_intercept_htlcs_arg) {
24016         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24017         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24018         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24019         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24020         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24021         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24022         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24023         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24024         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24025         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24026         LDKChannelConfig channel_config_arg_conv;
24027         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24028         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24029         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24030         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24031         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, accept_intercept_htlcs_arg);
24032         uint64_t ret_ref = 0;
24033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24035         return ret_ref;
24036 }
24037
24038 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24039         LDKUserConfig ret_var = UserConfig_clone(arg);
24040         uint64_t ret_ref = 0;
24041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24043         return ret_ref;
24044 }
24045 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24046         LDKUserConfig arg_conv;
24047         arg_conv.inner = untag_ptr(arg);
24048         arg_conv.is_owned = ptr_is_owned(arg);
24049         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24050         arg_conv.is_owned = false;
24051         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24052         return ret_conv;
24053 }
24054
24055 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24056         LDKUserConfig orig_conv;
24057         orig_conv.inner = untag_ptr(orig);
24058         orig_conv.is_owned = ptr_is_owned(orig);
24059         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24060         orig_conv.is_owned = false;
24061         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24062         uint64_t ret_ref = 0;
24063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24065         return ret_ref;
24066 }
24067
24068 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24069         LDKUserConfig ret_var = UserConfig_default();
24070         uint64_t ret_ref = 0;
24071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24073         return ret_ref;
24074 }
24075
24076 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24077         LDKBestBlock this_obj_conv;
24078         this_obj_conv.inner = untag_ptr(this_obj);
24079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24081         BestBlock_free(this_obj_conv);
24082 }
24083
24084 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24085         LDKBestBlock ret_var = BestBlock_clone(arg);
24086         uint64_t ret_ref = 0;
24087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24089         return ret_ref;
24090 }
24091 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24092         LDKBestBlock arg_conv;
24093         arg_conv.inner = untag_ptr(arg);
24094         arg_conv.is_owned = ptr_is_owned(arg);
24095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24096         arg_conv.is_owned = false;
24097         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24098         return ret_conv;
24099 }
24100
24101 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24102         LDKBestBlock orig_conv;
24103         orig_conv.inner = untag_ptr(orig);
24104         orig_conv.is_owned = ptr_is_owned(orig);
24105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24106         orig_conv.is_owned = false;
24107         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24108         uint64_t ret_ref = 0;
24109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24111         return ret_ref;
24112 }
24113
24114 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24115         LDKBestBlock a_conv;
24116         a_conv.inner = untag_ptr(a);
24117         a_conv.is_owned = ptr_is_owned(a);
24118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24119         a_conv.is_owned = false;
24120         LDKBestBlock b_conv;
24121         b_conv.inner = untag_ptr(b);
24122         b_conv.is_owned = ptr_is_owned(b);
24123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24124         b_conv.is_owned = false;
24125         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24126         return ret_conv;
24127 }
24128
24129 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
24130         LDKNetwork network_conv = LDKNetwork_from_js(network);
24131         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
24132         uint64_t ret_ref = 0;
24133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24135         return ret_ref;
24136 }
24137
24138 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24139         LDKThirtyTwoBytes block_hash_ref;
24140         CHECK(block_hash->arr_len == 32);
24141         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24142         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24143         uint64_t ret_ref = 0;
24144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24146         return ret_ref;
24147 }
24148
24149 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24150         LDKBestBlock this_arg_conv;
24151         this_arg_conv.inner = untag_ptr(this_arg);
24152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24154         this_arg_conv.is_owned = false;
24155         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24156         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24157         return ret_arr;
24158 }
24159
24160 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24161         LDKBestBlock this_arg_conv;
24162         this_arg_conv.inner = untag_ptr(this_arg);
24163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24165         this_arg_conv.is_owned = false;
24166         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24167         return ret_conv;
24168 }
24169
24170 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
24171         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
24172         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
24173         return ret_conv;
24174 }
24175
24176 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
24177         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
24178         return ret_conv;
24179 }
24180
24181 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
24182         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
24183         return ret_conv;
24184 }
24185
24186 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
24187         if (!ptr_is_owned(this_ptr)) return;
24188         void* this_ptr_ptr = untag_ptr(this_ptr);
24189         CHECK_ACCESS(this_ptr_ptr);
24190         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
24191         FREE(untag_ptr(this_ptr));
24192         Access_free(this_ptr_conv);
24193 }
24194
24195 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24196         if (!ptr_is_owned(this_ptr)) return;
24197         void* this_ptr_ptr = untag_ptr(this_ptr);
24198         CHECK_ACCESS(this_ptr_ptr);
24199         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24200         FREE(untag_ptr(this_ptr));
24201         Listen_free(this_ptr_conv);
24202 }
24203
24204 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24205         if (!ptr_is_owned(this_ptr)) return;
24206         void* this_ptr_ptr = untag_ptr(this_ptr);
24207         CHECK_ACCESS(this_ptr_ptr);
24208         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24209         FREE(untag_ptr(this_ptr));
24210         Confirm_free(this_ptr_conv);
24211 }
24212
24213 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24214         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24215         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24216         return ret_conv;
24217 }
24218
24219 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24220         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24221         return ret_conv;
24222 }
24223
24224 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24225         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24226         return ret_conv;
24227 }
24228
24229 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24230         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24231         return ret_conv;
24232 }
24233
24234 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24235         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24236         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24237         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24238         return ret_conv;
24239 }
24240
24241 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24242         if (!ptr_is_owned(this_ptr)) return;
24243         void* this_ptr_ptr = untag_ptr(this_ptr);
24244         CHECK_ACCESS(this_ptr_ptr);
24245         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24246         FREE(untag_ptr(this_ptr));
24247         Watch_free(this_ptr_conv);
24248 }
24249
24250 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24251         if (!ptr_is_owned(this_ptr)) return;
24252         void* this_ptr_ptr = untag_ptr(this_ptr);
24253         CHECK_ACCESS(this_ptr_ptr);
24254         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24255         FREE(untag_ptr(this_ptr));
24256         Filter_free(this_ptr_conv);
24257 }
24258
24259 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24260         LDKWatchedOutput this_obj_conv;
24261         this_obj_conv.inner = untag_ptr(this_obj);
24262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24264         WatchedOutput_free(this_obj_conv);
24265 }
24266
24267 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24268         LDKWatchedOutput this_ptr_conv;
24269         this_ptr_conv.inner = untag_ptr(this_ptr);
24270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24272         this_ptr_conv.is_owned = false;
24273         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24274         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24275         return ret_arr;
24276 }
24277
24278 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24279         LDKWatchedOutput this_ptr_conv;
24280         this_ptr_conv.inner = untag_ptr(this_ptr);
24281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24283         this_ptr_conv.is_owned = false;
24284         LDKThirtyTwoBytes val_ref;
24285         CHECK(val->arr_len == 32);
24286         memcpy(val_ref.data, val->elems, 32); FREE(val);
24287         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24288 }
24289
24290 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24291         LDKWatchedOutput this_ptr_conv;
24292         this_ptr_conv.inner = untag_ptr(this_ptr);
24293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24295         this_ptr_conv.is_owned = false;
24296         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24297         uint64_t ret_ref = 0;
24298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24300         return ret_ref;
24301 }
24302
24303 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24304         LDKWatchedOutput this_ptr_conv;
24305         this_ptr_conv.inner = untag_ptr(this_ptr);
24306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24308         this_ptr_conv.is_owned = false;
24309         LDKOutPoint val_conv;
24310         val_conv.inner = untag_ptr(val);
24311         val_conv.is_owned = ptr_is_owned(val);
24312         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24313         val_conv = OutPoint_clone(&val_conv);
24314         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24315 }
24316
24317 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24318         LDKWatchedOutput this_ptr_conv;
24319         this_ptr_conv.inner = untag_ptr(this_ptr);
24320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24322         this_ptr_conv.is_owned = false;
24323         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24324         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24325         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24326         return ret_arr;
24327 }
24328
24329 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24330         LDKWatchedOutput this_ptr_conv;
24331         this_ptr_conv.inner = untag_ptr(this_ptr);
24332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24334         this_ptr_conv.is_owned = false;
24335         LDKCVec_u8Z val_ref;
24336         val_ref.datalen = val->arr_len;
24337         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24338         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24339         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24340 }
24341
24342 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) {
24343         LDKThirtyTwoBytes block_hash_arg_ref;
24344         CHECK(block_hash_arg->arr_len == 32);
24345         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24346         LDKOutPoint outpoint_arg_conv;
24347         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24348         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24349         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24350         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24351         LDKCVec_u8Z script_pubkey_arg_ref;
24352         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24353         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24354         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24355         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24356         uint64_t ret_ref = 0;
24357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24359         return ret_ref;
24360 }
24361
24362 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24363         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24364         uint64_t ret_ref = 0;
24365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24367         return ret_ref;
24368 }
24369 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24370         LDKWatchedOutput arg_conv;
24371         arg_conv.inner = untag_ptr(arg);
24372         arg_conv.is_owned = ptr_is_owned(arg);
24373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24374         arg_conv.is_owned = false;
24375         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24376         return ret_conv;
24377 }
24378
24379 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24380         LDKWatchedOutput orig_conv;
24381         orig_conv.inner = untag_ptr(orig);
24382         orig_conv.is_owned = ptr_is_owned(orig);
24383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24384         orig_conv.is_owned = false;
24385         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24386         uint64_t ret_ref = 0;
24387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24389         return ret_ref;
24390 }
24391
24392 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24393         LDKWatchedOutput a_conv;
24394         a_conv.inner = untag_ptr(a);
24395         a_conv.is_owned = ptr_is_owned(a);
24396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24397         a_conv.is_owned = false;
24398         LDKWatchedOutput b_conv;
24399         b_conv.inner = untag_ptr(b);
24400         b_conv.is_owned = ptr_is_owned(b);
24401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24402         b_conv.is_owned = false;
24403         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24404         return ret_conv;
24405 }
24406
24407 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24408         LDKWatchedOutput o_conv;
24409         o_conv.inner = untag_ptr(o);
24410         o_conv.is_owned = ptr_is_owned(o);
24411         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24412         o_conv.is_owned = false;
24413         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24414         return ret_conv;
24415 }
24416
24417 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24418         if (!ptr_is_owned(this_ptr)) return;
24419         void* this_ptr_ptr = untag_ptr(this_ptr);
24420         CHECK_ACCESS(this_ptr_ptr);
24421         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24422         FREE(untag_ptr(this_ptr));
24423         BroadcasterInterface_free(this_ptr_conv);
24424 }
24425
24426 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24427         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24428         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24429         return ret_conv;
24430 }
24431
24432 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24433         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24434         return ret_conv;
24435 }
24436
24437 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24438         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24439         return ret_conv;
24440 }
24441
24442 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24443         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24444         return ret_conv;
24445 }
24446
24447 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24448         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24449         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24450         return ret_conv;
24451 }
24452
24453 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24454         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24455         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24456         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24457         return ret_conv;
24458 }
24459
24460 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24461         if (!ptr_is_owned(this_ptr)) return;
24462         void* this_ptr_ptr = untag_ptr(this_ptr);
24463         CHECK_ACCESS(this_ptr_ptr);
24464         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24465         FREE(untag_ptr(this_ptr));
24466         FeeEstimator_free(this_ptr_conv);
24467 }
24468
24469 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24470         LDKMonitorUpdateId this_obj_conv;
24471         this_obj_conv.inner = untag_ptr(this_obj);
24472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24474         MonitorUpdateId_free(this_obj_conv);
24475 }
24476
24477 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24478         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24479         uint64_t ret_ref = 0;
24480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24482         return ret_ref;
24483 }
24484 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24485         LDKMonitorUpdateId arg_conv;
24486         arg_conv.inner = untag_ptr(arg);
24487         arg_conv.is_owned = ptr_is_owned(arg);
24488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24489         arg_conv.is_owned = false;
24490         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24491         return ret_conv;
24492 }
24493
24494 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24495         LDKMonitorUpdateId orig_conv;
24496         orig_conv.inner = untag_ptr(orig);
24497         orig_conv.is_owned = ptr_is_owned(orig);
24498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24499         orig_conv.is_owned = false;
24500         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24501         uint64_t ret_ref = 0;
24502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24504         return ret_ref;
24505 }
24506
24507 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24508         LDKMonitorUpdateId o_conv;
24509         o_conv.inner = untag_ptr(o);
24510         o_conv.is_owned = ptr_is_owned(o);
24511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24512         o_conv.is_owned = false;
24513         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24514         return ret_conv;
24515 }
24516
24517 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24518         LDKMonitorUpdateId a_conv;
24519         a_conv.inner = untag_ptr(a);
24520         a_conv.is_owned = ptr_is_owned(a);
24521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24522         a_conv.is_owned = false;
24523         LDKMonitorUpdateId b_conv;
24524         b_conv.inner = untag_ptr(b);
24525         b_conv.is_owned = ptr_is_owned(b);
24526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24527         b_conv.is_owned = false;
24528         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24529         return ret_conv;
24530 }
24531
24532 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24533         if (!ptr_is_owned(this_ptr)) return;
24534         void* this_ptr_ptr = untag_ptr(this_ptr);
24535         CHECK_ACCESS(this_ptr_ptr);
24536         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24537         FREE(untag_ptr(this_ptr));
24538         Persist_free(this_ptr_conv);
24539 }
24540
24541 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24542         LDKLockedChannelMonitor this_obj_conv;
24543         this_obj_conv.inner = untag_ptr(this_obj);
24544         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24546         LockedChannelMonitor_free(this_obj_conv);
24547 }
24548
24549 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24550         LDKChainMonitor this_obj_conv;
24551         this_obj_conv.inner = untag_ptr(this_obj);
24552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24554         ChainMonitor_free(this_obj_conv);
24555 }
24556
24557 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) {
24558         void* chain_source_ptr = untag_ptr(chain_source);
24559         CHECK_ACCESS(chain_source_ptr);
24560         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24561         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24562         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24563                 // Manually implement clone for Java trait instances
24564                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24565                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24566                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24567                 }
24568         }
24569         void* broadcaster_ptr = untag_ptr(broadcaster);
24570         CHECK_ACCESS(broadcaster_ptr);
24571         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24572         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24573                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24574                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24575         }
24576         void* logger_ptr = untag_ptr(logger);
24577         CHECK_ACCESS(logger_ptr);
24578         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24579         if (logger_conv.free == LDKLogger_JCalls_free) {
24580                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24581                 LDKLogger_JCalls_cloned(&logger_conv);
24582         }
24583         void* feeest_ptr = untag_ptr(feeest);
24584         CHECK_ACCESS(feeest_ptr);
24585         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24586         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24587                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24588                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24589         }
24590         void* persister_ptr = untag_ptr(persister);
24591         CHECK_ACCESS(persister_ptr);
24592         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24593         if (persister_conv.free == LDKPersist_JCalls_free) {
24594                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24595                 LDKPersist_JCalls_cloned(&persister_conv);
24596         }
24597         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24598         uint64_t ret_ref = 0;
24599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24601         return ret_ref;
24602 }
24603
24604 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24605         LDKChainMonitor this_arg_conv;
24606         this_arg_conv.inner = untag_ptr(this_arg);
24607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24609         this_arg_conv.is_owned = false;
24610         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24611         ignored_channels_constr.datalen = ignored_channels->arr_len;
24612         if (ignored_channels_constr.datalen > 0)
24613                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24614         else
24615                 ignored_channels_constr.data = NULL;
24616         uint64_t* ignored_channels_vals = ignored_channels->elems;
24617         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24618                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24619                 LDKChannelDetails ignored_channels_conv_16_conv;
24620                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24621                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24622                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24623                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24624                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24625         }
24626         FREE(ignored_channels);
24627         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24628         uint64_tArray ret_arr = NULL;
24629         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24630         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24631         for (size_t j = 0; j < ret_var.datalen; j++) {
24632                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24633                 *ret_conv_9_copy = ret_var.data[j];
24634                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24635                 ret_arr_ptr[j] = ret_conv_9_ref;
24636         }
24637         
24638         FREE(ret_var.data);
24639         return ret_arr;
24640 }
24641
24642 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24643         LDKChainMonitor this_arg_conv;
24644         this_arg_conv.inner = untag_ptr(this_arg);
24645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24647         this_arg_conv.is_owned = false;
24648         LDKOutPoint funding_txo_conv;
24649         funding_txo_conv.inner = untag_ptr(funding_txo);
24650         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24651         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24652         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24653         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24654         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24655         return tag_ptr(ret_conv, true);
24656 }
24657
24658 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24659         LDKChainMonitor this_arg_conv;
24660         this_arg_conv.inner = untag_ptr(this_arg);
24661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24663         this_arg_conv.is_owned = false;
24664         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24665         uint64_tArray ret_arr = NULL;
24666         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24667         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24668         for (size_t k = 0; k < ret_var.datalen; k++) {
24669                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24670                 uint64_t ret_conv_10_ref = 0;
24671                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24672                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24673                 ret_arr_ptr[k] = ret_conv_10_ref;
24674         }
24675         
24676         FREE(ret_var.data);
24677         return ret_arr;
24678 }
24679
24680 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
24681         LDKChainMonitor this_arg_conv;
24682         this_arg_conv.inner = untag_ptr(this_arg);
24683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24685         this_arg_conv.is_owned = false;
24686         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24687         uint64_tArray ret_arr = NULL;
24688         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24689         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24690         for (size_t p = 0; p < ret_var.datalen; p++) {
24691                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24692                 *ret_conv_41_conv = ret_var.data[p];
24693                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24694         }
24695         
24696         FREE(ret_var.data);
24697         return ret_arr;
24698 }
24699
24700 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) {
24701         LDKChainMonitor this_arg_conv;
24702         this_arg_conv.inner = untag_ptr(this_arg);
24703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24705         this_arg_conv.is_owned = false;
24706         LDKOutPoint funding_txo_conv;
24707         funding_txo_conv.inner = untag_ptr(funding_txo);
24708         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24709         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24710         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24711         LDKMonitorUpdateId completed_update_id_conv;
24712         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24713         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24714         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24715         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24716         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24717         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24718         return tag_ptr(ret_conv, true);
24719 }
24720
24721 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24722         LDKChainMonitor this_arg_conv;
24723         this_arg_conv.inner = untag_ptr(this_arg);
24724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24726         this_arg_conv.is_owned = false;
24727         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24728         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24729         return tag_ptr(ret_ret, true);
24730 }
24731
24732 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
24733         LDKChainMonitor this_arg_conv;
24734         this_arg_conv.inner = untag_ptr(this_arg);
24735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24737         this_arg_conv.is_owned = false;
24738         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24739         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24740         return tag_ptr(ret_ret, true);
24741 }
24742
24743 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24744         LDKChainMonitor this_arg_conv;
24745         this_arg_conv.inner = untag_ptr(this_arg);
24746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24748         this_arg_conv.is_owned = false;
24749         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24750         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24751         return tag_ptr(ret_ret, true);
24752 }
24753
24754 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24755         LDKChainMonitor this_arg_conv;
24756         this_arg_conv.inner = untag_ptr(this_arg);
24757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24759         this_arg_conv.is_owned = false;
24760         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24761         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24762         return tag_ptr(ret_ret, true);
24763 }
24764
24765 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24766         LDKChannelMonitorUpdate this_obj_conv;
24767         this_obj_conv.inner = untag_ptr(this_obj);
24768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24770         ChannelMonitorUpdate_free(this_obj_conv);
24771 }
24772
24773 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24774         LDKChannelMonitorUpdate this_ptr_conv;
24775         this_ptr_conv.inner = untag_ptr(this_ptr);
24776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24778         this_ptr_conv.is_owned = false;
24779         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24780         return ret_conv;
24781 }
24782
24783 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24784         LDKChannelMonitorUpdate this_ptr_conv;
24785         this_ptr_conv.inner = untag_ptr(this_ptr);
24786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24788         this_ptr_conv.is_owned = false;
24789         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24790 }
24791
24792 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24793         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24794         uint64_t ret_ref = 0;
24795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24797         return ret_ref;
24798 }
24799 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
24800         LDKChannelMonitorUpdate arg_conv;
24801         arg_conv.inner = untag_ptr(arg);
24802         arg_conv.is_owned = ptr_is_owned(arg);
24803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24804         arg_conv.is_owned = false;
24805         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
24806         return ret_conv;
24807 }
24808
24809 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
24810         LDKChannelMonitorUpdate orig_conv;
24811         orig_conv.inner = untag_ptr(orig);
24812         orig_conv.is_owned = ptr_is_owned(orig);
24813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24814         orig_conv.is_owned = false;
24815         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
24816         uint64_t ret_ref = 0;
24817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24819         return ret_ref;
24820 }
24821
24822 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
24823         LDKChannelMonitorUpdate obj_conv;
24824         obj_conv.inner = untag_ptr(obj);
24825         obj_conv.is_owned = ptr_is_owned(obj);
24826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24827         obj_conv.is_owned = false;
24828         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
24829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24831         CVec_u8Z_free(ret_var);
24832         return ret_arr;
24833 }
24834
24835 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
24836         LDKu8slice ser_ref;
24837         ser_ref.datalen = ser->arr_len;
24838         ser_ref.data = ser->elems;
24839         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
24840         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
24841         FREE(ser);
24842         return tag_ptr(ret_conv, true);
24843 }
24844
24845 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
24846         if (!ptr_is_owned(this_ptr)) return;
24847         void* this_ptr_ptr = untag_ptr(this_ptr);
24848         CHECK_ACCESS(this_ptr_ptr);
24849         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
24850         FREE(untag_ptr(this_ptr));
24851         MonitorEvent_free(this_ptr_conv);
24852 }
24853
24854 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
24855         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24856         *ret_copy = MonitorEvent_clone(arg);
24857         uint64_t ret_ref = tag_ptr(ret_copy, true);
24858         return ret_ref;
24859 }
24860 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
24861         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
24862         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
24863         return ret_conv;
24864 }
24865
24866 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
24867         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
24868         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24869         *ret_copy = MonitorEvent_clone(orig_conv);
24870         uint64_t ret_ref = tag_ptr(ret_copy, true);
24871         return ret_ref;
24872 }
24873
24874 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
24875         LDKHTLCUpdate a_conv;
24876         a_conv.inner = untag_ptr(a);
24877         a_conv.is_owned = ptr_is_owned(a);
24878         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24879         a_conv = HTLCUpdate_clone(&a_conv);
24880         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24881         *ret_copy = MonitorEvent_htlcevent(a_conv);
24882         uint64_t ret_ref = tag_ptr(ret_copy, true);
24883         return ret_ref;
24884 }
24885
24886 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
24887         LDKOutPoint a_conv;
24888         a_conv.inner = untag_ptr(a);
24889         a_conv.is_owned = ptr_is_owned(a);
24890         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24891         a_conv = OutPoint_clone(&a_conv);
24892         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24893         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
24894         uint64_t ret_ref = tag_ptr(ret_copy, true);
24895         return ret_ref;
24896 }
24897
24898 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
24899         LDKOutPoint funding_txo_conv;
24900         funding_txo_conv.inner = untag_ptr(funding_txo);
24901         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24902         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24903         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24904         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24905         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
24906         uint64_t ret_ref = tag_ptr(ret_copy, true);
24907         return ret_ref;
24908 }
24909
24910 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
24911         LDKOutPoint a_conv;
24912         a_conv.inner = untag_ptr(a);
24913         a_conv.is_owned = ptr_is_owned(a);
24914         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24915         a_conv = OutPoint_clone(&a_conv);
24916         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24917         *ret_copy = MonitorEvent_update_failed(a_conv);
24918         uint64_t ret_ref = tag_ptr(ret_copy, true);
24919         return ret_ref;
24920 }
24921
24922 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
24923         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
24924         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
24925         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
24926         return ret_conv;
24927 }
24928
24929 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
24930         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
24931         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
24932         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24933         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24934         CVec_u8Z_free(ret_var);
24935         return ret_arr;
24936 }
24937
24938 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
24939         LDKu8slice ser_ref;
24940         ser_ref.datalen = ser->arr_len;
24941         ser_ref.data = ser->elems;
24942         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
24943         *ret_conv = MonitorEvent_read(ser_ref);
24944         FREE(ser);
24945         return tag_ptr(ret_conv, true);
24946 }
24947
24948 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
24949         LDKHTLCUpdate this_obj_conv;
24950         this_obj_conv.inner = untag_ptr(this_obj);
24951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24953         HTLCUpdate_free(this_obj_conv);
24954 }
24955
24956 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
24957         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
24958         uint64_t ret_ref = 0;
24959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24961         return ret_ref;
24962 }
24963 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
24964         LDKHTLCUpdate arg_conv;
24965         arg_conv.inner = untag_ptr(arg);
24966         arg_conv.is_owned = ptr_is_owned(arg);
24967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24968         arg_conv.is_owned = false;
24969         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
24970         return ret_conv;
24971 }
24972
24973 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
24974         LDKHTLCUpdate orig_conv;
24975         orig_conv.inner = untag_ptr(orig);
24976         orig_conv.is_owned = ptr_is_owned(orig);
24977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24978         orig_conv.is_owned = false;
24979         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
24980         uint64_t ret_ref = 0;
24981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24983         return ret_ref;
24984 }
24985
24986 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
24987         LDKHTLCUpdate a_conv;
24988         a_conv.inner = untag_ptr(a);
24989         a_conv.is_owned = ptr_is_owned(a);
24990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24991         a_conv.is_owned = false;
24992         LDKHTLCUpdate b_conv;
24993         b_conv.inner = untag_ptr(b);
24994         b_conv.is_owned = ptr_is_owned(b);
24995         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24996         b_conv.is_owned = false;
24997         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
24998         return ret_conv;
24999 }
25000
25001 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25002         LDKHTLCUpdate obj_conv;
25003         obj_conv.inner = untag_ptr(obj);
25004         obj_conv.is_owned = ptr_is_owned(obj);
25005         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25006         obj_conv.is_owned = false;
25007         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25008         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25009         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25010         CVec_u8Z_free(ret_var);
25011         return ret_arr;
25012 }
25013
25014 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25015         LDKu8slice ser_ref;
25016         ser_ref.datalen = ser->arr_len;
25017         ser_ref.data = ser->elems;
25018         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25019         *ret_conv = HTLCUpdate_read(ser_ref);
25020         FREE(ser);
25021         return tag_ptr(ret_conv, true);
25022 }
25023
25024 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25025         if (!ptr_is_owned(this_ptr)) return;
25026         void* this_ptr_ptr = untag_ptr(this_ptr);
25027         CHECK_ACCESS(this_ptr_ptr);
25028         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25029         FREE(untag_ptr(this_ptr));
25030         Balance_free(this_ptr_conv);
25031 }
25032
25033 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25034         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25035         *ret_copy = Balance_clone(arg);
25036         uint64_t ret_ref = tag_ptr(ret_copy, true);
25037         return ret_ref;
25038 }
25039 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25040         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25041         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25042         return ret_conv;
25043 }
25044
25045 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25046         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25047         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25048         *ret_copy = Balance_clone(orig_conv);
25049         uint64_t ret_ref = tag_ptr(ret_copy, true);
25050         return ret_ref;
25051 }
25052
25053 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25054         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25055         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25056         uint64_t ret_ref = tag_ptr(ret_copy, true);
25057         return ret_ref;
25058 }
25059
25060 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25061         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25062         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25063         uint64_t ret_ref = tag_ptr(ret_copy, true);
25064         return ret_ref;
25065 }
25066
25067 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25068         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25069         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25070         uint64_t ret_ref = tag_ptr(ret_copy, true);
25071         return ret_ref;
25072 }
25073
25074 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) {
25075         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25076         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25077         uint64_t ret_ref = tag_ptr(ret_copy, true);
25078         return ret_ref;
25079 }
25080
25081 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) {
25082         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25083         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25084         uint64_t ret_ref = tag_ptr(ret_copy, true);
25085         return ret_ref;
25086 }
25087
25088 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25089         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25090         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25091         uint64_t ret_ref = tag_ptr(ret_copy, true);
25092         return ret_ref;
25093 }
25094
25095 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25096         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25097         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25098         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25099         return ret_conv;
25100 }
25101
25102 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25103         LDKChannelMonitor this_obj_conv;
25104         this_obj_conv.inner = untag_ptr(this_obj);
25105         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25107         ChannelMonitor_free(this_obj_conv);
25108 }
25109
25110 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25111         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25112         uint64_t ret_ref = 0;
25113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25115         return ret_ref;
25116 }
25117 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25118         LDKChannelMonitor arg_conv;
25119         arg_conv.inner = untag_ptr(arg);
25120         arg_conv.is_owned = ptr_is_owned(arg);
25121         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25122         arg_conv.is_owned = false;
25123         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25124         return ret_conv;
25125 }
25126
25127 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25128         LDKChannelMonitor orig_conv;
25129         orig_conv.inner = untag_ptr(orig);
25130         orig_conv.is_owned = ptr_is_owned(orig);
25131         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25132         orig_conv.is_owned = false;
25133         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25134         uint64_t ret_ref = 0;
25135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25137         return ret_ref;
25138 }
25139
25140 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25141         LDKChannelMonitor obj_conv;
25142         obj_conv.inner = untag_ptr(obj);
25143         obj_conv.is_owned = ptr_is_owned(obj);
25144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25145         obj_conv.is_owned = false;
25146         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25149         CVec_u8Z_free(ret_var);
25150         return ret_arr;
25151 }
25152
25153 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) {
25154         LDKChannelMonitor this_arg_conv;
25155         this_arg_conv.inner = untag_ptr(this_arg);
25156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25158         this_arg_conv.is_owned = false;
25159         LDKChannelMonitorUpdate updates_conv;
25160         updates_conv.inner = untag_ptr(updates);
25161         updates_conv.is_owned = ptr_is_owned(updates);
25162         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25163         updates_conv.is_owned = false;
25164         void* broadcaster_ptr = untag_ptr(broadcaster);
25165         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25166         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25167         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25168         CHECK_ACCESS(fee_estimator_ptr);
25169         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25170         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25171                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25172                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25173         }
25174         void* logger_ptr = untag_ptr(logger);
25175         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25176         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25177         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25178         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25179         return tag_ptr(ret_conv, true);
25180 }
25181
25182 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25183         LDKChannelMonitor this_arg_conv;
25184         this_arg_conv.inner = untag_ptr(this_arg);
25185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25187         this_arg_conv.is_owned = false;
25188         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25189         return ret_conv;
25190 }
25191
25192 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25193         LDKChannelMonitor this_arg_conv;
25194         this_arg_conv.inner = untag_ptr(this_arg);
25195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25197         this_arg_conv.is_owned = false;
25198         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25199         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25200         return tag_ptr(ret_conv, true);
25201 }
25202
25203 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25204         LDKChannelMonitor this_arg_conv;
25205         this_arg_conv.inner = untag_ptr(this_arg);
25206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25208         this_arg_conv.is_owned = false;
25209         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25210         uint64_tArray ret_arr = NULL;
25211         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25212         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25213         for (size_t o = 0; o < ret_var.datalen; o++) {
25214                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25215                 *ret_conv_40_conv = ret_var.data[o];
25216                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25217         }
25218         
25219         FREE(ret_var.data);
25220         return ret_arr;
25221 }
25222
25223 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25224         LDKChannelMonitor this_arg_conv;
25225         this_arg_conv.inner = untag_ptr(this_arg);
25226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25228         this_arg_conv.is_owned = false;
25229         void* filter_ptr = untag_ptr(filter);
25230         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25231         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25232         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25233 }
25234
25235 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) {
25236         LDKChannelMonitor this_arg_conv;
25237         this_arg_conv.inner = untag_ptr(this_arg);
25238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25240         this_arg_conv.is_owned = false;
25241         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25242         uint64_tArray ret_arr = NULL;
25243         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25244         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25245         for (size_t o = 0; o < ret_var.datalen; o++) {
25246                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25247                 *ret_conv_14_copy = ret_var.data[o];
25248                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25249                 ret_arr_ptr[o] = ret_conv_14_ref;
25250         }
25251         
25252         FREE(ret_var.data);
25253         return ret_arr;
25254 }
25255
25256 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25257         LDKChannelMonitor this_arg_conv;
25258         this_arg_conv.inner = untag_ptr(this_arg);
25259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25261         this_arg_conv.is_owned = false;
25262         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25263         uint64_tArray ret_arr = NULL;
25264         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25265         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25266         for (size_t h = 0; h < ret_var.datalen; h++) {
25267                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25268                 *ret_conv_7_copy = ret_var.data[h];
25269                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25270                 ret_arr_ptr[h] = ret_conv_7_ref;
25271         }
25272         
25273         FREE(ret_var.data);
25274         return ret_arr;
25275 }
25276
25277 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25278         LDKChannelMonitor this_arg_conv;
25279         this_arg_conv.inner = untag_ptr(this_arg);
25280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25282         this_arg_conv.is_owned = false;
25283         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25284         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25285         return ret_arr;
25286 }
25287
25288 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) {
25289         LDKChannelMonitor this_arg_conv;
25290         this_arg_conv.inner = untag_ptr(this_arg);
25291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25293         this_arg_conv.is_owned = false;
25294         void* logger_ptr = untag_ptr(logger);
25295         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25296         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25297         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25298         ptrArray ret_arr = NULL;
25299         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25300         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25301         for (size_t m = 0; m < ret_var.datalen; m++) {
25302                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25303                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25304                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25305                 Transaction_free(ret_conv_12_var);
25306                 ret_arr_ptr[m] = ret_conv_12_arr;
25307         }
25308         
25309         FREE(ret_var.data);
25310         return ret_arr;
25311 }
25312
25313 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) {
25314         LDKChannelMonitor this_arg_conv;
25315         this_arg_conv.inner = untag_ptr(this_arg);
25316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25318         this_arg_conv.is_owned = false;
25319         unsigned char header_arr[80];
25320         CHECK(header->arr_len == 80);
25321         memcpy(header_arr, header->elems, 80); FREE(header);
25322         unsigned char (*header_ref)[80] = &header_arr;
25323         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25324         txdata_constr.datalen = txdata->arr_len;
25325         if (txdata_constr.datalen > 0)
25326                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25327         else
25328                 txdata_constr.data = NULL;
25329         uint64_t* txdata_vals = txdata->elems;
25330         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25331                 uint64_t txdata_conv_28 = txdata_vals[c];
25332                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25333                 CHECK_ACCESS(txdata_conv_28_ptr);
25334                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25335                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25336                 txdata_constr.data[c] = txdata_conv_28_conv;
25337         }
25338         FREE(txdata);
25339         void* broadcaster_ptr = untag_ptr(broadcaster);
25340         CHECK_ACCESS(broadcaster_ptr);
25341         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25342         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25344                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25345         }
25346         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25347         CHECK_ACCESS(fee_estimator_ptr);
25348         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25349         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25350                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25351                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25352         }
25353         void* logger_ptr = untag_ptr(logger);
25354         CHECK_ACCESS(logger_ptr);
25355         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25356         if (logger_conv.free == LDKLogger_JCalls_free) {
25357                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25358                 LDKLogger_JCalls_cloned(&logger_conv);
25359         }
25360         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);
25361         uint64_tArray ret_arr = NULL;
25362         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25363         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25364         for (size_t n = 0; n < ret_var.datalen; n++) {
25365                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25366                 *ret_conv_39_conv = ret_var.data[n];
25367                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25368         }
25369         
25370         FREE(ret_var.data);
25371         return ret_arr;
25372 }
25373
25374 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) {
25375         LDKChannelMonitor this_arg_conv;
25376         this_arg_conv.inner = untag_ptr(this_arg);
25377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25379         this_arg_conv.is_owned = false;
25380         unsigned char header_arr[80];
25381         CHECK(header->arr_len == 80);
25382         memcpy(header_arr, header->elems, 80); FREE(header);
25383         unsigned char (*header_ref)[80] = &header_arr;
25384         void* broadcaster_ptr = untag_ptr(broadcaster);
25385         CHECK_ACCESS(broadcaster_ptr);
25386         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25387         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25389                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25390         }
25391         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25392         CHECK_ACCESS(fee_estimator_ptr);
25393         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25394         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25396                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25397         }
25398         void* logger_ptr = untag_ptr(logger);
25399         CHECK_ACCESS(logger_ptr);
25400         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25401         if (logger_conv.free == LDKLogger_JCalls_free) {
25402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25403                 LDKLogger_JCalls_cloned(&logger_conv);
25404         }
25405         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25406 }
25407
25408 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) {
25409         LDKChannelMonitor this_arg_conv;
25410         this_arg_conv.inner = untag_ptr(this_arg);
25411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25413         this_arg_conv.is_owned = false;
25414         unsigned char header_arr[80];
25415         CHECK(header->arr_len == 80);
25416         memcpy(header_arr, header->elems, 80); FREE(header);
25417         unsigned char (*header_ref)[80] = &header_arr;
25418         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25419         txdata_constr.datalen = txdata->arr_len;
25420         if (txdata_constr.datalen > 0)
25421                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25422         else
25423                 txdata_constr.data = NULL;
25424         uint64_t* txdata_vals = txdata->elems;
25425         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25426                 uint64_t txdata_conv_28 = txdata_vals[c];
25427                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25428                 CHECK_ACCESS(txdata_conv_28_ptr);
25429                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25430                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25431                 txdata_constr.data[c] = txdata_conv_28_conv;
25432         }
25433         FREE(txdata);
25434         void* broadcaster_ptr = untag_ptr(broadcaster);
25435         CHECK_ACCESS(broadcaster_ptr);
25436         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25437         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25438                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25439                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25440         }
25441         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25442         CHECK_ACCESS(fee_estimator_ptr);
25443         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25444         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25446                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25447         }
25448         void* logger_ptr = untag_ptr(logger);
25449         CHECK_ACCESS(logger_ptr);
25450         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25451         if (logger_conv.free == LDKLogger_JCalls_free) {
25452                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25453                 LDKLogger_JCalls_cloned(&logger_conv);
25454         }
25455         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);
25456         uint64_tArray ret_arr = NULL;
25457         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25458         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25459         for (size_t n = 0; n < ret_var.datalen; n++) {
25460                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25461                 *ret_conv_39_conv = ret_var.data[n];
25462                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25463         }
25464         
25465         FREE(ret_var.data);
25466         return ret_arr;
25467 }
25468
25469 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) {
25470         LDKChannelMonitor this_arg_conv;
25471         this_arg_conv.inner = untag_ptr(this_arg);
25472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25474         this_arg_conv.is_owned = false;
25475         unsigned char txid_arr[32];
25476         CHECK(txid->arr_len == 32);
25477         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25478         unsigned char (*txid_ref)[32] = &txid_arr;
25479         void* broadcaster_ptr = untag_ptr(broadcaster);
25480         CHECK_ACCESS(broadcaster_ptr);
25481         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25482         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25484                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25485         }
25486         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25487         CHECK_ACCESS(fee_estimator_ptr);
25488         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25489         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25490                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25491                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25492         }
25493         void* logger_ptr = untag_ptr(logger);
25494         CHECK_ACCESS(logger_ptr);
25495         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25496         if (logger_conv.free == LDKLogger_JCalls_free) {
25497                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25498                 LDKLogger_JCalls_cloned(&logger_conv);
25499         }
25500         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25501 }
25502
25503 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) {
25504         LDKChannelMonitor this_arg_conv;
25505         this_arg_conv.inner = untag_ptr(this_arg);
25506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25508         this_arg_conv.is_owned = false;
25509         unsigned char header_arr[80];
25510         CHECK(header->arr_len == 80);
25511         memcpy(header_arr, header->elems, 80); FREE(header);
25512         unsigned char (*header_ref)[80] = &header_arr;
25513         void* broadcaster_ptr = untag_ptr(broadcaster);
25514         CHECK_ACCESS(broadcaster_ptr);
25515         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25516         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25517                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25518                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25519         }
25520         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25521         CHECK_ACCESS(fee_estimator_ptr);
25522         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25523         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25524                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25525                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25526         }
25527         void* logger_ptr = untag_ptr(logger);
25528         CHECK_ACCESS(logger_ptr);
25529         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25530         if (logger_conv.free == LDKLogger_JCalls_free) {
25531                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25532                 LDKLogger_JCalls_cloned(&logger_conv);
25533         }
25534         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25535         uint64_tArray ret_arr = NULL;
25536         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25537         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25538         for (size_t n = 0; n < ret_var.datalen; n++) {
25539                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25540                 *ret_conv_39_conv = ret_var.data[n];
25541                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25542         }
25543         
25544         FREE(ret_var.data);
25545         return ret_arr;
25546 }
25547
25548 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25549         LDKChannelMonitor this_arg_conv;
25550         this_arg_conv.inner = untag_ptr(this_arg);
25551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25553         this_arg_conv.is_owned = false;
25554         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25555         uint64_tArray ret_arr = NULL;
25556         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25557         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25558         for (size_t z = 0; z < ret_var.datalen; z++) {
25559                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25560                 *ret_conv_25_conv = ret_var.data[z];
25561                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25562         }
25563         
25564         FREE(ret_var.data);
25565         return ret_arr;
25566 }
25567
25568 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25569         LDKChannelMonitor this_arg_conv;
25570         this_arg_conv.inner = untag_ptr(this_arg);
25571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25573         this_arg_conv.is_owned = false;
25574         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25575         uint64_t ret_ref = 0;
25576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25578         return ret_ref;
25579 }
25580
25581 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25582         LDKChannelMonitor this_arg_conv;
25583         this_arg_conv.inner = untag_ptr(this_arg);
25584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25586         this_arg_conv.is_owned = false;
25587         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25588         uint64_tArray ret_arr = NULL;
25589         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25590         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25591         for (size_t j = 0; j < ret_var.datalen; j++) {
25592                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25593                 *ret_conv_9_copy = ret_var.data[j];
25594                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25595                 ret_arr_ptr[j] = ret_conv_9_ref;
25596         }
25597         
25598         FREE(ret_var.data);
25599         return ret_arr;
25600 }
25601
25602 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
25603         LDKu8slice ser_ref;
25604         ser_ref.datalen = ser->arr_len;
25605         ser_ref.data = ser->elems;
25606         void* arg_ptr = untag_ptr(arg);
25607         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25608         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
25609         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25610         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
25611         FREE(ser);
25612         return tag_ptr(ret_conv, true);
25613 }
25614
25615 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25616         LDKOutPoint this_obj_conv;
25617         this_obj_conv.inner = untag_ptr(this_obj);
25618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25620         OutPoint_free(this_obj_conv);
25621 }
25622
25623 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25624         LDKOutPoint this_ptr_conv;
25625         this_ptr_conv.inner = untag_ptr(this_ptr);
25626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25628         this_ptr_conv.is_owned = false;
25629         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25630         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25631         return ret_arr;
25632 }
25633
25634 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25635         LDKOutPoint this_ptr_conv;
25636         this_ptr_conv.inner = untag_ptr(this_ptr);
25637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25639         this_ptr_conv.is_owned = false;
25640         LDKThirtyTwoBytes val_ref;
25641         CHECK(val->arr_len == 32);
25642         memcpy(val_ref.data, val->elems, 32); FREE(val);
25643         OutPoint_set_txid(&this_ptr_conv, val_ref);
25644 }
25645
25646 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25647         LDKOutPoint this_ptr_conv;
25648         this_ptr_conv.inner = untag_ptr(this_ptr);
25649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25651         this_ptr_conv.is_owned = false;
25652         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25653         return ret_conv;
25654 }
25655
25656 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25657         LDKOutPoint this_ptr_conv;
25658         this_ptr_conv.inner = untag_ptr(this_ptr);
25659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25661         this_ptr_conv.is_owned = false;
25662         OutPoint_set_index(&this_ptr_conv, val);
25663 }
25664
25665 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25666         LDKThirtyTwoBytes txid_arg_ref;
25667         CHECK(txid_arg->arr_len == 32);
25668         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25669         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25670         uint64_t ret_ref = 0;
25671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25673         return ret_ref;
25674 }
25675
25676 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25677         LDKOutPoint ret_var = OutPoint_clone(arg);
25678         uint64_t ret_ref = 0;
25679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25681         return ret_ref;
25682 }
25683 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25684         LDKOutPoint arg_conv;
25685         arg_conv.inner = untag_ptr(arg);
25686         arg_conv.is_owned = ptr_is_owned(arg);
25687         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25688         arg_conv.is_owned = false;
25689         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25690         return ret_conv;
25691 }
25692
25693 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25694         LDKOutPoint orig_conv;
25695         orig_conv.inner = untag_ptr(orig);
25696         orig_conv.is_owned = ptr_is_owned(orig);
25697         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25698         orig_conv.is_owned = false;
25699         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25700         uint64_t ret_ref = 0;
25701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25703         return ret_ref;
25704 }
25705
25706 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25707         LDKOutPoint a_conv;
25708         a_conv.inner = untag_ptr(a);
25709         a_conv.is_owned = ptr_is_owned(a);
25710         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25711         a_conv.is_owned = false;
25712         LDKOutPoint b_conv;
25713         b_conv.inner = untag_ptr(b);
25714         b_conv.is_owned = ptr_is_owned(b);
25715         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25716         b_conv.is_owned = false;
25717         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25718         return ret_conv;
25719 }
25720
25721 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25722         LDKOutPoint o_conv;
25723         o_conv.inner = untag_ptr(o);
25724         o_conv.is_owned = ptr_is_owned(o);
25725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25726         o_conv.is_owned = false;
25727         int64_t ret_conv = OutPoint_hash(&o_conv);
25728         return ret_conv;
25729 }
25730
25731 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25732         LDKOutPoint this_arg_conv;
25733         this_arg_conv.inner = untag_ptr(this_arg);
25734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25736         this_arg_conv.is_owned = false;
25737         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25738         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25739         return ret_arr;
25740 }
25741
25742 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25743         LDKOutPoint obj_conv;
25744         obj_conv.inner = untag_ptr(obj);
25745         obj_conv.is_owned = ptr_is_owned(obj);
25746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25747         obj_conv.is_owned = false;
25748         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
25749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25751         CVec_u8Z_free(ret_var);
25752         return ret_arr;
25753 }
25754
25755 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
25756         LDKu8slice ser_ref;
25757         ser_ref.datalen = ser->arr_len;
25758         ser_ref.data = ser->elems;
25759         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
25760         *ret_conv = OutPoint_read(ser_ref);
25761         FREE(ser);
25762         return tag_ptr(ret_conv, true);
25763 }
25764
25765 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
25766         LDKDelayedPaymentOutputDescriptor this_obj_conv;
25767         this_obj_conv.inner = untag_ptr(this_obj);
25768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25770         DelayedPaymentOutputDescriptor_free(this_obj_conv);
25771 }
25772
25773 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
25774         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25775         this_ptr_conv.inner = untag_ptr(this_ptr);
25776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25778         this_ptr_conv.is_owned = false;
25779         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
25780         uint64_t ret_ref = 0;
25781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25783         return ret_ref;
25784 }
25785
25786 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
25787         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25788         this_ptr_conv.inner = untag_ptr(this_ptr);
25789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25791         this_ptr_conv.is_owned = false;
25792         LDKOutPoint val_conv;
25793         val_conv.inner = untag_ptr(val);
25794         val_conv.is_owned = ptr_is_owned(val);
25795         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25796         val_conv = OutPoint_clone(&val_conv);
25797         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
25798 }
25799
25800 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
25801         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25802         this_ptr_conv.inner = untag_ptr(this_ptr);
25803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25805         this_ptr_conv.is_owned = false;
25806         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25807         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
25808         return ret_arr;
25809 }
25810
25811 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
25812         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25813         this_ptr_conv.inner = untag_ptr(this_ptr);
25814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25816         this_ptr_conv.is_owned = false;
25817         LDKPublicKey val_ref;
25818         CHECK(val->arr_len == 33);
25819         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25820         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
25821 }
25822
25823 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
25824         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25825         this_ptr_conv.inner = untag_ptr(this_ptr);
25826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25828         this_ptr_conv.is_owned = false;
25829         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
25830         return ret_conv;
25831 }
25832
25833 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
25834         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25835         this_ptr_conv.inner = untag_ptr(this_ptr);
25836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25838         this_ptr_conv.is_owned = false;
25839         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
25840 }
25841
25842 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
25843         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25844         this_ptr_conv.inner = untag_ptr(this_ptr);
25845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25847         this_ptr_conv.is_owned = false;
25848         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
25849         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
25850         return tag_ptr(ret_ref, true);
25851 }
25852
25853 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
25854         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25855         this_ptr_conv.inner = untag_ptr(this_ptr);
25856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25858         this_ptr_conv.is_owned = false;
25859         void* val_ptr = untag_ptr(val);
25860         CHECK_ACCESS(val_ptr);
25861         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
25862         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
25863         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
25864 }
25865
25866 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
25867         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25868         this_ptr_conv.inner = untag_ptr(this_ptr);
25869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25871         this_ptr_conv.is_owned = false;
25872         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25873         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
25874         return ret_arr;
25875 }
25876
25877 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
25878         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25879         this_ptr_conv.inner = untag_ptr(this_ptr);
25880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25882         this_ptr_conv.is_owned = false;
25883         LDKPublicKey val_ref;
25884         CHECK(val->arr_len == 33);
25885         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25886         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
25887 }
25888
25889 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
25890         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25891         this_ptr_conv.inner = untag_ptr(this_ptr);
25892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25894         this_ptr_conv.is_owned = false;
25895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25896         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
25897         return ret_arr;
25898 }
25899
25900 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
25901         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25902         this_ptr_conv.inner = untag_ptr(this_ptr);
25903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25905         this_ptr_conv.is_owned = false;
25906         LDKThirtyTwoBytes val_ref;
25907         CHECK(val->arr_len == 32);
25908         memcpy(val_ref.data, val->elems, 32); FREE(val);
25909         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25910 }
25911
25912 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25913         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25914         this_ptr_conv.inner = untag_ptr(this_ptr);
25915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25917         this_ptr_conv.is_owned = false;
25918         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25919         return ret_conv;
25920 }
25921
25922 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25923         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25924         this_ptr_conv.inner = untag_ptr(this_ptr);
25925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25927         this_ptr_conv.is_owned = false;
25928         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25929 }
25930
25931 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) {
25932         LDKOutPoint outpoint_arg_conv;
25933         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25934         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25935         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25936         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25937         LDKPublicKey per_commitment_point_arg_ref;
25938         CHECK(per_commitment_point_arg->arr_len == 33);
25939         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
25940         void* output_arg_ptr = untag_ptr(output_arg);
25941         CHECK_ACCESS(output_arg_ptr);
25942         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25943         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25944         LDKPublicKey revocation_pubkey_arg_ref;
25945         CHECK(revocation_pubkey_arg->arr_len == 33);
25946         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
25947         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25948         CHECK(channel_keys_id_arg->arr_len == 32);
25949         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25950         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);
25951         uint64_t ret_ref = 0;
25952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25954         return ret_ref;
25955 }
25956
25957 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
25958         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
25959         uint64_t ret_ref = 0;
25960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25962         return ret_ref;
25963 }
25964 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25965         LDKDelayedPaymentOutputDescriptor arg_conv;
25966         arg_conv.inner = untag_ptr(arg);
25967         arg_conv.is_owned = ptr_is_owned(arg);
25968         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25969         arg_conv.is_owned = false;
25970         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
25971         return ret_conv;
25972 }
25973
25974 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
25975         LDKDelayedPaymentOutputDescriptor orig_conv;
25976         orig_conv.inner = untag_ptr(orig);
25977         orig_conv.is_owned = ptr_is_owned(orig);
25978         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25979         orig_conv.is_owned = false;
25980         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
25981         uint64_t ret_ref = 0;
25982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25984         return ret_ref;
25985 }
25986
25987 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25988         LDKDelayedPaymentOutputDescriptor a_conv;
25989         a_conv.inner = untag_ptr(a);
25990         a_conv.is_owned = ptr_is_owned(a);
25991         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25992         a_conv.is_owned = false;
25993         LDKDelayedPaymentOutputDescriptor b_conv;
25994         b_conv.inner = untag_ptr(b);
25995         b_conv.is_owned = ptr_is_owned(b);
25996         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25997         b_conv.is_owned = false;
25998         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
25999         return ret_conv;
26000 }
26001
26002 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26003         LDKDelayedPaymentOutputDescriptor obj_conv;
26004         obj_conv.inner = untag_ptr(obj);
26005         obj_conv.is_owned = ptr_is_owned(obj);
26006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26007         obj_conv.is_owned = false;
26008         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26011         CVec_u8Z_free(ret_var);
26012         return ret_arr;
26013 }
26014
26015 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26016         LDKu8slice ser_ref;
26017         ser_ref.datalen = ser->arr_len;
26018         ser_ref.data = ser->elems;
26019         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26020         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26021         FREE(ser);
26022         return tag_ptr(ret_conv, true);
26023 }
26024
26025 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26026         LDKStaticPaymentOutputDescriptor this_obj_conv;
26027         this_obj_conv.inner = untag_ptr(this_obj);
26028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26030         StaticPaymentOutputDescriptor_free(this_obj_conv);
26031 }
26032
26033 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26034         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26035         this_ptr_conv.inner = untag_ptr(this_ptr);
26036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26038         this_ptr_conv.is_owned = false;
26039         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26040         uint64_t ret_ref = 0;
26041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26043         return ret_ref;
26044 }
26045
26046 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26047         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26048         this_ptr_conv.inner = untag_ptr(this_ptr);
26049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26051         this_ptr_conv.is_owned = false;
26052         LDKOutPoint val_conv;
26053         val_conv.inner = untag_ptr(val);
26054         val_conv.is_owned = ptr_is_owned(val);
26055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26056         val_conv = OutPoint_clone(&val_conv);
26057         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26058 }
26059
26060 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26061         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26062         this_ptr_conv.inner = untag_ptr(this_ptr);
26063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26065         this_ptr_conv.is_owned = false;
26066         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26067         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26068         return tag_ptr(ret_ref, true);
26069 }
26070
26071 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26072         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26073         this_ptr_conv.inner = untag_ptr(this_ptr);
26074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26076         this_ptr_conv.is_owned = false;
26077         void* val_ptr = untag_ptr(val);
26078         CHECK_ACCESS(val_ptr);
26079         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26080         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26081         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26082 }
26083
26084 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26085         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26086         this_ptr_conv.inner = untag_ptr(this_ptr);
26087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26089         this_ptr_conv.is_owned = false;
26090         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26091         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26092         return ret_arr;
26093 }
26094
26095 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26096         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26097         this_ptr_conv.inner = untag_ptr(this_ptr);
26098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26100         this_ptr_conv.is_owned = false;
26101         LDKThirtyTwoBytes val_ref;
26102         CHECK(val->arr_len == 32);
26103         memcpy(val_ref.data, val->elems, 32); FREE(val);
26104         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26105 }
26106
26107 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26108         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26109         this_ptr_conv.inner = untag_ptr(this_ptr);
26110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26112         this_ptr_conv.is_owned = false;
26113         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26114         return ret_conv;
26115 }
26116
26117 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26118         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26119         this_ptr_conv.inner = untag_ptr(this_ptr);
26120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26122         this_ptr_conv.is_owned = false;
26123         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26124 }
26125
26126 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) {
26127         LDKOutPoint outpoint_arg_conv;
26128         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26129         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26130         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26131         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26132         void* output_arg_ptr = untag_ptr(output_arg);
26133         CHECK_ACCESS(output_arg_ptr);
26134         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26135         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26136         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26137         CHECK(channel_keys_id_arg->arr_len == 32);
26138         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26139         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26140         uint64_t ret_ref = 0;
26141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26143         return ret_ref;
26144 }
26145
26146 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26147         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26148         uint64_t ret_ref = 0;
26149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26151         return ret_ref;
26152 }
26153 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26154         LDKStaticPaymentOutputDescriptor arg_conv;
26155         arg_conv.inner = untag_ptr(arg);
26156         arg_conv.is_owned = ptr_is_owned(arg);
26157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26158         arg_conv.is_owned = false;
26159         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26160         return ret_conv;
26161 }
26162
26163 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26164         LDKStaticPaymentOutputDescriptor orig_conv;
26165         orig_conv.inner = untag_ptr(orig);
26166         orig_conv.is_owned = ptr_is_owned(orig);
26167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26168         orig_conv.is_owned = false;
26169         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26170         uint64_t ret_ref = 0;
26171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26173         return ret_ref;
26174 }
26175
26176 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26177         LDKStaticPaymentOutputDescriptor a_conv;
26178         a_conv.inner = untag_ptr(a);
26179         a_conv.is_owned = ptr_is_owned(a);
26180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26181         a_conv.is_owned = false;
26182         LDKStaticPaymentOutputDescriptor b_conv;
26183         b_conv.inner = untag_ptr(b);
26184         b_conv.is_owned = ptr_is_owned(b);
26185         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26186         b_conv.is_owned = false;
26187         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26188         return ret_conv;
26189 }
26190
26191 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26192         LDKStaticPaymentOutputDescriptor obj_conv;
26193         obj_conv.inner = untag_ptr(obj);
26194         obj_conv.is_owned = ptr_is_owned(obj);
26195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26196         obj_conv.is_owned = false;
26197         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26200         CVec_u8Z_free(ret_var);
26201         return ret_arr;
26202 }
26203
26204 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26205         LDKu8slice ser_ref;
26206         ser_ref.datalen = ser->arr_len;
26207         ser_ref.data = ser->elems;
26208         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26209         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26210         FREE(ser);
26211         return tag_ptr(ret_conv, true);
26212 }
26213
26214 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26215         if (!ptr_is_owned(this_ptr)) return;
26216         void* this_ptr_ptr = untag_ptr(this_ptr);
26217         CHECK_ACCESS(this_ptr_ptr);
26218         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26219         FREE(untag_ptr(this_ptr));
26220         SpendableOutputDescriptor_free(this_ptr_conv);
26221 }
26222
26223 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26224         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26225         *ret_copy = SpendableOutputDescriptor_clone(arg);
26226         uint64_t ret_ref = tag_ptr(ret_copy, true);
26227         return ret_ref;
26228 }
26229 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26230         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26231         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26232         return ret_conv;
26233 }
26234
26235 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26236         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26237         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26238         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26239         uint64_t ret_ref = tag_ptr(ret_copy, true);
26240         return ret_ref;
26241 }
26242
26243 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26244         LDKOutPoint outpoint_conv;
26245         outpoint_conv.inner = untag_ptr(outpoint);
26246         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26247         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26248         outpoint_conv = OutPoint_clone(&outpoint_conv);
26249         void* output_ptr = untag_ptr(output);
26250         CHECK_ACCESS(output_ptr);
26251         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26252         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26253         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26254         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26255         uint64_t ret_ref = tag_ptr(ret_copy, true);
26256         return ret_ref;
26257 }
26258
26259 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26260         LDKDelayedPaymentOutputDescriptor a_conv;
26261         a_conv.inner = untag_ptr(a);
26262         a_conv.is_owned = ptr_is_owned(a);
26263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26264         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26265         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26266         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26267         uint64_t ret_ref = tag_ptr(ret_copy, true);
26268         return ret_ref;
26269 }
26270
26271 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26272         LDKStaticPaymentOutputDescriptor a_conv;
26273         a_conv.inner = untag_ptr(a);
26274         a_conv.is_owned = ptr_is_owned(a);
26275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26276         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26277         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26278         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26279         uint64_t ret_ref = tag_ptr(ret_copy, true);
26280         return ret_ref;
26281 }
26282
26283 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26284         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26285         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26286         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26287         return ret_conv;
26288 }
26289
26290 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26291         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26292         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26295         CVec_u8Z_free(ret_var);
26296         return ret_arr;
26297 }
26298
26299 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26300         LDKu8slice ser_ref;
26301         ser_ref.datalen = ser->arr_len;
26302         ser_ref.data = ser->elems;
26303         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26304         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26305         FREE(ser);
26306         return tag_ptr(ret_conv, true);
26307 }
26308
26309 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
26310         if (!ptr_is_owned(this_ptr)) return;
26311         void* this_ptr_ptr = untag_ptr(this_ptr);
26312         CHECK_ACCESS(this_ptr_ptr);
26313         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
26314         FREE(untag_ptr(this_ptr));
26315         BaseSign_free(this_ptr_conv);
26316 }
26317
26318 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
26319         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26320         *ret_ret = Sign_clone(arg);
26321         return tag_ptr(ret_ret, true);
26322 }
26323 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
26324         void* arg_ptr = untag_ptr(arg);
26325         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26326         LDKSign* arg_conv = (LDKSign*)arg_ptr;
26327         int64_t ret_conv = Sign_clone_ptr(arg_conv);
26328         return ret_conv;
26329 }
26330
26331 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
26332         void* orig_ptr = untag_ptr(orig);
26333         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26334         LDKSign* orig_conv = (LDKSign*)orig_ptr;
26335         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26336         *ret_ret = Sign_clone(orig_conv);
26337         return tag_ptr(ret_ret, true);
26338 }
26339
26340 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
26341         if (!ptr_is_owned(this_ptr)) return;
26342         void* this_ptr_ptr = untag_ptr(this_ptr);
26343         CHECK_ACCESS(this_ptr_ptr);
26344         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
26345         FREE(untag_ptr(this_ptr));
26346         Sign_free(this_ptr_conv);
26347 }
26348
26349 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26350         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26351         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26352         return ret_conv;
26353 }
26354
26355 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26356         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26357         return ret_conv;
26358 }
26359
26360 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26361         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26362         return ret_conv;
26363 }
26364
26365 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
26366         if (!ptr_is_owned(this_ptr)) return;
26367         void* this_ptr_ptr = untag_ptr(this_ptr);
26368         CHECK_ACCESS(this_ptr_ptr);
26369         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
26370         FREE(untag_ptr(this_ptr));
26371         KeysInterface_free(this_ptr_conv);
26372 }
26373
26374 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26375         LDKInMemorySigner this_obj_conv;
26376         this_obj_conv.inner = untag_ptr(this_obj);
26377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26379         InMemorySigner_free(this_obj_conv);
26380 }
26381
26382 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26383         LDKInMemorySigner this_ptr_conv;
26384         this_ptr_conv.inner = untag_ptr(this_ptr);
26385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26387         this_ptr_conv.is_owned = false;
26388         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26389         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26390         return ret_arr;
26391 }
26392
26393 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26394         LDKInMemorySigner this_ptr_conv;
26395         this_ptr_conv.inner = untag_ptr(this_ptr);
26396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26398         this_ptr_conv.is_owned = false;
26399         LDKSecretKey val_ref;
26400         CHECK(val->arr_len == 32);
26401         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26402         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26403 }
26404
26405 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26406         LDKInMemorySigner this_ptr_conv;
26407         this_ptr_conv.inner = untag_ptr(this_ptr);
26408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26410         this_ptr_conv.is_owned = false;
26411         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26412         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26413         return ret_arr;
26414 }
26415
26416 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26417         LDKInMemorySigner this_ptr_conv;
26418         this_ptr_conv.inner = untag_ptr(this_ptr);
26419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26421         this_ptr_conv.is_owned = false;
26422         LDKSecretKey val_ref;
26423         CHECK(val->arr_len == 32);
26424         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26425         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26426 }
26427
26428 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26429         LDKInMemorySigner this_ptr_conv;
26430         this_ptr_conv.inner = untag_ptr(this_ptr);
26431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26433         this_ptr_conv.is_owned = false;
26434         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26435         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26436         return ret_arr;
26437 }
26438
26439 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26440         LDKInMemorySigner this_ptr_conv;
26441         this_ptr_conv.inner = untag_ptr(this_ptr);
26442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26444         this_ptr_conv.is_owned = false;
26445         LDKSecretKey val_ref;
26446         CHECK(val->arr_len == 32);
26447         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26448         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26449 }
26450
26451 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26452         LDKInMemorySigner this_ptr_conv;
26453         this_ptr_conv.inner = untag_ptr(this_ptr);
26454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26456         this_ptr_conv.is_owned = false;
26457         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26458         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26459         return ret_arr;
26460 }
26461
26462 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) {
26463         LDKInMemorySigner this_ptr_conv;
26464         this_ptr_conv.inner = untag_ptr(this_ptr);
26465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26467         this_ptr_conv.is_owned = false;
26468         LDKSecretKey val_ref;
26469         CHECK(val->arr_len == 32);
26470         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26471         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26472 }
26473
26474 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26475         LDKInMemorySigner this_ptr_conv;
26476         this_ptr_conv.inner = untag_ptr(this_ptr);
26477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26479         this_ptr_conv.is_owned = false;
26480         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26481         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26482         return ret_arr;
26483 }
26484
26485 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26486         LDKInMemorySigner this_ptr_conv;
26487         this_ptr_conv.inner = untag_ptr(this_ptr);
26488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26490         this_ptr_conv.is_owned = false;
26491         LDKSecretKey val_ref;
26492         CHECK(val->arr_len == 32);
26493         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26494         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26495 }
26496
26497 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26498         LDKInMemorySigner this_ptr_conv;
26499         this_ptr_conv.inner = untag_ptr(this_ptr);
26500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26502         this_ptr_conv.is_owned = false;
26503         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26504         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26505         return ret_arr;
26506 }
26507
26508 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26509         LDKInMemorySigner this_ptr_conv;
26510         this_ptr_conv.inner = untag_ptr(this_ptr);
26511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26513         this_ptr_conv.is_owned = false;
26514         LDKThirtyTwoBytes val_ref;
26515         CHECK(val->arr_len == 32);
26516         memcpy(val_ref.data, val->elems, 32); FREE(val);
26517         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26518 }
26519
26520 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26521         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26522         uint64_t ret_ref = 0;
26523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26525         return ret_ref;
26526 }
26527 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26528         LDKInMemorySigner arg_conv;
26529         arg_conv.inner = untag_ptr(arg);
26530         arg_conv.is_owned = ptr_is_owned(arg);
26531         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26532         arg_conv.is_owned = false;
26533         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26534         return ret_conv;
26535 }
26536
26537 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26538         LDKInMemorySigner orig_conv;
26539         orig_conv.inner = untag_ptr(orig);
26540         orig_conv.is_owned = ptr_is_owned(orig);
26541         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26542         orig_conv.is_owned = false;
26543         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26544         uint64_t ret_ref = 0;
26545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26547         return ret_ref;
26548 }
26549
26550 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) {
26551         LDKSecretKey node_secret_ref;
26552         CHECK(node_secret->arr_len == 32);
26553         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
26554         LDKSecretKey funding_key_ref;
26555         CHECK(funding_key->arr_len == 32);
26556         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26557         LDKSecretKey revocation_base_key_ref;
26558         CHECK(revocation_base_key->arr_len == 32);
26559         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26560         LDKSecretKey payment_key_ref;
26561         CHECK(payment_key->arr_len == 32);
26562         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26563         LDKSecretKey delayed_payment_base_key_ref;
26564         CHECK(delayed_payment_base_key->arr_len == 32);
26565         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26566         LDKSecretKey htlc_base_key_ref;
26567         CHECK(htlc_base_key->arr_len == 32);
26568         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26569         LDKThirtyTwoBytes commitment_seed_ref;
26570         CHECK(commitment_seed->arr_len == 32);
26571         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26572         LDKThirtyTwoBytes channel_keys_id_ref;
26573         CHECK(channel_keys_id->arr_len == 32);
26574         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26575         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);
26576         uint64_t ret_ref = 0;
26577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26579         return ret_ref;
26580 }
26581
26582 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26583         LDKInMemorySigner this_arg_conv;
26584         this_arg_conv.inner = untag_ptr(this_arg);
26585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26587         this_arg_conv.is_owned = false;
26588         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26589         uint64_t ret_ref = 0;
26590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26592         return ret_ref;
26593 }
26594
26595 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
26596         LDKInMemorySigner this_arg_conv;
26597         this_arg_conv.inner = untag_ptr(this_arg);
26598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26600         this_arg_conv.is_owned = false;
26601         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26602         return ret_conv;
26603 }
26604
26605 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
26606         LDKInMemorySigner this_arg_conv;
26607         this_arg_conv.inner = untag_ptr(this_arg);
26608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26610         this_arg_conv.is_owned = false;
26611         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26612         return ret_conv;
26613 }
26614
26615 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
26616         LDKInMemorySigner this_arg_conv;
26617         this_arg_conv.inner = untag_ptr(this_arg);
26618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26620         this_arg_conv.is_owned = false;
26621         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26622         return ret_conv;
26623 }
26624
26625 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
26626         LDKInMemorySigner this_arg_conv;
26627         this_arg_conv.inner = untag_ptr(this_arg);
26628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26630         this_arg_conv.is_owned = false;
26631         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26632         uint64_t ret_ref = 0;
26633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26635         return ret_ref;
26636 }
26637
26638 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26639         LDKInMemorySigner this_arg_conv;
26640         this_arg_conv.inner = untag_ptr(this_arg);
26641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26643         this_arg_conv.is_owned = false;
26644         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26645         uint64_t ret_ref = 0;
26646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26648         return ret_ref;
26649 }
26650
26651 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26652         LDKInMemorySigner this_arg_conv;
26653         this_arg_conv.inner = untag_ptr(this_arg);
26654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26656         this_arg_conv.is_owned = false;
26657         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26658         return ret_conv;
26659 }
26660
26661 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) {
26662         LDKInMemorySigner this_arg_conv;
26663         this_arg_conv.inner = untag_ptr(this_arg);
26664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26666         this_arg_conv.is_owned = false;
26667         LDKTransaction spend_tx_ref;
26668         spend_tx_ref.datalen = spend_tx->arr_len;
26669         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26670         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26671         spend_tx_ref.data_is_owned = true;
26672         LDKStaticPaymentOutputDescriptor descriptor_conv;
26673         descriptor_conv.inner = untag_ptr(descriptor);
26674         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26675         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26676         descriptor_conv.is_owned = false;
26677         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26678         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26679         return tag_ptr(ret_conv, true);
26680 }
26681
26682 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) {
26683         LDKInMemorySigner this_arg_conv;
26684         this_arg_conv.inner = untag_ptr(this_arg);
26685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26687         this_arg_conv.is_owned = false;
26688         LDKTransaction spend_tx_ref;
26689         spend_tx_ref.datalen = spend_tx->arr_len;
26690         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26691         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26692         spend_tx_ref.data_is_owned = true;
26693         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26694         descriptor_conv.inner = untag_ptr(descriptor);
26695         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26696         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26697         descriptor_conv.is_owned = false;
26698         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26699         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26700         return tag_ptr(ret_conv, true);
26701 }
26702
26703 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
26704         LDKInMemorySigner this_arg_conv;
26705         this_arg_conv.inner = untag_ptr(this_arg);
26706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26708         this_arg_conv.is_owned = false;
26709         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
26710         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
26711         return tag_ptr(ret_ret, true);
26712 }
26713
26714 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
26715         LDKInMemorySigner this_arg_conv;
26716         this_arg_conv.inner = untag_ptr(this_arg);
26717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26719         this_arg_conv.is_owned = false;
26720         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26721         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
26722         return tag_ptr(ret_ret, true);
26723 }
26724
26725 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
26726         LDKInMemorySigner obj_conv;
26727         obj_conv.inner = untag_ptr(obj);
26728         obj_conv.is_owned = ptr_is_owned(obj);
26729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26730         obj_conv.is_owned = false;
26731         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
26732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26734         CVec_u8Z_free(ret_var);
26735         return ret_arr;
26736 }
26737
26738 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
26739         LDKu8slice ser_ref;
26740         ser_ref.datalen = ser->arr_len;
26741         ser_ref.data = ser->elems;
26742         LDKSecretKey arg_ref;
26743         CHECK(arg->arr_len == 32);
26744         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
26745         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26746         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
26747         FREE(ser);
26748         return tag_ptr(ret_conv, true);
26749 }
26750
26751 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
26752         LDKKeysManager this_obj_conv;
26753         this_obj_conv.inner = untag_ptr(this_obj);
26754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26756         KeysManager_free(this_obj_conv);
26757 }
26758
26759 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
26760         unsigned char seed_arr[32];
26761         CHECK(seed->arr_len == 32);
26762         memcpy(seed_arr, seed->elems, 32); FREE(seed);
26763         unsigned char (*seed_ref)[32] = &seed_arr;
26764         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
26765         uint64_t ret_ref = 0;
26766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26768         return ret_ref;
26769 }
26770
26771 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) {
26772         LDKKeysManager this_arg_conv;
26773         this_arg_conv.inner = untag_ptr(this_arg);
26774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26776         this_arg_conv.is_owned = false;
26777         unsigned char params_arr[32];
26778         CHECK(params->arr_len == 32);
26779         memcpy(params_arr, params->elems, 32); FREE(params);
26780         unsigned char (*params_ref)[32] = &params_arr;
26781         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26782         uint64_t ret_ref = 0;
26783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26785         return ret_ref;
26786 }
26787
26788 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) {
26789         LDKKeysManager this_arg_conv;
26790         this_arg_conv.inner = untag_ptr(this_arg);
26791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26793         this_arg_conv.is_owned = false;
26794         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
26795         descriptors_constr.datalen = descriptors->arr_len;
26796         if (descriptors_constr.datalen > 0)
26797                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
26798         else
26799                 descriptors_constr.data = NULL;
26800         uint64_t* descriptors_vals = descriptors->elems;
26801         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
26802                 uint64_t descriptors_conv_27 = descriptors_vals[b];
26803                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
26804                 CHECK_ACCESS(descriptors_conv_27_ptr);
26805                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
26806                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
26807                 descriptors_constr.data[b] = descriptors_conv_27_conv;
26808         }
26809         FREE(descriptors);
26810         LDKCVec_TxOutZ outputs_constr;
26811         outputs_constr.datalen = outputs->arr_len;
26812         if (outputs_constr.datalen > 0)
26813                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
26814         else
26815                 outputs_constr.data = NULL;
26816         uint64_t* outputs_vals = outputs->elems;
26817         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26818                 uint64_t outputs_conv_7 = outputs_vals[h];
26819                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26820                 CHECK_ACCESS(outputs_conv_7_ptr);
26821                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26822                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26823                 outputs_constr.data[h] = outputs_conv_7_conv;
26824         }
26825         FREE(outputs);
26826         LDKCVec_u8Z change_destination_script_ref;
26827         change_destination_script_ref.datalen = change_destination_script->arr_len;
26828         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26829         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26830         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26831         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26832         return tag_ptr(ret_conv, true);
26833 }
26834
26835 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
26836         LDKKeysManager this_arg_conv;
26837         this_arg_conv.inner = untag_ptr(this_arg);
26838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26840         this_arg_conv.is_owned = false;
26841         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
26842         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
26843         return tag_ptr(ret_ret, true);
26844 }
26845
26846 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
26847         LDKPhantomKeysManager this_obj_conv;
26848         this_obj_conv.inner = untag_ptr(this_obj);
26849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26851         PhantomKeysManager_free(this_obj_conv);
26852 }
26853
26854 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
26855         LDKPhantomKeysManager this_arg_conv;
26856         this_arg_conv.inner = untag_ptr(this_arg);
26857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26859         this_arg_conv.is_owned = false;
26860         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
26861         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
26862         return tag_ptr(ret_ret, true);
26863 }
26864
26865 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) {
26866         unsigned char seed_arr[32];
26867         CHECK(seed->arr_len == 32);
26868         memcpy(seed_arr, seed->elems, 32); FREE(seed);
26869         unsigned char (*seed_ref)[32] = &seed_arr;
26870         unsigned char cross_node_seed_arr[32];
26871         CHECK(cross_node_seed->arr_len == 32);
26872         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
26873         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
26874         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
26875         uint64_t ret_ref = 0;
26876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26878         return ret_ref;
26879 }
26880
26881 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) {
26882         LDKPhantomKeysManager this_arg_conv;
26883         this_arg_conv.inner = untag_ptr(this_arg);
26884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26886         this_arg_conv.is_owned = false;
26887         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
26888         descriptors_constr.datalen = descriptors->arr_len;
26889         if (descriptors_constr.datalen > 0)
26890                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
26891         else
26892                 descriptors_constr.data = NULL;
26893         uint64_t* descriptors_vals = descriptors->elems;
26894         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
26895                 uint64_t descriptors_conv_27 = descriptors_vals[b];
26896                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
26897                 CHECK_ACCESS(descriptors_conv_27_ptr);
26898                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
26899                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
26900                 descriptors_constr.data[b] = descriptors_conv_27_conv;
26901         }
26902         FREE(descriptors);
26903         LDKCVec_TxOutZ outputs_constr;
26904         outputs_constr.datalen = outputs->arr_len;
26905         if (outputs_constr.datalen > 0)
26906                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
26907         else
26908                 outputs_constr.data = NULL;
26909         uint64_t* outputs_vals = outputs->elems;
26910         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26911                 uint64_t outputs_conv_7 = outputs_vals[h];
26912                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26913                 CHECK_ACCESS(outputs_conv_7_ptr);
26914                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26915                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26916                 outputs_constr.data[h] = outputs_conv_7_conv;
26917         }
26918         FREE(outputs);
26919         LDKCVec_u8Z change_destination_script_ref;
26920         change_destination_script_ref.datalen = change_destination_script->arr_len;
26921         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26922         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26923         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26924         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26925         return tag_ptr(ret_conv, true);
26926 }
26927
26928 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) {
26929         LDKPhantomKeysManager this_arg_conv;
26930         this_arg_conv.inner = untag_ptr(this_arg);
26931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26933         this_arg_conv.is_owned = false;
26934         unsigned char params_arr[32];
26935         CHECK(params->arr_len == 32);
26936         memcpy(params_arr, params->elems, 32); FREE(params);
26937         unsigned char (*params_ref)[32] = &params_arr;
26938         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26939         uint64_t ret_ref = 0;
26940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26942         return ret_ref;
26943 }
26944
26945 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
26946         LDKChannelManager this_obj_conv;
26947         this_obj_conv.inner = untag_ptr(this_obj);
26948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26950         ChannelManager_free(this_obj_conv);
26951 }
26952
26953 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
26954         LDKChainParameters this_obj_conv;
26955         this_obj_conv.inner = untag_ptr(this_obj);
26956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26958         ChainParameters_free(this_obj_conv);
26959 }
26960
26961 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
26962         LDKChainParameters 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         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
26968         return ret_conv;
26969 }
26970
26971 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
26972         LDKChainParameters this_ptr_conv;
26973         this_ptr_conv.inner = untag_ptr(this_ptr);
26974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26976         this_ptr_conv.is_owned = false;
26977         LDKNetwork val_conv = LDKNetwork_from_js(val);
26978         ChainParameters_set_network(&this_ptr_conv, val_conv);
26979 }
26980
26981 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
26982         LDKChainParameters this_ptr_conv;
26983         this_ptr_conv.inner = untag_ptr(this_ptr);
26984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26986         this_ptr_conv.is_owned = false;
26987         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
26988         uint64_t ret_ref = 0;
26989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26991         return ret_ref;
26992 }
26993
26994 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
26995         LDKChainParameters this_ptr_conv;
26996         this_ptr_conv.inner = untag_ptr(this_ptr);
26997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26999         this_ptr_conv.is_owned = false;
27000         LDKBestBlock val_conv;
27001         val_conv.inner = untag_ptr(val);
27002         val_conv.is_owned = ptr_is_owned(val);
27003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27004         val_conv = BestBlock_clone(&val_conv);
27005         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27006 }
27007
27008 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27009         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27010         LDKBestBlock best_block_arg_conv;
27011         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27012         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27013         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27014         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27015         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27016         uint64_t ret_ref = 0;
27017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27019         return ret_ref;
27020 }
27021
27022 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27023         LDKChainParameters ret_var = ChainParameters_clone(arg);
27024         uint64_t ret_ref = 0;
27025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27027         return ret_ref;
27028 }
27029 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27030         LDKChainParameters arg_conv;
27031         arg_conv.inner = untag_ptr(arg);
27032         arg_conv.is_owned = ptr_is_owned(arg);
27033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27034         arg_conv.is_owned = false;
27035         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27036         return ret_conv;
27037 }
27038
27039 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27040         LDKChainParameters orig_conv;
27041         orig_conv.inner = untag_ptr(orig);
27042         orig_conv.is_owned = ptr_is_owned(orig);
27043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27044         orig_conv.is_owned = false;
27045         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27046         uint64_t ret_ref = 0;
27047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27049         return ret_ref;
27050 }
27051
27052 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27053         LDKCounterpartyForwardingInfo this_obj_conv;
27054         this_obj_conv.inner = untag_ptr(this_obj);
27055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27057         CounterpartyForwardingInfo_free(this_obj_conv);
27058 }
27059
27060 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27061         LDKCounterpartyForwardingInfo this_ptr_conv;
27062         this_ptr_conv.inner = untag_ptr(this_ptr);
27063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27065         this_ptr_conv.is_owned = false;
27066         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27067         return ret_conv;
27068 }
27069
27070 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27071         LDKCounterpartyForwardingInfo this_ptr_conv;
27072         this_ptr_conv.inner = untag_ptr(this_ptr);
27073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27075         this_ptr_conv.is_owned = false;
27076         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27077 }
27078
27079 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27080         LDKCounterpartyForwardingInfo this_ptr_conv;
27081         this_ptr_conv.inner = untag_ptr(this_ptr);
27082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27084         this_ptr_conv.is_owned = false;
27085         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27086         return ret_conv;
27087 }
27088
27089 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27090         LDKCounterpartyForwardingInfo this_ptr_conv;
27091         this_ptr_conv.inner = untag_ptr(this_ptr);
27092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27094         this_ptr_conv.is_owned = false;
27095         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27096 }
27097
27098 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27099         LDKCounterpartyForwardingInfo this_ptr_conv;
27100         this_ptr_conv.inner = untag_ptr(this_ptr);
27101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27103         this_ptr_conv.is_owned = false;
27104         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27105         return ret_conv;
27106 }
27107
27108 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27109         LDKCounterpartyForwardingInfo this_ptr_conv;
27110         this_ptr_conv.inner = untag_ptr(this_ptr);
27111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27113         this_ptr_conv.is_owned = false;
27114         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27115 }
27116
27117 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) {
27118         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27119         uint64_t ret_ref = 0;
27120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27122         return ret_ref;
27123 }
27124
27125 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27126         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27127         uint64_t ret_ref = 0;
27128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27130         return ret_ref;
27131 }
27132 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27133         LDKCounterpartyForwardingInfo arg_conv;
27134         arg_conv.inner = untag_ptr(arg);
27135         arg_conv.is_owned = ptr_is_owned(arg);
27136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27137         arg_conv.is_owned = false;
27138         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27139         return ret_conv;
27140 }
27141
27142 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27143         LDKCounterpartyForwardingInfo orig_conv;
27144         orig_conv.inner = untag_ptr(orig);
27145         orig_conv.is_owned = ptr_is_owned(orig);
27146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27147         orig_conv.is_owned = false;
27148         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27149         uint64_t ret_ref = 0;
27150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27152         return ret_ref;
27153 }
27154
27155 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27156         LDKChannelCounterparty this_obj_conv;
27157         this_obj_conv.inner = untag_ptr(this_obj);
27158         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27160         ChannelCounterparty_free(this_obj_conv);
27161 }
27162
27163 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27164         LDKChannelCounterparty this_ptr_conv;
27165         this_ptr_conv.inner = untag_ptr(this_ptr);
27166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27168         this_ptr_conv.is_owned = false;
27169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27170         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27171         return ret_arr;
27172 }
27173
27174 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27175         LDKChannelCounterparty this_ptr_conv;
27176         this_ptr_conv.inner = untag_ptr(this_ptr);
27177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27179         this_ptr_conv.is_owned = false;
27180         LDKPublicKey val_ref;
27181         CHECK(val->arr_len == 33);
27182         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27183         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27184 }
27185
27186 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27187         LDKChannelCounterparty this_ptr_conv;
27188         this_ptr_conv.inner = untag_ptr(this_ptr);
27189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27191         this_ptr_conv.is_owned = false;
27192         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27193         uint64_t ret_ref = 0;
27194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27196         return ret_ref;
27197 }
27198
27199 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27200         LDKChannelCounterparty this_ptr_conv;
27201         this_ptr_conv.inner = untag_ptr(this_ptr);
27202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27204         this_ptr_conv.is_owned = false;
27205         LDKInitFeatures val_conv;
27206         val_conv.inner = untag_ptr(val);
27207         val_conv.is_owned = ptr_is_owned(val);
27208         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27209         val_conv = InitFeatures_clone(&val_conv);
27210         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27211 }
27212
27213 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27214         LDKChannelCounterparty this_ptr_conv;
27215         this_ptr_conv.inner = untag_ptr(this_ptr);
27216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27218         this_ptr_conv.is_owned = false;
27219         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27220         return ret_conv;
27221 }
27222
27223 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27224         LDKChannelCounterparty this_ptr_conv;
27225         this_ptr_conv.inner = untag_ptr(this_ptr);
27226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27228         this_ptr_conv.is_owned = false;
27229         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27230 }
27231
27232 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27233         LDKChannelCounterparty this_ptr_conv;
27234         this_ptr_conv.inner = untag_ptr(this_ptr);
27235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27237         this_ptr_conv.is_owned = false;
27238         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27239         uint64_t ret_ref = 0;
27240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27242         return ret_ref;
27243 }
27244
27245 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27246         LDKChannelCounterparty this_ptr_conv;
27247         this_ptr_conv.inner = untag_ptr(this_ptr);
27248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27250         this_ptr_conv.is_owned = false;
27251         LDKCounterpartyForwardingInfo val_conv;
27252         val_conv.inner = untag_ptr(val);
27253         val_conv.is_owned = ptr_is_owned(val);
27254         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27255         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27256         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27257 }
27258
27259 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27260         LDKChannelCounterparty this_ptr_conv;
27261         this_ptr_conv.inner = untag_ptr(this_ptr);
27262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27264         this_ptr_conv.is_owned = false;
27265         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27266         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27267         uint64_t ret_ref = tag_ptr(ret_copy, true);
27268         return ret_ref;
27269 }
27270
27271 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) {
27272         LDKChannelCounterparty this_ptr_conv;
27273         this_ptr_conv.inner = untag_ptr(this_ptr);
27274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27276         this_ptr_conv.is_owned = false;
27277         void* val_ptr = untag_ptr(val);
27278         CHECK_ACCESS(val_ptr);
27279         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27280         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27281         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27282 }
27283
27284 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27285         LDKChannelCounterparty this_ptr_conv;
27286         this_ptr_conv.inner = untag_ptr(this_ptr);
27287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27289         this_ptr_conv.is_owned = false;
27290         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27291         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27292         uint64_t ret_ref = tag_ptr(ret_copy, true);
27293         return ret_ref;
27294 }
27295
27296 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) {
27297         LDKChannelCounterparty this_ptr_conv;
27298         this_ptr_conv.inner = untag_ptr(this_ptr);
27299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27301         this_ptr_conv.is_owned = false;
27302         void* val_ptr = untag_ptr(val);
27303         CHECK_ACCESS(val_ptr);
27304         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27305         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27306         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27307 }
27308
27309 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) {
27310         LDKPublicKey node_id_arg_ref;
27311         CHECK(node_id_arg->arr_len == 33);
27312         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27313         LDKInitFeatures features_arg_conv;
27314         features_arg_conv.inner = untag_ptr(features_arg);
27315         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27316         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27317         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27318         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27319         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27320         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27321         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27322         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27323         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27324         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27325         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27326         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27327         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27328         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27329         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27330         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27331         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);
27332         uint64_t ret_ref = 0;
27333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27335         return ret_ref;
27336 }
27337
27338 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27339         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
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 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27346         LDKChannelCounterparty arg_conv;
27347         arg_conv.inner = untag_ptr(arg);
27348         arg_conv.is_owned = ptr_is_owned(arg);
27349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27350         arg_conv.is_owned = false;
27351         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27352         return ret_conv;
27353 }
27354
27355 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27356         LDKChannelCounterparty orig_conv;
27357         orig_conv.inner = untag_ptr(orig);
27358         orig_conv.is_owned = ptr_is_owned(orig);
27359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27360         orig_conv.is_owned = false;
27361         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27362         uint64_t ret_ref = 0;
27363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27365         return ret_ref;
27366 }
27367
27368 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27369         LDKChannelDetails this_obj_conv;
27370         this_obj_conv.inner = untag_ptr(this_obj);
27371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27373         ChannelDetails_free(this_obj_conv);
27374 }
27375
27376 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27377         LDKChannelDetails this_ptr_conv;
27378         this_ptr_conv.inner = untag_ptr(this_ptr);
27379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27381         this_ptr_conv.is_owned = false;
27382         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27383         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27384         return ret_arr;
27385 }
27386
27387 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27388         LDKChannelDetails this_ptr_conv;
27389         this_ptr_conv.inner = untag_ptr(this_ptr);
27390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27392         this_ptr_conv.is_owned = false;
27393         LDKThirtyTwoBytes val_ref;
27394         CHECK(val->arr_len == 32);
27395         memcpy(val_ref.data, val->elems, 32); FREE(val);
27396         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27397 }
27398
27399 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27400         LDKChannelDetails this_ptr_conv;
27401         this_ptr_conv.inner = untag_ptr(this_ptr);
27402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27404         this_ptr_conv.is_owned = false;
27405         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27406         uint64_t ret_ref = 0;
27407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27409         return ret_ref;
27410 }
27411
27412 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27413         LDKChannelDetails this_ptr_conv;
27414         this_ptr_conv.inner = untag_ptr(this_ptr);
27415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27417         this_ptr_conv.is_owned = false;
27418         LDKChannelCounterparty val_conv;
27419         val_conv.inner = untag_ptr(val);
27420         val_conv.is_owned = ptr_is_owned(val);
27421         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27422         val_conv = ChannelCounterparty_clone(&val_conv);
27423         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27424 }
27425
27426 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27427         LDKChannelDetails this_ptr_conv;
27428         this_ptr_conv.inner = untag_ptr(this_ptr);
27429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27431         this_ptr_conv.is_owned = false;
27432         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27433         uint64_t ret_ref = 0;
27434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27436         return ret_ref;
27437 }
27438
27439 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27440         LDKChannelDetails this_ptr_conv;
27441         this_ptr_conv.inner = untag_ptr(this_ptr);
27442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27444         this_ptr_conv.is_owned = false;
27445         LDKOutPoint val_conv;
27446         val_conv.inner = untag_ptr(val);
27447         val_conv.is_owned = ptr_is_owned(val);
27448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27449         val_conv = OutPoint_clone(&val_conv);
27450         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27451 }
27452
27453 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27454         LDKChannelDetails this_ptr_conv;
27455         this_ptr_conv.inner = untag_ptr(this_ptr);
27456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27458         this_ptr_conv.is_owned = false;
27459         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27460         uint64_t ret_ref = 0;
27461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27463         return ret_ref;
27464 }
27465
27466 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27467         LDKChannelDetails this_ptr_conv;
27468         this_ptr_conv.inner = untag_ptr(this_ptr);
27469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27471         this_ptr_conv.is_owned = false;
27472         LDKChannelTypeFeatures val_conv;
27473         val_conv.inner = untag_ptr(val);
27474         val_conv.is_owned = ptr_is_owned(val);
27475         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27476         val_conv = ChannelTypeFeatures_clone(&val_conv);
27477         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27478 }
27479
27480 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27481         LDKChannelDetails this_ptr_conv;
27482         this_ptr_conv.inner = untag_ptr(this_ptr);
27483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27485         this_ptr_conv.is_owned = false;
27486         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27487         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27488         uint64_t ret_ref = tag_ptr(ret_copy, true);
27489         return ret_ref;
27490 }
27491
27492 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27493         LDKChannelDetails this_ptr_conv;
27494         this_ptr_conv.inner = untag_ptr(this_ptr);
27495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27497         this_ptr_conv.is_owned = false;
27498         void* val_ptr = untag_ptr(val);
27499         CHECK_ACCESS(val_ptr);
27500         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27501         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27502         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27503 }
27504
27505 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27506         LDKChannelDetails this_ptr_conv;
27507         this_ptr_conv.inner = untag_ptr(this_ptr);
27508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27510         this_ptr_conv.is_owned = false;
27511         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27512         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27513         uint64_t ret_ref = tag_ptr(ret_copy, true);
27514         return ret_ref;
27515 }
27516
27517 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27518         LDKChannelDetails this_ptr_conv;
27519         this_ptr_conv.inner = untag_ptr(this_ptr);
27520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27522         this_ptr_conv.is_owned = false;
27523         void* val_ptr = untag_ptr(val);
27524         CHECK_ACCESS(val_ptr);
27525         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27526         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27527         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27528 }
27529
27530 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27531         LDKChannelDetails this_ptr_conv;
27532         this_ptr_conv.inner = untag_ptr(this_ptr);
27533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27535         this_ptr_conv.is_owned = false;
27536         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27537         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27538         uint64_t ret_ref = tag_ptr(ret_copy, true);
27539         return ret_ref;
27540 }
27541
27542 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27543         LDKChannelDetails this_ptr_conv;
27544         this_ptr_conv.inner = untag_ptr(this_ptr);
27545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27547         this_ptr_conv.is_owned = false;
27548         void* val_ptr = untag_ptr(val);
27549         CHECK_ACCESS(val_ptr);
27550         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27551         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27552         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27553 }
27554
27555 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27556         LDKChannelDetails this_ptr_conv;
27557         this_ptr_conv.inner = untag_ptr(this_ptr);
27558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27560         this_ptr_conv.is_owned = false;
27561         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27562         return ret_conv;
27563 }
27564
27565 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27566         LDKChannelDetails this_ptr_conv;
27567         this_ptr_conv.inner = untag_ptr(this_ptr);
27568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27570         this_ptr_conv.is_owned = false;
27571         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27572 }
27573
27574 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27575         LDKChannelDetails this_ptr_conv;
27576         this_ptr_conv.inner = untag_ptr(this_ptr);
27577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27579         this_ptr_conv.is_owned = false;
27580         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27581         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27582         uint64_t ret_ref = tag_ptr(ret_copy, true);
27583         return ret_ref;
27584 }
27585
27586 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27587         LDKChannelDetails this_ptr_conv;
27588         this_ptr_conv.inner = untag_ptr(this_ptr);
27589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27591         this_ptr_conv.is_owned = false;
27592         void* val_ptr = untag_ptr(val);
27593         CHECK_ACCESS(val_ptr);
27594         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27595         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27596         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27597 }
27598
27599 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
27600         LDKChannelDetails this_ptr_conv;
27601         this_ptr_conv.inner = untag_ptr(this_ptr);
27602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27604         this_ptr_conv.is_owned = false;
27605         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
27606         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
27607         return ret_arr;
27608 }
27609
27610 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
27611         LDKChannelDetails this_ptr_conv;
27612         this_ptr_conv.inner = untag_ptr(this_ptr);
27613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27615         this_ptr_conv.is_owned = false;
27616         LDKU128 val_ref;
27617         CHECK(val->arr_len == 16);
27618         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
27619         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
27620 }
27621
27622 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
27623         LDKChannelDetails this_ptr_conv;
27624         this_ptr_conv.inner = untag_ptr(this_ptr);
27625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27627         this_ptr_conv.is_owned = false;
27628         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
27629         return ret_conv;
27630 }
27631
27632 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
27633         LDKChannelDetails this_ptr_conv;
27634         this_ptr_conv.inner = untag_ptr(this_ptr);
27635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27637         this_ptr_conv.is_owned = false;
27638         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
27639 }
27640
27641 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
27642         LDKChannelDetails this_ptr_conv;
27643         this_ptr_conv.inner = untag_ptr(this_ptr);
27644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27646         this_ptr_conv.is_owned = false;
27647         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
27648         return ret_conv;
27649 }
27650
27651 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
27652         LDKChannelDetails this_ptr_conv;
27653         this_ptr_conv.inner = untag_ptr(this_ptr);
27654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27656         this_ptr_conv.is_owned = false;
27657         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
27658 }
27659
27660 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) {
27661         LDKChannelDetails this_ptr_conv;
27662         this_ptr_conv.inner = untag_ptr(this_ptr);
27663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27665         this_ptr_conv.is_owned = false;
27666         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
27667         return ret_conv;
27668 }
27669
27670 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) {
27671         LDKChannelDetails this_ptr_conv;
27672         this_ptr_conv.inner = untag_ptr(this_ptr);
27673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27675         this_ptr_conv.is_owned = false;
27676         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
27677 }
27678
27679 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
27680         LDKChannelDetails this_ptr_conv;
27681         this_ptr_conv.inner = untag_ptr(this_ptr);
27682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27684         this_ptr_conv.is_owned = false;
27685         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
27686         return ret_conv;
27687 }
27688
27689 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
27690         LDKChannelDetails this_ptr_conv;
27691         this_ptr_conv.inner = untag_ptr(this_ptr);
27692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27694         this_ptr_conv.is_owned = false;
27695         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
27696 }
27697
27698 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
27699         LDKChannelDetails this_ptr_conv;
27700         this_ptr_conv.inner = untag_ptr(this_ptr);
27701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27703         this_ptr_conv.is_owned = false;
27704         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27705         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
27706         uint64_t ret_ref = tag_ptr(ret_copy, true);
27707         return ret_ref;
27708 }
27709
27710 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
27711         LDKChannelDetails this_ptr_conv;
27712         this_ptr_conv.inner = untag_ptr(this_ptr);
27713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27715         this_ptr_conv.is_owned = false;
27716         void* val_ptr = untag_ptr(val);
27717         CHECK_ACCESS(val_ptr);
27718         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27719         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
27720         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
27721 }
27722
27723 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
27724         LDKChannelDetails this_ptr_conv;
27725         this_ptr_conv.inner = untag_ptr(this_ptr);
27726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27728         this_ptr_conv.is_owned = false;
27729         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27730         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
27731         uint64_t ret_ref = tag_ptr(ret_copy, true);
27732         return ret_ref;
27733 }
27734
27735 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
27736         LDKChannelDetails this_ptr_conv;
27737         this_ptr_conv.inner = untag_ptr(this_ptr);
27738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27740         this_ptr_conv.is_owned = false;
27741         void* val_ptr = untag_ptr(val);
27742         CHECK_ACCESS(val_ptr);
27743         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27744         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
27745         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
27746 }
27747
27748 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
27749         LDKChannelDetails this_ptr_conv;
27750         this_ptr_conv.inner = untag_ptr(this_ptr);
27751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27753         this_ptr_conv.is_owned = false;
27754         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
27755         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
27756         uint64_t ret_ref = tag_ptr(ret_copy, true);
27757         return ret_ref;
27758 }
27759
27760 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) {
27761         LDKChannelDetails this_ptr_conv;
27762         this_ptr_conv.inner = untag_ptr(this_ptr);
27763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27765         this_ptr_conv.is_owned = false;
27766         void* val_ptr = untag_ptr(val);
27767         CHECK_ACCESS(val_ptr);
27768         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
27769         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
27770         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
27771 }
27772
27773 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
27774         LDKChannelDetails this_ptr_conv;
27775         this_ptr_conv.inner = untag_ptr(this_ptr);
27776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27778         this_ptr_conv.is_owned = false;
27779         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
27780         return ret_conv;
27781 }
27782
27783 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
27784         LDKChannelDetails this_ptr_conv;
27785         this_ptr_conv.inner = untag_ptr(this_ptr);
27786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27788         this_ptr_conv.is_owned = false;
27789         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
27790 }
27791
27792 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
27793         LDKChannelDetails this_ptr_conv;
27794         this_ptr_conv.inner = untag_ptr(this_ptr);
27795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27797         this_ptr_conv.is_owned = false;
27798         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
27799         return ret_conv;
27800 }
27801
27802 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
27803         LDKChannelDetails this_ptr_conv;
27804         this_ptr_conv.inner = untag_ptr(this_ptr);
27805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27807         this_ptr_conv.is_owned = false;
27808         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
27809 }
27810
27811 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
27812         LDKChannelDetails this_ptr_conv;
27813         this_ptr_conv.inner = untag_ptr(this_ptr);
27814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27816         this_ptr_conv.is_owned = false;
27817         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
27818         return ret_conv;
27819 }
27820
27821 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
27822         LDKChannelDetails this_ptr_conv;
27823         this_ptr_conv.inner = untag_ptr(this_ptr);
27824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27826         this_ptr_conv.is_owned = false;
27827         ChannelDetails_set_is_usable(&this_ptr_conv, val);
27828 }
27829
27830 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
27831         LDKChannelDetails this_ptr_conv;
27832         this_ptr_conv.inner = untag_ptr(this_ptr);
27833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27835         this_ptr_conv.is_owned = false;
27836         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
27837         return ret_conv;
27838 }
27839
27840 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
27841         LDKChannelDetails this_ptr_conv;
27842         this_ptr_conv.inner = untag_ptr(this_ptr);
27843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27845         this_ptr_conv.is_owned = false;
27846         ChannelDetails_set_is_public(&this_ptr_conv, val);
27847 }
27848
27849 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
27850         LDKChannelDetails this_ptr_conv;
27851         this_ptr_conv.inner = untag_ptr(this_ptr);
27852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27854         this_ptr_conv.is_owned = false;
27855         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27856         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
27857         uint64_t ret_ref = tag_ptr(ret_copy, true);
27858         return ret_ref;
27859 }
27860
27861 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) {
27862         LDKChannelDetails this_ptr_conv;
27863         this_ptr_conv.inner = untag_ptr(this_ptr);
27864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27866         this_ptr_conv.is_owned = false;
27867         void* val_ptr = untag_ptr(val);
27868         CHECK_ACCESS(val_ptr);
27869         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27870         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27871         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27872 }
27873
27874 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
27875         LDKChannelDetails this_ptr_conv;
27876         this_ptr_conv.inner = untag_ptr(this_ptr);
27877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27879         this_ptr_conv.is_owned = false;
27880         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27881         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
27882         uint64_t ret_ref = tag_ptr(ret_copy, true);
27883         return ret_ref;
27884 }
27885
27886 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) {
27887         LDKChannelDetails this_ptr_conv;
27888         this_ptr_conv.inner = untag_ptr(this_ptr);
27889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27891         this_ptr_conv.is_owned = false;
27892         void* val_ptr = untag_ptr(val);
27893         CHECK_ACCESS(val_ptr);
27894         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27895         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27896         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27897 }
27898
27899 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
27900         LDKChannelDetails this_ptr_conv;
27901         this_ptr_conv.inner = untag_ptr(this_ptr);
27902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27904         this_ptr_conv.is_owned = false;
27905         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
27906         uint64_t ret_ref = 0;
27907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27909         return ret_ref;
27910 }
27911
27912 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
27913         LDKChannelDetails this_ptr_conv;
27914         this_ptr_conv.inner = untag_ptr(this_ptr);
27915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27917         this_ptr_conv.is_owned = false;
27918         LDKChannelConfig val_conv;
27919         val_conv.inner = untag_ptr(val);
27920         val_conv.is_owned = ptr_is_owned(val);
27921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27922         val_conv = ChannelConfig_clone(&val_conv);
27923         ChannelDetails_set_config(&this_ptr_conv, val_conv);
27924 }
27925
27926 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, int8_tArray 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 confirmations_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) {
27927         LDKThirtyTwoBytes channel_id_arg_ref;
27928         CHECK(channel_id_arg->arr_len == 32);
27929         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27930         LDKChannelCounterparty counterparty_arg_conv;
27931         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
27932         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
27933         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
27934         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
27935         LDKOutPoint funding_txo_arg_conv;
27936         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
27937         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
27938         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
27939         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
27940         LDKChannelTypeFeatures channel_type_arg_conv;
27941         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
27942         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
27943         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
27944         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
27945         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
27946         CHECK_ACCESS(short_channel_id_arg_ptr);
27947         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
27948         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
27949         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
27950         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
27951         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
27952         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
27953         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
27954         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
27955         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
27956         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
27957         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
27958         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
27959         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
27960         LDKU128 user_channel_id_arg_ref;
27961         CHECK(user_channel_id_arg->arr_len == 16);
27962         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
27963         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
27964         CHECK_ACCESS(confirmations_required_arg_ptr);
27965         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
27966         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
27967         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
27968         CHECK_ACCESS(confirmations_arg_ptr);
27969         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
27970         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
27971         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
27972         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
27973         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
27974         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
27975         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
27976         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
27977         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
27978         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
27979         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
27980         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
27981         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
27982         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
27983         LDKChannelConfig config_arg_conv;
27984         config_arg_conv.inner = untag_ptr(config_arg);
27985         config_arg_conv.is_owned = ptr_is_owned(config_arg);
27986         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
27987         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
27988         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_ref, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_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);
27989         uint64_t ret_ref = 0;
27990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27992         return ret_ref;
27993 }
27994
27995 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
27996         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
27997         uint64_t ret_ref = 0;
27998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28000         return ret_ref;
28001 }
28002 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28003         LDKChannelDetails arg_conv;
28004         arg_conv.inner = untag_ptr(arg);
28005         arg_conv.is_owned = ptr_is_owned(arg);
28006         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28007         arg_conv.is_owned = false;
28008         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28009         return ret_conv;
28010 }
28011
28012 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28013         LDKChannelDetails orig_conv;
28014         orig_conv.inner = untag_ptr(orig);
28015         orig_conv.is_owned = ptr_is_owned(orig);
28016         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28017         orig_conv.is_owned = false;
28018         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28019         uint64_t ret_ref = 0;
28020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28022         return ret_ref;
28023 }
28024
28025 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28026         LDKChannelDetails this_arg_conv;
28027         this_arg_conv.inner = untag_ptr(this_arg);
28028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28030         this_arg_conv.is_owned = false;
28031         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28032         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28033         uint64_t ret_ref = tag_ptr(ret_copy, true);
28034         return ret_ref;
28035 }
28036
28037 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28038         LDKChannelDetails this_arg_conv;
28039         this_arg_conv.inner = untag_ptr(this_arg);
28040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28042         this_arg_conv.is_owned = false;
28043         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28044         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28045         uint64_t ret_ref = tag_ptr(ret_copy, true);
28046         return ret_ref;
28047 }
28048
28049 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
28050         if (!ptr_is_owned(this_ptr)) return;
28051         void* this_ptr_ptr = untag_ptr(this_ptr);
28052         CHECK_ACCESS(this_ptr_ptr);
28053         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28054         FREE(untag_ptr(this_ptr));
28055         PaymentSendFailure_free(this_ptr_conv);
28056 }
28057
28058 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28059         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28060         *ret_copy = PaymentSendFailure_clone(arg);
28061         uint64_t ret_ref = tag_ptr(ret_copy, true);
28062         return ret_ref;
28063 }
28064 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
28065         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
28066         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
28067         return ret_conv;
28068 }
28069
28070 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
28071         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
28072         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28073         *ret_copy = PaymentSendFailure_clone(orig_conv);
28074         uint64_t ret_ref = tag_ptr(ret_copy, true);
28075         return ret_ref;
28076 }
28077
28078 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
28079         void* a_ptr = untag_ptr(a);
28080         CHECK_ACCESS(a_ptr);
28081         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28082         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
28083         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28084         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28085         uint64_t ret_ref = tag_ptr(ret_copy, true);
28086         return ret_ref;
28087 }
28088
28089 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
28090         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28091         a_constr.datalen = a->arr_len;
28092         if (a_constr.datalen > 0)
28093                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28094         else
28095                 a_constr.data = NULL;
28096         uint64_t* a_vals = a->elems;
28097         for (size_t w = 0; w < a_constr.datalen; w++) {
28098                 uint64_t a_conv_22 = a_vals[w];
28099                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
28100                 CHECK_ACCESS(a_conv_22_ptr);
28101                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28102                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
28103                 a_constr.data[w] = a_conv_22_conv;
28104         }
28105         FREE(a);
28106         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28107         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28108         uint64_t ret_ref = tag_ptr(ret_copy, true);
28109         return ret_ref;
28110 }
28111
28112 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
28113         LDKCVec_APIErrorZ a_constr;
28114         a_constr.datalen = a->arr_len;
28115         if (a_constr.datalen > 0)
28116                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28117         else
28118                 a_constr.data = NULL;
28119         uint64_t* a_vals = a->elems;
28120         for (size_t k = 0; k < a_constr.datalen; k++) {
28121                 uint64_t a_conv_10 = a_vals[k];
28122                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
28123                 CHECK_ACCESS(a_conv_10_ptr);
28124                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28125                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
28126                 a_constr.data[k] = a_conv_10_conv;
28127         }
28128         FREE(a);
28129         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28130         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
28131         uint64_t ret_ref = tag_ptr(ret_copy, true);
28132         return ret_ref;
28133 }
28134
28135 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
28136         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28137         *ret_copy = PaymentSendFailure_duplicate_payment();
28138         uint64_t ret_ref = tag_ptr(ret_copy, true);
28139         return ret_ref;
28140 }
28141
28142 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) {
28143         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28144         results_constr.datalen = results->arr_len;
28145         if (results_constr.datalen > 0)
28146                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28147         else
28148                 results_constr.data = NULL;
28149         uint64_t* results_vals = results->elems;
28150         for (size_t w = 0; w < results_constr.datalen; w++) {
28151                 uint64_t results_conv_22 = results_vals[w];
28152                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
28153                 CHECK_ACCESS(results_conv_22_ptr);
28154                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28155                 results_constr.data[w] = results_conv_22_conv;
28156         }
28157         FREE(results);
28158         LDKRouteParameters failed_paths_retry_conv;
28159         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
28160         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
28161         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28162         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28163         LDKThirtyTwoBytes payment_id_ref;
28164         CHECK(payment_id->arr_len == 32);
28165         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28166         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28167         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28168         uint64_t ret_ref = tag_ptr(ret_copy, true);
28169         return ret_ref;
28170 }
28171
28172 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28173         LDKPhantomRouteHints this_obj_conv;
28174         this_obj_conv.inner = untag_ptr(this_obj);
28175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28177         PhantomRouteHints_free(this_obj_conv);
28178 }
28179
28180 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28181         LDKPhantomRouteHints this_ptr_conv;
28182         this_ptr_conv.inner = untag_ptr(this_ptr);
28183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28185         this_ptr_conv.is_owned = false;
28186         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28187         uint64_tArray ret_arr = NULL;
28188         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28189         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28190         for (size_t q = 0; q < ret_var.datalen; q++) {
28191                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28192                 uint64_t ret_conv_16_ref = 0;
28193                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28194                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28195                 ret_arr_ptr[q] = ret_conv_16_ref;
28196         }
28197         
28198         FREE(ret_var.data);
28199         return ret_arr;
28200 }
28201
28202 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28203         LDKPhantomRouteHints 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         LDKCVec_ChannelDetailsZ val_constr;
28209         val_constr.datalen = val->arr_len;
28210         if (val_constr.datalen > 0)
28211                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28212         else
28213                 val_constr.data = NULL;
28214         uint64_t* val_vals = val->elems;
28215         for (size_t q = 0; q < val_constr.datalen; q++) {
28216                 uint64_t val_conv_16 = val_vals[q];
28217                 LDKChannelDetails val_conv_16_conv;
28218                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28219                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28220                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28221                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28222                 val_constr.data[q] = val_conv_16_conv;
28223         }
28224         FREE(val);
28225         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28226 }
28227
28228 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28229         LDKPhantomRouteHints this_ptr_conv;
28230         this_ptr_conv.inner = untag_ptr(this_ptr);
28231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28233         this_ptr_conv.is_owned = false;
28234         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28235         return ret_conv;
28236 }
28237
28238 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28239         LDKPhantomRouteHints this_ptr_conv;
28240         this_ptr_conv.inner = untag_ptr(this_ptr);
28241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28243         this_ptr_conv.is_owned = false;
28244         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28245 }
28246
28247 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28248         LDKPhantomRouteHints this_ptr_conv;
28249         this_ptr_conv.inner = untag_ptr(this_ptr);
28250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28252         this_ptr_conv.is_owned = false;
28253         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28254         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28255         return ret_arr;
28256 }
28257
28258 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28259         LDKPhantomRouteHints this_ptr_conv;
28260         this_ptr_conv.inner = untag_ptr(this_ptr);
28261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28263         this_ptr_conv.is_owned = false;
28264         LDKPublicKey val_ref;
28265         CHECK(val->arr_len == 33);
28266         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28267         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28268 }
28269
28270 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) {
28271         LDKCVec_ChannelDetailsZ channels_arg_constr;
28272         channels_arg_constr.datalen = channels_arg->arr_len;
28273         if (channels_arg_constr.datalen > 0)
28274                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28275         else
28276                 channels_arg_constr.data = NULL;
28277         uint64_t* channels_arg_vals = channels_arg->elems;
28278         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28279                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28280                 LDKChannelDetails channels_arg_conv_16_conv;
28281                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28282                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28283                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28284                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28285                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28286         }
28287         FREE(channels_arg);
28288         LDKPublicKey real_node_pubkey_arg_ref;
28289         CHECK(real_node_pubkey_arg->arr_len == 33);
28290         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28291         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28292         uint64_t ret_ref = 0;
28293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28295         return ret_ref;
28296 }
28297
28298 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28299         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28300         uint64_t ret_ref = 0;
28301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28303         return ret_ref;
28304 }
28305 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28306         LDKPhantomRouteHints arg_conv;
28307         arg_conv.inner = untag_ptr(arg);
28308         arg_conv.is_owned = ptr_is_owned(arg);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28310         arg_conv.is_owned = false;
28311         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28312         return ret_conv;
28313 }
28314
28315 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28316         LDKPhantomRouteHints orig_conv;
28317         orig_conv.inner = untag_ptr(orig);
28318         orig_conv.is_owned = ptr_is_owned(orig);
28319         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28320         orig_conv.is_owned = false;
28321         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28322         uint64_t ret_ref = 0;
28323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28325         return ret_ref;
28326 }
28327
28328 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) {
28329         void* fee_est_ptr = untag_ptr(fee_est);
28330         CHECK_ACCESS(fee_est_ptr);
28331         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28332         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28333                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28334                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28335         }
28336         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28337         CHECK_ACCESS(chain_monitor_ptr);
28338         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28339         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28341                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28342         }
28343         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28344         CHECK_ACCESS(tx_broadcaster_ptr);
28345         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28346         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28347                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28348                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28349         }
28350         void* logger_ptr = untag_ptr(logger);
28351         CHECK_ACCESS(logger_ptr);
28352         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28353         if (logger_conv.free == LDKLogger_JCalls_free) {
28354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28355                 LDKLogger_JCalls_cloned(&logger_conv);
28356         }
28357         void* keys_manager_ptr = untag_ptr(keys_manager);
28358         CHECK_ACCESS(keys_manager_ptr);
28359         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28360         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28362                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28363         }
28364         LDKUserConfig config_conv;
28365         config_conv.inner = untag_ptr(config);
28366         config_conv.is_owned = ptr_is_owned(config);
28367         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28368         config_conv = UserConfig_clone(&config_conv);
28369         LDKChainParameters params_conv;
28370         params_conv.inner = untag_ptr(params);
28371         params_conv.is_owned = ptr_is_owned(params);
28372         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28373         params_conv = ChainParameters_clone(&params_conv);
28374         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
28375         uint64_t ret_ref = 0;
28376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28378         return ret_ref;
28379 }
28380
28381 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28382         LDKChannelManager this_arg_conv;
28383         this_arg_conv.inner = untag_ptr(this_arg);
28384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28386         this_arg_conv.is_owned = false;
28387         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28388         uint64_t ret_ref = 0;
28389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28391         return ret_ref;
28392 }
28393
28394 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, int8_tArray user_channel_id, uint64_t override_config) {
28395         LDKChannelManager this_arg_conv;
28396         this_arg_conv.inner = untag_ptr(this_arg);
28397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28399         this_arg_conv.is_owned = false;
28400         LDKPublicKey their_network_key_ref;
28401         CHECK(their_network_key->arr_len == 33);
28402         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28403         LDKU128 user_channel_id_ref;
28404         CHECK(user_channel_id->arr_len == 16);
28405         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28406         LDKUserConfig override_config_conv;
28407         override_config_conv.inner = untag_ptr(override_config);
28408         override_config_conv.is_owned = ptr_is_owned(override_config);
28409         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28410         override_config_conv = UserConfig_clone(&override_config_conv);
28411         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28412         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28413         return tag_ptr(ret_conv, true);
28414 }
28415
28416 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28417         LDKChannelManager this_arg_conv;
28418         this_arg_conv.inner = untag_ptr(this_arg);
28419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28421         this_arg_conv.is_owned = false;
28422         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28423         uint64_tArray ret_arr = NULL;
28424         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28425         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28426         for (size_t q = 0; q < ret_var.datalen; q++) {
28427                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28428                 uint64_t ret_conv_16_ref = 0;
28429                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28430                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28431                 ret_arr_ptr[q] = ret_conv_16_ref;
28432         }
28433         
28434         FREE(ret_var.data);
28435         return ret_arr;
28436 }
28437
28438 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28439         LDKChannelManager this_arg_conv;
28440         this_arg_conv.inner = untag_ptr(this_arg);
28441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28443         this_arg_conv.is_owned = false;
28444         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28445         uint64_tArray ret_arr = NULL;
28446         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28447         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28448         for (size_t q = 0; q < ret_var.datalen; q++) {
28449                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28450                 uint64_t ret_conv_16_ref = 0;
28451                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28452                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28453                 ret_arr_ptr[q] = ret_conv_16_ref;
28454         }
28455         
28456         FREE(ret_var.data);
28457         return ret_arr;
28458 }
28459
28460 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) {
28461         LDKChannelManager this_arg_conv;
28462         this_arg_conv.inner = untag_ptr(this_arg);
28463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28465         this_arg_conv.is_owned = false;
28466         unsigned char channel_id_arr[32];
28467         CHECK(channel_id->arr_len == 32);
28468         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28469         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28470         LDKPublicKey counterparty_node_id_ref;
28471         CHECK(counterparty_node_id->arr_len == 33);
28472         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28473         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28474         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28475         return tag_ptr(ret_conv, true);
28476 }
28477
28478 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) {
28479         LDKChannelManager this_arg_conv;
28480         this_arg_conv.inner = untag_ptr(this_arg);
28481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28483         this_arg_conv.is_owned = false;
28484         unsigned char channel_id_arr[32];
28485         CHECK(channel_id->arr_len == 32);
28486         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28487         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28488         LDKPublicKey counterparty_node_id_ref;
28489         CHECK(counterparty_node_id->arr_len == 33);
28490         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28491         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28492         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28493         return tag_ptr(ret_conv, true);
28494 }
28495
28496 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) {
28497         LDKChannelManager this_arg_conv;
28498         this_arg_conv.inner = untag_ptr(this_arg);
28499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28501         this_arg_conv.is_owned = false;
28502         unsigned char channel_id_arr[32];
28503         CHECK(channel_id->arr_len == 32);
28504         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28505         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28506         LDKPublicKey counterparty_node_id_ref;
28507         CHECK(counterparty_node_id->arr_len == 33);
28508         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28509         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28510         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28511         return tag_ptr(ret_conv, true);
28512 }
28513
28514 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) {
28515         LDKChannelManager this_arg_conv;
28516         this_arg_conv.inner = untag_ptr(this_arg);
28517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28519         this_arg_conv.is_owned = false;
28520         unsigned char channel_id_arr[32];
28521         CHECK(channel_id->arr_len == 32);
28522         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28523         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28524         LDKPublicKey counterparty_node_id_ref;
28525         CHECK(counterparty_node_id->arr_len == 33);
28526         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28527         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28528         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28529         return tag_ptr(ret_conv, true);
28530 }
28531
28532 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) {
28533         LDKChannelManager this_arg_conv;
28534         this_arg_conv.inner = untag_ptr(this_arg);
28535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28537         this_arg_conv.is_owned = false;
28538         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28539 }
28540
28541 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) {
28542         LDKChannelManager this_arg_conv;
28543         this_arg_conv.inner = untag_ptr(this_arg);
28544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28546         this_arg_conv.is_owned = false;
28547         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28548 }
28549
28550 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, int8_tArray payment_id) {
28551         LDKChannelManager this_arg_conv;
28552         this_arg_conv.inner = untag_ptr(this_arg);
28553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28555         this_arg_conv.is_owned = false;
28556         LDKRoute route_conv;
28557         route_conv.inner = untag_ptr(route);
28558         route_conv.is_owned = ptr_is_owned(route);
28559         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28560         route_conv.is_owned = false;
28561         LDKThirtyTwoBytes payment_hash_ref;
28562         CHECK(payment_hash->arr_len == 32);
28563         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28564         LDKThirtyTwoBytes payment_secret_ref;
28565         CHECK(payment_secret->arr_len == 32);
28566         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
28567         LDKThirtyTwoBytes payment_id_ref;
28568         CHECK(payment_id->arr_len == 32);
28569         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28570         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28571         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
28572         return tag_ptr(ret_conv, true);
28573 }
28574
28575 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
28576         LDKChannelManager this_arg_conv;
28577         this_arg_conv.inner = untag_ptr(this_arg);
28578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28580         this_arg_conv.is_owned = false;
28581         LDKRoute route_conv;
28582         route_conv.inner = untag_ptr(route);
28583         route_conv.is_owned = ptr_is_owned(route);
28584         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28585         route_conv.is_owned = false;
28586         LDKThirtyTwoBytes payment_id_ref;
28587         CHECK(payment_id->arr_len == 32);
28588         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28589         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28590         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
28591         return tag_ptr(ret_conv, true);
28592 }
28593
28594 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
28595         LDKChannelManager this_arg_conv;
28596         this_arg_conv.inner = untag_ptr(this_arg);
28597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28599         this_arg_conv.is_owned = false;
28600         LDKThirtyTwoBytes payment_id_ref;
28601         CHECK(payment_id->arr_len == 32);
28602         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28603         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
28604 }
28605
28606 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, int8_tArray payment_id) {
28607         LDKChannelManager this_arg_conv;
28608         this_arg_conv.inner = untag_ptr(this_arg);
28609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28611         this_arg_conv.is_owned = false;
28612         LDKRoute route_conv;
28613         route_conv.inner = untag_ptr(route);
28614         route_conv.is_owned = ptr_is_owned(route);
28615         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28616         route_conv.is_owned = false;
28617         LDKThirtyTwoBytes payment_preimage_ref;
28618         CHECK(payment_preimage->arr_len == 32);
28619         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
28620         LDKThirtyTwoBytes payment_id_ref;
28621         CHECK(payment_id->arr_len == 32);
28622         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28623         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
28624         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref);
28625         return tag_ptr(ret_conv, true);
28626 }
28627
28628 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
28629         LDKChannelManager this_arg_conv;
28630         this_arg_conv.inner = untag_ptr(this_arg);
28631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28633         this_arg_conv.is_owned = false;
28634         LDKCVec_RouteHopZ hops_constr;
28635         hops_constr.datalen = hops->arr_len;
28636         if (hops_constr.datalen > 0)
28637                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
28638         else
28639                 hops_constr.data = NULL;
28640         uint64_t* hops_vals = hops->elems;
28641         for (size_t k = 0; k < hops_constr.datalen; k++) {
28642                 uint64_t hops_conv_10 = hops_vals[k];
28643                 LDKRouteHop hops_conv_10_conv;
28644                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
28645                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
28646                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
28647                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
28648                 hops_constr.data[k] = hops_conv_10_conv;
28649         }
28650         FREE(hops);
28651         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
28652         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
28653         return tag_ptr(ret_conv, true);
28654 }
28655
28656 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) {
28657         LDKChannelManager this_arg_conv;
28658         this_arg_conv.inner = untag_ptr(this_arg);
28659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28661         this_arg_conv.is_owned = false;
28662         unsigned char temporary_channel_id_arr[32];
28663         CHECK(temporary_channel_id->arr_len == 32);
28664         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28665         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28666         LDKPublicKey counterparty_node_id_ref;
28667         CHECK(counterparty_node_id->arr_len == 33);
28668         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28669         LDKTransaction funding_transaction_ref;
28670         funding_transaction_ref.datalen = funding_transaction->arr_len;
28671         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
28672         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
28673         funding_transaction_ref.data_is_owned = true;
28674         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28675         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
28676         return tag_ptr(ret_conv, true);
28677 }
28678
28679 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) {
28680         LDKChannelManager this_arg_conv;
28681         this_arg_conv.inner = untag_ptr(this_arg);
28682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28684         this_arg_conv.is_owned = false;
28685         LDKPublicKey counterparty_node_id_ref;
28686         CHECK(counterparty_node_id->arr_len == 33);
28687         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28688         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
28689         channel_ids_constr.datalen = channel_ids->arr_len;
28690         if (channel_ids_constr.datalen > 0)
28691                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
28692         else
28693                 channel_ids_constr.data = NULL;
28694         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
28695         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
28696                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
28697                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
28698                 CHECK(channel_ids_conv_12->arr_len == 32);
28699                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
28700                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
28701         }
28702         FREE(channel_ids);
28703         LDKChannelConfig config_conv;
28704         config_conv.inner = untag_ptr(config);
28705         config_conv.is_owned = ptr_is_owned(config);
28706         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28707         config_conv.is_owned = false;
28708         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28709         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
28710         return tag_ptr(ret_conv, true);
28711 }
28712
28713 uint64_t  __attribute__((export_name("TS_ChannelManager_forward_intercepted_htlc"))) TS_ChannelManager_forward_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray _next_node_id, int64_t amt_to_forward_msat) {
28714         LDKChannelManager this_arg_conv;
28715         this_arg_conv.inner = untag_ptr(this_arg);
28716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28718         this_arg_conv.is_owned = false;
28719         LDKThirtyTwoBytes intercept_id_ref;
28720         CHECK(intercept_id->arr_len == 32);
28721         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
28722         unsigned char next_hop_channel_id_arr[32];
28723         CHECK(next_hop_channel_id->arr_len == 32);
28724         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
28725         unsigned char (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
28726         LDKPublicKey _next_node_id_ref;
28727         CHECK(_next_node_id->arr_len == 33);
28728         memcpy(_next_node_id_ref.compressed_form, _next_node_id->elems, 33); FREE(_next_node_id);
28729         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28730         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, _next_node_id_ref, amt_to_forward_msat);
28731         return tag_ptr(ret_conv, true);
28732 }
28733
28734 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
28735         LDKChannelManager this_arg_conv;
28736         this_arg_conv.inner = untag_ptr(this_arg);
28737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28739         this_arg_conv.is_owned = false;
28740         LDKThirtyTwoBytes intercept_id_ref;
28741         CHECK(intercept_id->arr_len == 32);
28742         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
28743         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28744         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
28745         return tag_ptr(ret_conv, true);
28746 }
28747
28748 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
28749         LDKChannelManager this_arg_conv;
28750         this_arg_conv.inner = untag_ptr(this_arg);
28751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28753         this_arg_conv.is_owned = false;
28754         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
28755 }
28756
28757 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
28758         LDKChannelManager this_arg_conv;
28759         this_arg_conv.inner = untag_ptr(this_arg);
28760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28762         this_arg_conv.is_owned = false;
28763         ChannelManager_timer_tick_occurred(&this_arg_conv);
28764 }
28765
28766 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
28767         LDKChannelManager this_arg_conv;
28768         this_arg_conv.inner = untag_ptr(this_arg);
28769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28771         this_arg_conv.is_owned = false;
28772         unsigned char payment_hash_arr[32];
28773         CHECK(payment_hash->arr_len == 32);
28774         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
28775         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
28776         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
28777 }
28778
28779 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
28780         LDKChannelManager this_arg_conv;
28781         this_arg_conv.inner = untag_ptr(this_arg);
28782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28784         this_arg_conv.is_owned = false;
28785         LDKThirtyTwoBytes payment_preimage_ref;
28786         CHECK(payment_preimage->arr_len == 32);
28787         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
28788         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
28789 }
28790
28791 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
28792         LDKChannelManager this_arg_conv;
28793         this_arg_conv.inner = untag_ptr(this_arg);
28794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28796         this_arg_conv.is_owned = false;
28797         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28798         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
28799         return ret_arr;
28800 }
28801
28802 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, int8_tArray user_channel_id) {
28803         LDKChannelManager this_arg_conv;
28804         this_arg_conv.inner = untag_ptr(this_arg);
28805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28807         this_arg_conv.is_owned = false;
28808         unsigned char temporary_channel_id_arr[32];
28809         CHECK(temporary_channel_id->arr_len == 32);
28810         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28811         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28812         LDKPublicKey counterparty_node_id_ref;
28813         CHECK(counterparty_node_id->arr_len == 33);
28814         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28815         LDKU128 user_channel_id_ref;
28816         CHECK(user_channel_id->arr_len == 16);
28817         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28818         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28819         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
28820         return tag_ptr(ret_conv, true);
28821 }
28822
28823 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, int8_tArray user_channel_id) {
28824         LDKChannelManager this_arg_conv;
28825         this_arg_conv.inner = untag_ptr(this_arg);
28826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28828         this_arg_conv.is_owned = false;
28829         unsigned char temporary_channel_id_arr[32];
28830         CHECK(temporary_channel_id->arr_len == 32);
28831         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28832         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28833         LDKPublicKey counterparty_node_id_ref;
28834         CHECK(counterparty_node_id->arr_len == 33);
28835         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28836         LDKU128 user_channel_id_ref;
28837         CHECK(user_channel_id->arr_len == 16);
28838         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28839         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28840         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
28841         return tag_ptr(ret_conv, true);
28842 }
28843
28844 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) {
28845         LDKChannelManager this_arg_conv;
28846         this_arg_conv.inner = untag_ptr(this_arg);
28847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28849         this_arg_conv.is_owned = false;
28850         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28851         CHECK_ACCESS(min_value_msat_ptr);
28852         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28853         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28854         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28855         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28856         return tag_ptr(ret_conv, true);
28857 }
28858
28859 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) {
28860         LDKChannelManager this_arg_conv;
28861         this_arg_conv.inner = untag_ptr(this_arg);
28862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28864         this_arg_conv.is_owned = false;
28865         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28866         CHECK_ACCESS(min_value_msat_ptr);
28867         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28868         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28869         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
28870         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28871         return tag_ptr(ret_conv, true);
28872 }
28873
28874 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) {
28875         LDKChannelManager this_arg_conv;
28876         this_arg_conv.inner = untag_ptr(this_arg);
28877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28879         this_arg_conv.is_owned = false;
28880         LDKThirtyTwoBytes payment_hash_ref;
28881         CHECK(payment_hash->arr_len == 32);
28882         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28883         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28884         CHECK_ACCESS(min_value_msat_ptr);
28885         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28886         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28887         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28888         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28889         return tag_ptr(ret_conv, true);
28890 }
28891
28892 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) {
28893         LDKChannelManager this_arg_conv;
28894         this_arg_conv.inner = untag_ptr(this_arg);
28895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28897         this_arg_conv.is_owned = false;
28898         LDKThirtyTwoBytes payment_hash_ref;
28899         CHECK(payment_hash->arr_len == 32);
28900         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28901         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28902         CHECK_ACCESS(min_value_msat_ptr);
28903         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28904         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28905         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
28906         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28907         return tag_ptr(ret_conv, true);
28908 }
28909
28910 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) {
28911         LDKChannelManager this_arg_conv;
28912         this_arg_conv.inner = untag_ptr(this_arg);
28913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28915         this_arg_conv.is_owned = false;
28916         LDKThirtyTwoBytes payment_hash_ref;
28917         CHECK(payment_hash->arr_len == 32);
28918         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28919         LDKThirtyTwoBytes payment_secret_ref;
28920         CHECK(payment_secret->arr_len == 32);
28921         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
28922         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
28923         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
28924         return tag_ptr(ret_conv, true);
28925 }
28926
28927 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
28928         LDKChannelManager this_arg_conv;
28929         this_arg_conv.inner = untag_ptr(this_arg);
28930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28932         this_arg_conv.is_owned = false;
28933         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
28934         return ret_conv;
28935 }
28936
28937 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
28938         LDKChannelManager this_arg_conv;
28939         this_arg_conv.inner = untag_ptr(this_arg);
28940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28942         this_arg_conv.is_owned = false;
28943         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
28944         uint64_t ret_ref = 0;
28945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28947         return ret_ref;
28948 }
28949
28950 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
28951         LDKChannelManager this_arg_conv;
28952         this_arg_conv.inner = untag_ptr(this_arg);
28953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28955         this_arg_conv.is_owned = false;
28956         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
28957         return ret_conv;
28958 }
28959
28960 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
28961         LDKChannelManager this_arg_conv;
28962         this_arg_conv.inner = untag_ptr(this_arg);
28963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28965         this_arg_conv.is_owned = false;
28966         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
28967         uint64_t ret_ref = 0;
28968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28970         return ret_ref;
28971 }
28972
28973 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
28974         LDKChannelManager this_arg_conv;
28975         this_arg_conv.inner = untag_ptr(this_arg);
28976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28978         this_arg_conv.is_owned = false;
28979         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28980         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
28981         return tag_ptr(ret_ret, true);
28982 }
28983
28984 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
28985         LDKChannelManager this_arg_conv;
28986         this_arg_conv.inner = untag_ptr(this_arg);
28987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28989         this_arg_conv.is_owned = false;
28990         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
28991         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
28992         return tag_ptr(ret_ret, true);
28993 }
28994
28995 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
28996         LDKChannelManager this_arg_conv;
28997         this_arg_conv.inner = untag_ptr(this_arg);
28998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29000         this_arg_conv.is_owned = false;
29001         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29002         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29003         return tag_ptr(ret_ret, true);
29004 }
29005
29006 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29007         LDKChannelManager this_arg_conv;
29008         this_arg_conv.inner = untag_ptr(this_arg);
29009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29011         this_arg_conv.is_owned = false;
29012         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29013         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29014         return tag_ptr(ret_ret, true);
29015 }
29016
29017 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
29018         LDKChannelManager this_arg_conv;
29019         this_arg_conv.inner = untag_ptr(this_arg);
29020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29022         this_arg_conv.is_owned = false;
29023         ChannelManager_await_persistable_update(&this_arg_conv);
29024 }
29025
29026 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29027         LDKChannelManager this_arg_conv;
29028         this_arg_conv.inner = untag_ptr(this_arg);
29029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29031         this_arg_conv.is_owned = false;
29032         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29033         uint64_t ret_ref = 0;
29034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29036         return ret_ref;
29037 }
29038
29039 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29040         LDKChannelManager this_arg_conv;
29041         this_arg_conv.inner = untag_ptr(this_arg);
29042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29044         this_arg_conv.is_owned = false;
29045         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29046         uint64_t ret_ref = 0;
29047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29049         return ret_ref;
29050 }
29051
29052 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29053         LDKChannelManager this_arg_conv;
29054         this_arg_conv.inner = untag_ptr(this_arg);
29055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29057         this_arg_conv.is_owned = false;
29058         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29059         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29060         return tag_ptr(ret_ret, true);
29061 }
29062
29063 uint64_t  __attribute__((export_name("TS_provided_node_features"))) TS_provided_node_features() {
29064         LDKNodeFeatures ret_var = provided_node_features();
29065         uint64_t ret_ref = 0;
29066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29068         return ret_ref;
29069 }
29070
29071 uint64_t  __attribute__((export_name("TS_provided_channel_features"))) TS_provided_channel_features() {
29072         LDKChannelFeatures ret_var = provided_channel_features();
29073         uint64_t ret_ref = 0;
29074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29076         return ret_ref;
29077 }
29078
29079 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features() {
29080         LDKInitFeatures ret_var = provided_init_features();
29081         uint64_t ret_ref = 0;
29082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29084         return ret_ref;
29085 }
29086
29087 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29088         LDKCounterpartyForwardingInfo obj_conv;
29089         obj_conv.inner = untag_ptr(obj);
29090         obj_conv.is_owned = ptr_is_owned(obj);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29092         obj_conv.is_owned = false;
29093         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29094         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29095         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29096         CVec_u8Z_free(ret_var);
29097         return ret_arr;
29098 }
29099
29100 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29101         LDKu8slice ser_ref;
29102         ser_ref.datalen = ser->arr_len;
29103         ser_ref.data = ser->elems;
29104         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29105         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29106         FREE(ser);
29107         return tag_ptr(ret_conv, true);
29108 }
29109
29110 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29111         LDKChannelCounterparty obj_conv;
29112         obj_conv.inner = untag_ptr(obj);
29113         obj_conv.is_owned = ptr_is_owned(obj);
29114         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29115         obj_conv.is_owned = false;
29116         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29119         CVec_u8Z_free(ret_var);
29120         return ret_arr;
29121 }
29122
29123 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29124         LDKu8slice ser_ref;
29125         ser_ref.datalen = ser->arr_len;
29126         ser_ref.data = ser->elems;
29127         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29128         *ret_conv = ChannelCounterparty_read(ser_ref);
29129         FREE(ser);
29130         return tag_ptr(ret_conv, true);
29131 }
29132
29133 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29134         LDKChannelDetails obj_conv;
29135         obj_conv.inner = untag_ptr(obj);
29136         obj_conv.is_owned = ptr_is_owned(obj);
29137         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29138         obj_conv.is_owned = false;
29139         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29140         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29141         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29142         CVec_u8Z_free(ret_var);
29143         return ret_arr;
29144 }
29145
29146 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29147         LDKu8slice ser_ref;
29148         ser_ref.datalen = ser->arr_len;
29149         ser_ref.data = ser->elems;
29150         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29151         *ret_conv = ChannelDetails_read(ser_ref);
29152         FREE(ser);
29153         return tag_ptr(ret_conv, true);
29154 }
29155
29156 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29157         LDKPhantomRouteHints obj_conv;
29158         obj_conv.inner = untag_ptr(obj);
29159         obj_conv.is_owned = ptr_is_owned(obj);
29160         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29161         obj_conv.is_owned = false;
29162         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29163         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29164         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29165         CVec_u8Z_free(ret_var);
29166         return ret_arr;
29167 }
29168
29169 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29170         LDKu8slice ser_ref;
29171         ser_ref.datalen = ser->arr_len;
29172         ser_ref.data = ser->elems;
29173         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29174         *ret_conv = PhantomRouteHints_read(ser_ref);
29175         FREE(ser);
29176         return tag_ptr(ret_conv, true);
29177 }
29178
29179 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29180         LDKChannelManager obj_conv;
29181         obj_conv.inner = untag_ptr(obj);
29182         obj_conv.is_owned = ptr_is_owned(obj);
29183         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29184         obj_conv.is_owned = false;
29185         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29186         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29187         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29188         CVec_u8Z_free(ret_var);
29189         return ret_arr;
29190 }
29191
29192 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29193         LDKChannelManagerReadArgs this_obj_conv;
29194         this_obj_conv.inner = untag_ptr(this_obj);
29195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29197         ChannelManagerReadArgs_free(this_obj_conv);
29198 }
29199
29200 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
29201         LDKChannelManagerReadArgs this_ptr_conv;
29202         this_ptr_conv.inner = untag_ptr(this_ptr);
29203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29205         this_ptr_conv.is_owned = false;
29206         // WARNING: This object doesn't live past this scope, needs clone!
29207         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
29208         return ret_ret;
29209 }
29210
29211 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
29212         LDKChannelManagerReadArgs this_ptr_conv;
29213         this_ptr_conv.inner = untag_ptr(this_ptr);
29214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29216         this_ptr_conv.is_owned = false;
29217         void* val_ptr = untag_ptr(val);
29218         CHECK_ACCESS(val_ptr);
29219         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29220         if (val_conv.free == LDKKeysInterface_JCalls_free) {
29221                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29222                 LDKKeysInterface_JCalls_cloned(&val_conv);
29223         }
29224         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29225 }
29226
29227 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29228         LDKChannelManagerReadArgs this_ptr_conv;
29229         this_ptr_conv.inner = untag_ptr(this_ptr);
29230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29232         this_ptr_conv.is_owned = false;
29233         // WARNING: This object doesn't live past this scope, needs clone!
29234         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29235         return ret_ret;
29236 }
29237
29238 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29239         LDKChannelManagerReadArgs this_ptr_conv;
29240         this_ptr_conv.inner = untag_ptr(this_ptr);
29241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29243         this_ptr_conv.is_owned = false;
29244         void* val_ptr = untag_ptr(val);
29245         CHECK_ACCESS(val_ptr);
29246         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29247         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29248                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29249                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29250         }
29251         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29252 }
29253
29254 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29255         LDKChannelManagerReadArgs this_ptr_conv;
29256         this_ptr_conv.inner = untag_ptr(this_ptr);
29257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29259         this_ptr_conv.is_owned = false;
29260         // WARNING: This object doesn't live past this scope, needs clone!
29261         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29262         return ret_ret;
29263 }
29264
29265 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29266         LDKChannelManagerReadArgs this_ptr_conv;
29267         this_ptr_conv.inner = untag_ptr(this_ptr);
29268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29270         this_ptr_conv.is_owned = false;
29271         void* val_ptr = untag_ptr(val);
29272         CHECK_ACCESS(val_ptr);
29273         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29274         if (val_conv.free == LDKWatch_JCalls_free) {
29275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29276                 LDKWatch_JCalls_cloned(&val_conv);
29277         }
29278         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29279 }
29280
29281 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29282         LDKChannelManagerReadArgs this_ptr_conv;
29283         this_ptr_conv.inner = untag_ptr(this_ptr);
29284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29286         this_ptr_conv.is_owned = false;
29287         // WARNING: This object doesn't live past this scope, needs clone!
29288         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29289         return ret_ret;
29290 }
29291
29292 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29293         LDKChannelManagerReadArgs this_ptr_conv;
29294         this_ptr_conv.inner = untag_ptr(this_ptr);
29295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29297         this_ptr_conv.is_owned = false;
29298         void* val_ptr = untag_ptr(val);
29299         CHECK_ACCESS(val_ptr);
29300         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29301         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29303                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29304         }
29305         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29306 }
29307
29308 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29309         LDKChannelManagerReadArgs this_ptr_conv;
29310         this_ptr_conv.inner = untag_ptr(this_ptr);
29311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29313         this_ptr_conv.is_owned = false;
29314         // WARNING: This object doesn't live past this scope, needs clone!
29315         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29316         return ret_ret;
29317 }
29318
29319 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29320         LDKChannelManagerReadArgs this_ptr_conv;
29321         this_ptr_conv.inner = untag_ptr(this_ptr);
29322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29324         this_ptr_conv.is_owned = false;
29325         void* val_ptr = untag_ptr(val);
29326         CHECK_ACCESS(val_ptr);
29327         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29328         if (val_conv.free == LDKLogger_JCalls_free) {
29329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29330                 LDKLogger_JCalls_cloned(&val_conv);
29331         }
29332         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29333 }
29334
29335 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29336         LDKChannelManagerReadArgs this_ptr_conv;
29337         this_ptr_conv.inner = untag_ptr(this_ptr);
29338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29340         this_ptr_conv.is_owned = false;
29341         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29342         uint64_t ret_ref = 0;
29343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29345         return ret_ref;
29346 }
29347
29348 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29349         LDKChannelManagerReadArgs this_ptr_conv;
29350         this_ptr_conv.inner = untag_ptr(this_ptr);
29351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29353         this_ptr_conv.is_owned = false;
29354         LDKUserConfig val_conv;
29355         val_conv.inner = untag_ptr(val);
29356         val_conv.is_owned = ptr_is_owned(val);
29357         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29358         val_conv = UserConfig_clone(&val_conv);
29359         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29360 }
29361
29362 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) {
29363         void* keys_manager_ptr = untag_ptr(keys_manager);
29364         CHECK_ACCESS(keys_manager_ptr);
29365         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29366         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29367                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29368                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29369         }
29370         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29371         CHECK_ACCESS(fee_estimator_ptr);
29372         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29373         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29375                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29376         }
29377         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29378         CHECK_ACCESS(chain_monitor_ptr);
29379         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29380         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29382                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29383         }
29384         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29385         CHECK_ACCESS(tx_broadcaster_ptr);
29386         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29387         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29389                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29390         }
29391         void* logger_ptr = untag_ptr(logger);
29392         CHECK_ACCESS(logger_ptr);
29393         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29394         if (logger_conv.free == LDKLogger_JCalls_free) {
29395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29396                 LDKLogger_JCalls_cloned(&logger_conv);
29397         }
29398         LDKUserConfig default_config_conv;
29399         default_config_conv.inner = untag_ptr(default_config);
29400         default_config_conv.is_owned = ptr_is_owned(default_config);
29401         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29402         default_config_conv = UserConfig_clone(&default_config_conv);
29403         LDKCVec_ChannelMonitorZ channel_monitors_constr;
29404         channel_monitors_constr.datalen = channel_monitors->arr_len;
29405         if (channel_monitors_constr.datalen > 0)
29406                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29407         else
29408                 channel_monitors_constr.data = NULL;
29409         uint64_t* channel_monitors_vals = channel_monitors->elems;
29410         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29411                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29412                 LDKChannelMonitor channel_monitors_conv_16_conv;
29413                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
29414                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
29415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29416                 channel_monitors_conv_16_conv.is_owned = false;
29417                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29418         }
29419         FREE(channel_monitors);
29420         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);
29421         uint64_t ret_ref = 0;
29422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29424         return ret_ref;
29425 }
29426
29427 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
29428         LDKu8slice ser_ref;
29429         ser_ref.datalen = ser->arr_len;
29430         ser_ref.data = ser->elems;
29431         LDKChannelManagerReadArgs arg_conv;
29432         arg_conv.inner = untag_ptr(arg);
29433         arg_conv.is_owned = ptr_is_owned(arg);
29434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29435         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29436         
29437         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29438         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29439         FREE(ser);
29440         return tag_ptr(ret_conv, true);
29441 }
29442
29443 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
29444         LDKExpandedKey this_obj_conv;
29445         this_obj_conv.inner = untag_ptr(this_obj);
29446         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29448         ExpandedKey_free(this_obj_conv);
29449 }
29450
29451 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
29452         unsigned char key_material_arr[32];
29453         CHECK(key_material->arr_len == 32);
29454         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
29455         unsigned char (*key_material_ref)[32] = &key_material_arr;
29456         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
29457         uint64_t ret_ref = 0;
29458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29460         return ret_ref;
29461 }
29462
29463 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) {
29464         LDKExpandedKey keys_conv;
29465         keys_conv.inner = untag_ptr(keys);
29466         keys_conv.is_owned = ptr_is_owned(keys);
29467         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29468         keys_conv.is_owned = false;
29469         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29470         CHECK_ACCESS(min_value_msat_ptr);
29471         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29472         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29473         void* keys_manager_ptr = untag_ptr(keys_manager);
29474         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
29475         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
29476         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29477         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
29478         return tag_ptr(ret_conv, true);
29479 }
29480
29481 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) {
29482         LDKExpandedKey keys_conv;
29483         keys_conv.inner = untag_ptr(keys);
29484         keys_conv.is_owned = ptr_is_owned(keys);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29486         keys_conv.is_owned = false;
29487         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29488         CHECK_ACCESS(min_value_msat_ptr);
29489         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29490         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29491         LDKThirtyTwoBytes payment_hash_ref;
29492         CHECK(payment_hash->arr_len == 32);
29493         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29494         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29495         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
29496         return tag_ptr(ret_conv, true);
29497 }
29498
29499 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
29500         if (!ptr_is_owned(this_ptr)) return;
29501         void* this_ptr_ptr = untag_ptr(this_ptr);
29502         CHECK_ACCESS(this_ptr_ptr);
29503         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
29504         FREE(untag_ptr(this_ptr));
29505         DecodeError_free(this_ptr_conv);
29506 }
29507
29508 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29509         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29510         *ret_copy = DecodeError_clone(arg);
29511         uint64_t ret_ref = tag_ptr(ret_copy, true);
29512         return ret_ref;
29513 }
29514 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
29515         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
29516         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
29517         return ret_conv;
29518 }
29519
29520 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
29521         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
29522         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29523         *ret_copy = DecodeError_clone(orig_conv);
29524         uint64_t ret_ref = tag_ptr(ret_copy, true);
29525         return ret_ref;
29526 }
29527
29528 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
29529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29530         *ret_copy = DecodeError_unknown_version();
29531         uint64_t ret_ref = tag_ptr(ret_copy, true);
29532         return ret_ref;
29533 }
29534
29535 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
29536         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29537         *ret_copy = DecodeError_unknown_required_feature();
29538         uint64_t ret_ref = tag_ptr(ret_copy, true);
29539         return ret_ref;
29540 }
29541
29542 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
29543         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29544         *ret_copy = DecodeError_invalid_value();
29545         uint64_t ret_ref = tag_ptr(ret_copy, true);
29546         return ret_ref;
29547 }
29548
29549 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
29550         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29551         *ret_copy = DecodeError_short_read();
29552         uint64_t ret_ref = tag_ptr(ret_copy, true);
29553         return ret_ref;
29554 }
29555
29556 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
29557         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29558         *ret_copy = DecodeError_bad_length_descriptor();
29559         uint64_t ret_ref = tag_ptr(ret_copy, true);
29560         return ret_ref;
29561 }
29562
29563 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
29564         LDKIOError a_conv = LDKIOError_from_js(a);
29565         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29566         *ret_copy = DecodeError_io(a_conv);
29567         uint64_t ret_ref = tag_ptr(ret_copy, true);
29568         return ret_ref;
29569 }
29570
29571 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
29572         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29573         *ret_copy = DecodeError_unsupported_compression();
29574         uint64_t ret_ref = tag_ptr(ret_copy, true);
29575         return ret_ref;
29576 }
29577
29578 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
29579         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
29580         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
29581         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
29582         return ret_conv;
29583 }
29584
29585 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
29586         LDKInit this_obj_conv;
29587         this_obj_conv.inner = untag_ptr(this_obj);
29588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29590         Init_free(this_obj_conv);
29591 }
29592
29593 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
29594         LDKInit this_ptr_conv;
29595         this_ptr_conv.inner = untag_ptr(this_ptr);
29596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29598         this_ptr_conv.is_owned = false;
29599         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29600         uint64_t ret_ref = 0;
29601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29603         return ret_ref;
29604 }
29605
29606 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
29607         LDKInit this_ptr_conv;
29608         this_ptr_conv.inner = untag_ptr(this_ptr);
29609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29611         this_ptr_conv.is_owned = false;
29612         LDKInitFeatures val_conv;
29613         val_conv.inner = untag_ptr(val);
29614         val_conv.is_owned = ptr_is_owned(val);
29615         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29616         val_conv = InitFeatures_clone(&val_conv);
29617         Init_set_features(&this_ptr_conv, val_conv);
29618 }
29619
29620 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
29621         LDKInit this_ptr_conv;
29622         this_ptr_conv.inner = untag_ptr(this_ptr);
29623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29625         this_ptr_conv.is_owned = false;
29626         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
29627         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
29628         uint64_t ret_ref = tag_ptr(ret_copy, true);
29629         return ret_ref;
29630 }
29631
29632 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
29633         LDKInit 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         void* val_ptr = untag_ptr(val);
29639         CHECK_ACCESS(val_ptr);
29640         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
29641         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
29642         Init_set_remote_network_address(&this_ptr_conv, val_conv);
29643 }
29644
29645 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
29646         LDKInitFeatures features_arg_conv;
29647         features_arg_conv.inner = untag_ptr(features_arg);
29648         features_arg_conv.is_owned = ptr_is_owned(features_arg);
29649         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29650         features_arg_conv = InitFeatures_clone(&features_arg_conv);
29651         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
29652         CHECK_ACCESS(remote_network_address_arg_ptr);
29653         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
29654         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
29655         uint64_t ret_ref = 0;
29656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29658         return ret_ref;
29659 }
29660
29661 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
29662         LDKInit ret_var = Init_clone(arg);
29663         uint64_t ret_ref = 0;
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29666         return ret_ref;
29667 }
29668 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
29669         LDKInit arg_conv;
29670         arg_conv.inner = untag_ptr(arg);
29671         arg_conv.is_owned = ptr_is_owned(arg);
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29673         arg_conv.is_owned = false;
29674         int64_t ret_conv = Init_clone_ptr(&arg_conv);
29675         return ret_conv;
29676 }
29677
29678 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
29679         LDKInit orig_conv;
29680         orig_conv.inner = untag_ptr(orig);
29681         orig_conv.is_owned = ptr_is_owned(orig);
29682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29683         orig_conv.is_owned = false;
29684         LDKInit ret_var = Init_clone(&orig_conv);
29685         uint64_t ret_ref = 0;
29686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29688         return ret_ref;
29689 }
29690
29691 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
29692         LDKInit a_conv;
29693         a_conv.inner = untag_ptr(a);
29694         a_conv.is_owned = ptr_is_owned(a);
29695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29696         a_conv.is_owned = false;
29697         LDKInit b_conv;
29698         b_conv.inner = untag_ptr(b);
29699         b_conv.is_owned = ptr_is_owned(b);
29700         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29701         b_conv.is_owned = false;
29702         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
29703         return ret_conv;
29704 }
29705
29706 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
29707         LDKErrorMessage this_obj_conv;
29708         this_obj_conv.inner = untag_ptr(this_obj);
29709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29711         ErrorMessage_free(this_obj_conv);
29712 }
29713
29714 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
29715         LDKErrorMessage this_ptr_conv;
29716         this_ptr_conv.inner = untag_ptr(this_ptr);
29717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29719         this_ptr_conv.is_owned = false;
29720         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29721         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
29722         return ret_arr;
29723 }
29724
29725 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29726         LDKErrorMessage this_ptr_conv;
29727         this_ptr_conv.inner = untag_ptr(this_ptr);
29728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29730         this_ptr_conv.is_owned = false;
29731         LDKThirtyTwoBytes val_ref;
29732         CHECK(val->arr_len == 32);
29733         memcpy(val_ref.data, val->elems, 32); FREE(val);
29734         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
29735 }
29736
29737 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
29738         LDKErrorMessage this_ptr_conv;
29739         this_ptr_conv.inner = untag_ptr(this_ptr);
29740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29742         this_ptr_conv.is_owned = false;
29743         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
29744         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29745         Str_free(ret_str);
29746         return ret_conv;
29747 }
29748
29749 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
29750         LDKErrorMessage this_ptr_conv;
29751         this_ptr_conv.inner = untag_ptr(this_ptr);
29752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29754         this_ptr_conv.is_owned = false;
29755         LDKStr val_conv = str_ref_to_owned_c(val);
29756         ErrorMessage_set_data(&this_ptr_conv, val_conv);
29757 }
29758
29759 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
29760         LDKThirtyTwoBytes channel_id_arg_ref;
29761         CHECK(channel_id_arg->arr_len == 32);
29762         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29763         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
29764         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
29765         uint64_t ret_ref = 0;
29766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29768         return ret_ref;
29769 }
29770
29771 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
29772         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
29773         uint64_t ret_ref = 0;
29774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29776         return ret_ref;
29777 }
29778 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
29779         LDKErrorMessage arg_conv;
29780         arg_conv.inner = untag_ptr(arg);
29781         arg_conv.is_owned = ptr_is_owned(arg);
29782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29783         arg_conv.is_owned = false;
29784         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
29785         return ret_conv;
29786 }
29787
29788 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
29789         LDKErrorMessage orig_conv;
29790         orig_conv.inner = untag_ptr(orig);
29791         orig_conv.is_owned = ptr_is_owned(orig);
29792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29793         orig_conv.is_owned = false;
29794         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
29795         uint64_t ret_ref = 0;
29796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29798         return ret_ref;
29799 }
29800
29801 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
29802         LDKErrorMessage a_conv;
29803         a_conv.inner = untag_ptr(a);
29804         a_conv.is_owned = ptr_is_owned(a);
29805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29806         a_conv.is_owned = false;
29807         LDKErrorMessage b_conv;
29808         b_conv.inner = untag_ptr(b);
29809         b_conv.is_owned = ptr_is_owned(b);
29810         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29811         b_conv.is_owned = false;
29812         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
29813         return ret_conv;
29814 }
29815
29816 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
29817         LDKWarningMessage this_obj_conv;
29818         this_obj_conv.inner = untag_ptr(this_obj);
29819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29821         WarningMessage_free(this_obj_conv);
29822 }
29823
29824 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
29825         LDKWarningMessage 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29831         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
29832         return ret_arr;
29833 }
29834
29835 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29836         LDKWarningMessage this_ptr_conv;
29837         this_ptr_conv.inner = untag_ptr(this_ptr);
29838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29840         this_ptr_conv.is_owned = false;
29841         LDKThirtyTwoBytes val_ref;
29842         CHECK(val->arr_len == 32);
29843         memcpy(val_ref.data, val->elems, 32); FREE(val);
29844         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
29845 }
29846
29847 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
29848         LDKWarningMessage this_ptr_conv;
29849         this_ptr_conv.inner = untag_ptr(this_ptr);
29850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29852         this_ptr_conv.is_owned = false;
29853         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
29854         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29855         Str_free(ret_str);
29856         return ret_conv;
29857 }
29858
29859 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
29860         LDKWarningMessage this_ptr_conv;
29861         this_ptr_conv.inner = untag_ptr(this_ptr);
29862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29864         this_ptr_conv.is_owned = false;
29865         LDKStr val_conv = str_ref_to_owned_c(val);
29866         WarningMessage_set_data(&this_ptr_conv, val_conv);
29867 }
29868
29869 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
29870         LDKThirtyTwoBytes channel_id_arg_ref;
29871         CHECK(channel_id_arg->arr_len == 32);
29872         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29873         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
29874         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
29875         uint64_t ret_ref = 0;
29876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29878         return ret_ref;
29879 }
29880
29881 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
29882         LDKWarningMessage ret_var = WarningMessage_clone(arg);
29883         uint64_t ret_ref = 0;
29884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29886         return ret_ref;
29887 }
29888 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
29889         LDKWarningMessage arg_conv;
29890         arg_conv.inner = untag_ptr(arg);
29891         arg_conv.is_owned = ptr_is_owned(arg);
29892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29893         arg_conv.is_owned = false;
29894         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
29895         return ret_conv;
29896 }
29897
29898 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
29899         LDKWarningMessage orig_conv;
29900         orig_conv.inner = untag_ptr(orig);
29901         orig_conv.is_owned = ptr_is_owned(orig);
29902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29903         orig_conv.is_owned = false;
29904         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
29905         uint64_t ret_ref = 0;
29906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29908         return ret_ref;
29909 }
29910
29911 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
29912         LDKWarningMessage a_conv;
29913         a_conv.inner = untag_ptr(a);
29914         a_conv.is_owned = ptr_is_owned(a);
29915         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29916         a_conv.is_owned = false;
29917         LDKWarningMessage b_conv;
29918         b_conv.inner = untag_ptr(b);
29919         b_conv.is_owned = ptr_is_owned(b);
29920         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29921         b_conv.is_owned = false;
29922         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
29923         return ret_conv;
29924 }
29925
29926 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
29927         LDKPing this_obj_conv;
29928         this_obj_conv.inner = untag_ptr(this_obj);
29929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29931         Ping_free(this_obj_conv);
29932 }
29933
29934 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
29935         LDKPing this_ptr_conv;
29936         this_ptr_conv.inner = untag_ptr(this_ptr);
29937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29939         this_ptr_conv.is_owned = false;
29940         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
29941         return ret_conv;
29942 }
29943
29944 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
29945         LDKPing this_ptr_conv;
29946         this_ptr_conv.inner = untag_ptr(this_ptr);
29947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29949         this_ptr_conv.is_owned = false;
29950         Ping_set_ponglen(&this_ptr_conv, val);
29951 }
29952
29953 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
29954         LDKPing this_ptr_conv;
29955         this_ptr_conv.inner = untag_ptr(this_ptr);
29956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29958         this_ptr_conv.is_owned = false;
29959         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
29960         return ret_conv;
29961 }
29962
29963 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
29964         LDKPing this_ptr_conv;
29965         this_ptr_conv.inner = untag_ptr(this_ptr);
29966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29968         this_ptr_conv.is_owned = false;
29969         Ping_set_byteslen(&this_ptr_conv, val);
29970 }
29971
29972 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
29973         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
29974         uint64_t ret_ref = 0;
29975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29977         return ret_ref;
29978 }
29979
29980 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
29981         LDKPing ret_var = Ping_clone(arg);
29982         uint64_t ret_ref = 0;
29983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29985         return ret_ref;
29986 }
29987 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
29988         LDKPing arg_conv;
29989         arg_conv.inner = untag_ptr(arg);
29990         arg_conv.is_owned = ptr_is_owned(arg);
29991         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29992         arg_conv.is_owned = false;
29993         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
29994         return ret_conv;
29995 }
29996
29997 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
29998         LDKPing orig_conv;
29999         orig_conv.inner = untag_ptr(orig);
30000         orig_conv.is_owned = ptr_is_owned(orig);
30001         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30002         orig_conv.is_owned = false;
30003         LDKPing ret_var = Ping_clone(&orig_conv);
30004         uint64_t ret_ref = 0;
30005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30007         return ret_ref;
30008 }
30009
30010 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30011         LDKPing a_conv;
30012         a_conv.inner = untag_ptr(a);
30013         a_conv.is_owned = ptr_is_owned(a);
30014         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30015         a_conv.is_owned = false;
30016         LDKPing b_conv;
30017         b_conv.inner = untag_ptr(b);
30018         b_conv.is_owned = ptr_is_owned(b);
30019         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30020         b_conv.is_owned = false;
30021         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30022         return ret_conv;
30023 }
30024
30025 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30026         LDKPong this_obj_conv;
30027         this_obj_conv.inner = untag_ptr(this_obj);
30028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30030         Pong_free(this_obj_conv);
30031 }
30032
30033 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30034         LDKPong this_ptr_conv;
30035         this_ptr_conv.inner = untag_ptr(this_ptr);
30036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30038         this_ptr_conv.is_owned = false;
30039         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30040         return ret_conv;
30041 }
30042
30043 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30044         LDKPong this_ptr_conv;
30045         this_ptr_conv.inner = untag_ptr(this_ptr);
30046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30048         this_ptr_conv.is_owned = false;
30049         Pong_set_byteslen(&this_ptr_conv, val);
30050 }
30051
30052 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30053         LDKPong ret_var = Pong_new(byteslen_arg);
30054         uint64_t ret_ref = 0;
30055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30057         return ret_ref;
30058 }
30059
30060 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30061         LDKPong ret_var = Pong_clone(arg);
30062         uint64_t ret_ref = 0;
30063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30065         return ret_ref;
30066 }
30067 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30068         LDKPong arg_conv;
30069         arg_conv.inner = untag_ptr(arg);
30070         arg_conv.is_owned = ptr_is_owned(arg);
30071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30072         arg_conv.is_owned = false;
30073         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30074         return ret_conv;
30075 }
30076
30077 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30078         LDKPong orig_conv;
30079         orig_conv.inner = untag_ptr(orig);
30080         orig_conv.is_owned = ptr_is_owned(orig);
30081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30082         orig_conv.is_owned = false;
30083         LDKPong ret_var = Pong_clone(&orig_conv);
30084         uint64_t ret_ref = 0;
30085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30087         return ret_ref;
30088 }
30089
30090 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30091         LDKPong a_conv;
30092         a_conv.inner = untag_ptr(a);
30093         a_conv.is_owned = ptr_is_owned(a);
30094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30095         a_conv.is_owned = false;
30096         LDKPong b_conv;
30097         b_conv.inner = untag_ptr(b);
30098         b_conv.is_owned = ptr_is_owned(b);
30099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30100         b_conv.is_owned = false;
30101         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30102         return ret_conv;
30103 }
30104
30105 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30106         LDKOpenChannel this_obj_conv;
30107         this_obj_conv.inner = untag_ptr(this_obj);
30108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30110         OpenChannel_free(this_obj_conv);
30111 }
30112
30113 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30114         LDKOpenChannel this_ptr_conv;
30115         this_ptr_conv.inner = untag_ptr(this_ptr);
30116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30118         this_ptr_conv.is_owned = false;
30119         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30120         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30121         return ret_arr;
30122 }
30123
30124 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30125         LDKOpenChannel this_ptr_conv;
30126         this_ptr_conv.inner = untag_ptr(this_ptr);
30127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30129         this_ptr_conv.is_owned = false;
30130         LDKThirtyTwoBytes val_ref;
30131         CHECK(val->arr_len == 32);
30132         memcpy(val_ref.data, val->elems, 32); FREE(val);
30133         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30134 }
30135
30136 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30137         LDKOpenChannel this_ptr_conv;
30138         this_ptr_conv.inner = untag_ptr(this_ptr);
30139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30141         this_ptr_conv.is_owned = false;
30142         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30143         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30144         return ret_arr;
30145 }
30146
30147 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30148         LDKOpenChannel this_ptr_conv;
30149         this_ptr_conv.inner = untag_ptr(this_ptr);
30150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30152         this_ptr_conv.is_owned = false;
30153         LDKThirtyTwoBytes val_ref;
30154         CHECK(val->arr_len == 32);
30155         memcpy(val_ref.data, val->elems, 32); FREE(val);
30156         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30157 }
30158
30159 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30160         LDKOpenChannel this_ptr_conv;
30161         this_ptr_conv.inner = untag_ptr(this_ptr);
30162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30164         this_ptr_conv.is_owned = false;
30165         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30166         return ret_conv;
30167 }
30168
30169 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30170         LDKOpenChannel this_ptr_conv;
30171         this_ptr_conv.inner = untag_ptr(this_ptr);
30172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30174         this_ptr_conv.is_owned = false;
30175         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30176 }
30177
30178 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30179         LDKOpenChannel this_ptr_conv;
30180         this_ptr_conv.inner = untag_ptr(this_ptr);
30181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30183         this_ptr_conv.is_owned = false;
30184         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30185         return ret_conv;
30186 }
30187
30188 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30189         LDKOpenChannel this_ptr_conv;
30190         this_ptr_conv.inner = untag_ptr(this_ptr);
30191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30193         this_ptr_conv.is_owned = false;
30194         OpenChannel_set_push_msat(&this_ptr_conv, val);
30195 }
30196
30197 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30198         LDKOpenChannel this_ptr_conv;
30199         this_ptr_conv.inner = untag_ptr(this_ptr);
30200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30202         this_ptr_conv.is_owned = false;
30203         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30204         return ret_conv;
30205 }
30206
30207 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30208         LDKOpenChannel this_ptr_conv;
30209         this_ptr_conv.inner = untag_ptr(this_ptr);
30210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30212         this_ptr_conv.is_owned = false;
30213         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30214 }
30215
30216 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) {
30217         LDKOpenChannel this_ptr_conv;
30218         this_ptr_conv.inner = untag_ptr(this_ptr);
30219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30221         this_ptr_conv.is_owned = false;
30222         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30223         return ret_conv;
30224 }
30225
30226 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) {
30227         LDKOpenChannel this_ptr_conv;
30228         this_ptr_conv.inner = untag_ptr(this_ptr);
30229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30231         this_ptr_conv.is_owned = false;
30232         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30233 }
30234
30235 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30236         LDKOpenChannel this_ptr_conv;
30237         this_ptr_conv.inner = untag_ptr(this_ptr);
30238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30240         this_ptr_conv.is_owned = false;
30241         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30242         return ret_conv;
30243 }
30244
30245 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30246         LDKOpenChannel 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         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30252 }
30253
30254 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30255         LDKOpenChannel this_ptr_conv;
30256         this_ptr_conv.inner = untag_ptr(this_ptr);
30257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30259         this_ptr_conv.is_owned = false;
30260         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30261         return ret_conv;
30262 }
30263
30264 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30265         LDKOpenChannel this_ptr_conv;
30266         this_ptr_conv.inner = untag_ptr(this_ptr);
30267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30269         this_ptr_conv.is_owned = false;
30270         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30271 }
30272
30273 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30274         LDKOpenChannel this_ptr_conv;
30275         this_ptr_conv.inner = untag_ptr(this_ptr);
30276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30278         this_ptr_conv.is_owned = false;
30279         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30280         return ret_conv;
30281 }
30282
30283 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30284         LDKOpenChannel this_ptr_conv;
30285         this_ptr_conv.inner = untag_ptr(this_ptr);
30286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30288         this_ptr_conv.is_owned = false;
30289         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30290 }
30291
30292 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30293         LDKOpenChannel this_ptr_conv;
30294         this_ptr_conv.inner = untag_ptr(this_ptr);
30295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30297         this_ptr_conv.is_owned = false;
30298         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30299         return ret_conv;
30300 }
30301
30302 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30303         LDKOpenChannel this_ptr_conv;
30304         this_ptr_conv.inner = untag_ptr(this_ptr);
30305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30307         this_ptr_conv.is_owned = false;
30308         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30309 }
30310
30311 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30312         LDKOpenChannel this_ptr_conv;
30313         this_ptr_conv.inner = untag_ptr(this_ptr);
30314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30316         this_ptr_conv.is_owned = false;
30317         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30318         return ret_conv;
30319 }
30320
30321 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30322         LDKOpenChannel this_ptr_conv;
30323         this_ptr_conv.inner = untag_ptr(this_ptr);
30324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30326         this_ptr_conv.is_owned = false;
30327         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30328 }
30329
30330 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30331         LDKOpenChannel this_ptr_conv;
30332         this_ptr_conv.inner = untag_ptr(this_ptr);
30333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30335         this_ptr_conv.is_owned = false;
30336         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30337         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30338         return ret_arr;
30339 }
30340
30341 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30342         LDKOpenChannel this_ptr_conv;
30343         this_ptr_conv.inner = untag_ptr(this_ptr);
30344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30346         this_ptr_conv.is_owned = false;
30347         LDKPublicKey val_ref;
30348         CHECK(val->arr_len == 33);
30349         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30350         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30351 }
30352
30353 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30354         LDKOpenChannel this_ptr_conv;
30355         this_ptr_conv.inner = untag_ptr(this_ptr);
30356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30358         this_ptr_conv.is_owned = false;
30359         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30360         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30361         return ret_arr;
30362 }
30363
30364 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30365         LDKOpenChannel 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         LDKPublicKey val_ref;
30371         CHECK(val->arr_len == 33);
30372         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30373         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30374 }
30375
30376 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
30377         LDKOpenChannel this_ptr_conv;
30378         this_ptr_conv.inner = untag_ptr(this_ptr);
30379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30381         this_ptr_conv.is_owned = false;
30382         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30383         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
30384         return ret_arr;
30385 }
30386
30387 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
30388         LDKOpenChannel this_ptr_conv;
30389         this_ptr_conv.inner = untag_ptr(this_ptr);
30390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30392         this_ptr_conv.is_owned = false;
30393         LDKPublicKey val_ref;
30394         CHECK(val->arr_len == 33);
30395         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30396         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30397 }
30398
30399 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
30400         LDKOpenChannel this_ptr_conv;
30401         this_ptr_conv.inner = untag_ptr(this_ptr);
30402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30404         this_ptr_conv.is_owned = false;
30405         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30406         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
30407         return ret_arr;
30408 }
30409
30410 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
30411         LDKOpenChannel this_ptr_conv;
30412         this_ptr_conv.inner = untag_ptr(this_ptr);
30413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30415         this_ptr_conv.is_owned = false;
30416         LDKPublicKey val_ref;
30417         CHECK(val->arr_len == 33);
30418         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30419         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30420 }
30421
30422 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
30423         LDKOpenChannel this_ptr_conv;
30424         this_ptr_conv.inner = untag_ptr(this_ptr);
30425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30427         this_ptr_conv.is_owned = false;
30428         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30429         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
30430         return ret_arr;
30431 }
30432
30433 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
30434         LDKOpenChannel this_ptr_conv;
30435         this_ptr_conv.inner = untag_ptr(this_ptr);
30436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30438         this_ptr_conv.is_owned = false;
30439         LDKPublicKey val_ref;
30440         CHECK(val->arr_len == 33);
30441         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30442         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30443 }
30444
30445 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
30446         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30452         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30453         return ret_arr;
30454 }
30455
30456 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) {
30457         LDKOpenChannel this_ptr_conv;
30458         this_ptr_conv.inner = untag_ptr(this_ptr);
30459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30461         this_ptr_conv.is_owned = false;
30462         LDKPublicKey val_ref;
30463         CHECK(val->arr_len == 33);
30464         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30465         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30466 }
30467
30468 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
30469         LDKOpenChannel this_ptr_conv;
30470         this_ptr_conv.inner = untag_ptr(this_ptr);
30471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30473         this_ptr_conv.is_owned = false;
30474         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
30475         return ret_conv;
30476 }
30477
30478 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
30479         LDKOpenChannel this_ptr_conv;
30480         this_ptr_conv.inner = untag_ptr(this_ptr);
30481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30483         this_ptr_conv.is_owned = false;
30484         OpenChannel_set_channel_flags(&this_ptr_conv, val);
30485 }
30486
30487 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
30488         LDKOpenChannel this_ptr_conv;
30489         this_ptr_conv.inner = untag_ptr(this_ptr);
30490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30492         this_ptr_conv.is_owned = false;
30493         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30494         uint64_t ret_ref = 0;
30495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30497         return ret_ref;
30498 }
30499
30500 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
30501         LDKOpenChannel this_ptr_conv;
30502         this_ptr_conv.inner = untag_ptr(this_ptr);
30503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30505         this_ptr_conv.is_owned = false;
30506         LDKChannelTypeFeatures val_conv;
30507         val_conv.inner = untag_ptr(val);
30508         val_conv.is_owned = ptr_is_owned(val);
30509         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30510         val_conv = ChannelTypeFeatures_clone(&val_conv);
30511         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30512 }
30513
30514 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30515         LDKOpenChannel ret_var = OpenChannel_clone(arg);
30516         uint64_t ret_ref = 0;
30517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30519         return ret_ref;
30520 }
30521 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
30522         LDKOpenChannel arg_conv;
30523         arg_conv.inner = untag_ptr(arg);
30524         arg_conv.is_owned = ptr_is_owned(arg);
30525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30526         arg_conv.is_owned = false;
30527         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
30528         return ret_conv;
30529 }
30530
30531 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
30532         LDKOpenChannel orig_conv;
30533         orig_conv.inner = untag_ptr(orig);
30534         orig_conv.is_owned = ptr_is_owned(orig);
30535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30536         orig_conv.is_owned = false;
30537         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30538         uint64_t ret_ref = 0;
30539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30541         return ret_ref;
30542 }
30543
30544 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
30545         LDKOpenChannel a_conv;
30546         a_conv.inner = untag_ptr(a);
30547         a_conv.is_owned = ptr_is_owned(a);
30548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30549         a_conv.is_owned = false;
30550         LDKOpenChannel b_conv;
30551         b_conv.inner = untag_ptr(b);
30552         b_conv.is_owned = ptr_is_owned(b);
30553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30554         b_conv.is_owned = false;
30555         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
30556         return ret_conv;
30557 }
30558
30559 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
30560         LDKAcceptChannel this_obj_conv;
30561         this_obj_conv.inner = untag_ptr(this_obj);
30562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30564         AcceptChannel_free(this_obj_conv);
30565 }
30566
30567 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
30568         LDKAcceptChannel 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30574         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30575         return ret_arr;
30576 }
30577
30578 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30579         LDKAcceptChannel this_ptr_conv;
30580         this_ptr_conv.inner = untag_ptr(this_ptr);
30581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30583         this_ptr_conv.is_owned = false;
30584         LDKThirtyTwoBytes val_ref;
30585         CHECK(val->arr_len == 32);
30586         memcpy(val_ref.data, val->elems, 32); FREE(val);
30587         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30588 }
30589
30590 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30591         LDKAcceptChannel this_ptr_conv;
30592         this_ptr_conv.inner = untag_ptr(this_ptr);
30593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30595         this_ptr_conv.is_owned = false;
30596         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30597         return ret_conv;
30598 }
30599
30600 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30601         LDKAcceptChannel this_ptr_conv;
30602         this_ptr_conv.inner = untag_ptr(this_ptr);
30603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30605         this_ptr_conv.is_owned = false;
30606         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30607 }
30608
30609 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) {
30610         LDKAcceptChannel 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         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30616         return ret_conv;
30617 }
30618
30619 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) {
30620         LDKAcceptChannel this_ptr_conv;
30621         this_ptr_conv.inner = untag_ptr(this_ptr);
30622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30624         this_ptr_conv.is_owned = false;
30625         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30626 }
30627
30628 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30629         LDKAcceptChannel this_ptr_conv;
30630         this_ptr_conv.inner = untag_ptr(this_ptr);
30631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30633         this_ptr_conv.is_owned = false;
30634         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30635         return ret_conv;
30636 }
30637
30638 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30639         LDKAcceptChannel this_ptr_conv;
30640         this_ptr_conv.inner = untag_ptr(this_ptr);
30641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30643         this_ptr_conv.is_owned = false;
30644         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30645 }
30646
30647 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30648         LDKAcceptChannel this_ptr_conv;
30649         this_ptr_conv.inner = untag_ptr(this_ptr);
30650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30652         this_ptr_conv.is_owned = false;
30653         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30654         return ret_conv;
30655 }
30656
30657 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30658         LDKAcceptChannel this_ptr_conv;
30659         this_ptr_conv.inner = untag_ptr(this_ptr);
30660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30662         this_ptr_conv.is_owned = false;
30663         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30664 }
30665
30666 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
30667         LDKAcceptChannel this_ptr_conv;
30668         this_ptr_conv.inner = untag_ptr(this_ptr);
30669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30671         this_ptr_conv.is_owned = false;
30672         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30673         return ret_conv;
30674 }
30675
30676 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30677         LDKAcceptChannel this_ptr_conv;
30678         this_ptr_conv.inner = untag_ptr(this_ptr);
30679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30681         this_ptr_conv.is_owned = false;
30682         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30683 }
30684
30685 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
30686         LDKAcceptChannel this_ptr_conv;
30687         this_ptr_conv.inner = untag_ptr(this_ptr);
30688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30690         this_ptr_conv.is_owned = false;
30691         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30692         return ret_conv;
30693 }
30694
30695 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30696         LDKAcceptChannel this_ptr_conv;
30697         this_ptr_conv.inner = untag_ptr(this_ptr);
30698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30700         this_ptr_conv.is_owned = false;
30701         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30702 }
30703
30704 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30705         LDKAcceptChannel this_ptr_conv;
30706         this_ptr_conv.inner = untag_ptr(this_ptr);
30707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30709         this_ptr_conv.is_owned = false;
30710         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30711         return ret_conv;
30712 }
30713
30714 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30715         LDKAcceptChannel this_ptr_conv;
30716         this_ptr_conv.inner = untag_ptr(this_ptr);
30717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30719         this_ptr_conv.is_owned = false;
30720         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30721 }
30722
30723 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
30724         LDKAcceptChannel this_ptr_conv;
30725         this_ptr_conv.inner = untag_ptr(this_ptr);
30726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30728         this_ptr_conv.is_owned = false;
30729         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30730         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30731         return ret_arr;
30732 }
30733
30734 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30735         LDKAcceptChannel this_ptr_conv;
30736         this_ptr_conv.inner = untag_ptr(this_ptr);
30737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30739         this_ptr_conv.is_owned = false;
30740         LDKPublicKey val_ref;
30741         CHECK(val->arr_len == 33);
30742         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30743         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30744 }
30745
30746 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
30747         LDKAcceptChannel this_ptr_conv;
30748         this_ptr_conv.inner = untag_ptr(this_ptr);
30749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30751         this_ptr_conv.is_owned = false;
30752         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30753         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30754         return ret_arr;
30755 }
30756
30757 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30758         LDKAcceptChannel this_ptr_conv;
30759         this_ptr_conv.inner = untag_ptr(this_ptr);
30760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30762         this_ptr_conv.is_owned = false;
30763         LDKPublicKey val_ref;
30764         CHECK(val->arr_len == 33);
30765         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30766         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30767 }
30768
30769 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
30770         LDKAcceptChannel 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(33, __LINE__);
30776         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
30777         return ret_arr;
30778 }
30779
30780 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
30781         LDKAcceptChannel 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         LDKPublicKey val_ref;
30787         CHECK(val->arr_len == 33);
30788         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30789         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
30790 }
30791
30792 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
30793         LDKAcceptChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30799         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
30800         return ret_arr;
30801 }
30802
30803 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
30804         LDKAcceptChannel this_ptr_conv;
30805         this_ptr_conv.inner = untag_ptr(this_ptr);
30806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30808         this_ptr_conv.is_owned = false;
30809         LDKPublicKey val_ref;
30810         CHECK(val->arr_len == 33);
30811         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30812         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30813 }
30814
30815 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
30816         LDKAcceptChannel this_ptr_conv;
30817         this_ptr_conv.inner = untag_ptr(this_ptr);
30818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30820         this_ptr_conv.is_owned = false;
30821         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30822         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
30823         return ret_arr;
30824 }
30825
30826 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
30827         LDKAcceptChannel this_ptr_conv;
30828         this_ptr_conv.inner = untag_ptr(this_ptr);
30829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30831         this_ptr_conv.is_owned = false;
30832         LDKPublicKey val_ref;
30833         CHECK(val->arr_len == 33);
30834         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30835         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30836 }
30837
30838 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
30839         LDKAcceptChannel this_ptr_conv;
30840         this_ptr_conv.inner = untag_ptr(this_ptr);
30841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30843         this_ptr_conv.is_owned = false;
30844         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30845         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30846         return ret_arr;
30847 }
30848
30849 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) {
30850         LDKAcceptChannel this_ptr_conv;
30851         this_ptr_conv.inner = untag_ptr(this_ptr);
30852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30854         this_ptr_conv.is_owned = false;
30855         LDKPublicKey val_ref;
30856         CHECK(val->arr_len == 33);
30857         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30858         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30859 }
30860
30861 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
30862         LDKAcceptChannel this_ptr_conv;
30863         this_ptr_conv.inner = untag_ptr(this_ptr);
30864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30866         this_ptr_conv.is_owned = false;
30867         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
30868         uint64_t ret_ref = 0;
30869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30871         return ret_ref;
30872 }
30873
30874 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
30875         LDKAcceptChannel this_ptr_conv;
30876         this_ptr_conv.inner = untag_ptr(this_ptr);
30877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30879         this_ptr_conv.is_owned = false;
30880         LDKChannelTypeFeatures val_conv;
30881         val_conv.inner = untag_ptr(val);
30882         val_conv.is_owned = ptr_is_owned(val);
30883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30884         val_conv = ChannelTypeFeatures_clone(&val_conv);
30885         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
30886 }
30887
30888 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
30889         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
30890         uint64_t ret_ref = 0;
30891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30893         return ret_ref;
30894 }
30895 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
30896         LDKAcceptChannel arg_conv;
30897         arg_conv.inner = untag_ptr(arg);
30898         arg_conv.is_owned = ptr_is_owned(arg);
30899         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30900         arg_conv.is_owned = false;
30901         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
30902         return ret_conv;
30903 }
30904
30905 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
30906         LDKAcceptChannel orig_conv;
30907         orig_conv.inner = untag_ptr(orig);
30908         orig_conv.is_owned = ptr_is_owned(orig);
30909         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30910         orig_conv.is_owned = false;
30911         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
30912         uint64_t ret_ref = 0;
30913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30915         return ret_ref;
30916 }
30917
30918 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
30919         LDKAcceptChannel a_conv;
30920         a_conv.inner = untag_ptr(a);
30921         a_conv.is_owned = ptr_is_owned(a);
30922         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30923         a_conv.is_owned = false;
30924         LDKAcceptChannel b_conv;
30925         b_conv.inner = untag_ptr(b);
30926         b_conv.is_owned = ptr_is_owned(b);
30927         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30928         b_conv.is_owned = false;
30929         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
30930         return ret_conv;
30931 }
30932
30933 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
30934         LDKFundingCreated this_obj_conv;
30935         this_obj_conv.inner = untag_ptr(this_obj);
30936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30938         FundingCreated_free(this_obj_conv);
30939 }
30940
30941 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
30942         LDKFundingCreated this_ptr_conv;
30943         this_ptr_conv.inner = untag_ptr(this_ptr);
30944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30946         this_ptr_conv.is_owned = false;
30947         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30948         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
30949         return ret_arr;
30950 }
30951
30952 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30953         LDKFundingCreated this_ptr_conv;
30954         this_ptr_conv.inner = untag_ptr(this_ptr);
30955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30957         this_ptr_conv.is_owned = false;
30958         LDKThirtyTwoBytes val_ref;
30959         CHECK(val->arr_len == 32);
30960         memcpy(val_ref.data, val->elems, 32); FREE(val);
30961         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
30962 }
30963
30964 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
30965         LDKFundingCreated this_ptr_conv;
30966         this_ptr_conv.inner = untag_ptr(this_ptr);
30967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30969         this_ptr_conv.is_owned = false;
30970         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30971         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
30972         return ret_arr;
30973 }
30974
30975 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
30976         LDKFundingCreated this_ptr_conv;
30977         this_ptr_conv.inner = untag_ptr(this_ptr);
30978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30980         this_ptr_conv.is_owned = false;
30981         LDKThirtyTwoBytes val_ref;
30982         CHECK(val->arr_len == 32);
30983         memcpy(val_ref.data, val->elems, 32); FREE(val);
30984         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
30985 }
30986
30987 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
30988         LDKFundingCreated this_ptr_conv;
30989         this_ptr_conv.inner = untag_ptr(this_ptr);
30990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30992         this_ptr_conv.is_owned = false;
30993         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
30994         return ret_conv;
30995 }
30996
30997 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
30998         LDKFundingCreated this_ptr_conv;
30999         this_ptr_conv.inner = untag_ptr(this_ptr);
31000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31002         this_ptr_conv.is_owned = false;
31003         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31004 }
31005
31006 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31007         LDKFundingCreated this_ptr_conv;
31008         this_ptr_conv.inner = untag_ptr(this_ptr);
31009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31011         this_ptr_conv.is_owned = false;
31012         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31013         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31014         return ret_arr;
31015 }
31016
31017 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31018         LDKFundingCreated this_ptr_conv;
31019         this_ptr_conv.inner = untag_ptr(this_ptr);
31020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31022         this_ptr_conv.is_owned = false;
31023         LDKSignature val_ref;
31024         CHECK(val->arr_len == 64);
31025         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31026         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31027 }
31028
31029 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) {
31030         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31031         CHECK(temporary_channel_id_arg->arr_len == 32);
31032         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31033         LDKThirtyTwoBytes funding_txid_arg_ref;
31034         CHECK(funding_txid_arg->arr_len == 32);
31035         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31036         LDKSignature signature_arg_ref;
31037         CHECK(signature_arg->arr_len == 64);
31038         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31039         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31040         uint64_t ret_ref = 0;
31041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31043         return ret_ref;
31044 }
31045
31046 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31047         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31048         uint64_t ret_ref = 0;
31049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31051         return ret_ref;
31052 }
31053 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31054         LDKFundingCreated arg_conv;
31055         arg_conv.inner = untag_ptr(arg);
31056         arg_conv.is_owned = ptr_is_owned(arg);
31057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31058         arg_conv.is_owned = false;
31059         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31060         return ret_conv;
31061 }
31062
31063 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31064         LDKFundingCreated orig_conv;
31065         orig_conv.inner = untag_ptr(orig);
31066         orig_conv.is_owned = ptr_is_owned(orig);
31067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31068         orig_conv.is_owned = false;
31069         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31070         uint64_t ret_ref = 0;
31071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31073         return ret_ref;
31074 }
31075
31076 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31077         LDKFundingCreated a_conv;
31078         a_conv.inner = untag_ptr(a);
31079         a_conv.is_owned = ptr_is_owned(a);
31080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31081         a_conv.is_owned = false;
31082         LDKFundingCreated b_conv;
31083         b_conv.inner = untag_ptr(b);
31084         b_conv.is_owned = ptr_is_owned(b);
31085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31086         b_conv.is_owned = false;
31087         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31088         return ret_conv;
31089 }
31090
31091 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31092         LDKFundingSigned this_obj_conv;
31093         this_obj_conv.inner = untag_ptr(this_obj);
31094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31096         FundingSigned_free(this_obj_conv);
31097 }
31098
31099 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31100         LDKFundingSigned this_ptr_conv;
31101         this_ptr_conv.inner = untag_ptr(this_ptr);
31102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31104         this_ptr_conv.is_owned = false;
31105         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31106         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31107         return ret_arr;
31108 }
31109
31110 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31111         LDKFundingSigned this_ptr_conv;
31112         this_ptr_conv.inner = untag_ptr(this_ptr);
31113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31115         this_ptr_conv.is_owned = false;
31116         LDKThirtyTwoBytes val_ref;
31117         CHECK(val->arr_len == 32);
31118         memcpy(val_ref.data, val->elems, 32); FREE(val);
31119         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31120 }
31121
31122 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31123         LDKFundingSigned this_ptr_conv;
31124         this_ptr_conv.inner = untag_ptr(this_ptr);
31125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31127         this_ptr_conv.is_owned = false;
31128         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31129         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31130         return ret_arr;
31131 }
31132
31133 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31134         LDKFundingSigned this_ptr_conv;
31135         this_ptr_conv.inner = untag_ptr(this_ptr);
31136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31138         this_ptr_conv.is_owned = false;
31139         LDKSignature val_ref;
31140         CHECK(val->arr_len == 64);
31141         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31142         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31143 }
31144
31145 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31146         LDKThirtyTwoBytes channel_id_arg_ref;
31147         CHECK(channel_id_arg->arr_len == 32);
31148         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31149         LDKSignature signature_arg_ref;
31150         CHECK(signature_arg->arr_len == 64);
31151         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31152         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31153         uint64_t ret_ref = 0;
31154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31156         return ret_ref;
31157 }
31158
31159 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31160         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31161         uint64_t ret_ref = 0;
31162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31164         return ret_ref;
31165 }
31166 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31167         LDKFundingSigned arg_conv;
31168         arg_conv.inner = untag_ptr(arg);
31169         arg_conv.is_owned = ptr_is_owned(arg);
31170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31171         arg_conv.is_owned = false;
31172         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31173         return ret_conv;
31174 }
31175
31176 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31177         LDKFundingSigned orig_conv;
31178         orig_conv.inner = untag_ptr(orig);
31179         orig_conv.is_owned = ptr_is_owned(orig);
31180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31181         orig_conv.is_owned = false;
31182         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31183         uint64_t ret_ref = 0;
31184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31186         return ret_ref;
31187 }
31188
31189 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31190         LDKFundingSigned a_conv;
31191         a_conv.inner = untag_ptr(a);
31192         a_conv.is_owned = ptr_is_owned(a);
31193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31194         a_conv.is_owned = false;
31195         LDKFundingSigned b_conv;
31196         b_conv.inner = untag_ptr(b);
31197         b_conv.is_owned = ptr_is_owned(b);
31198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31199         b_conv.is_owned = false;
31200         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31201         return ret_conv;
31202 }
31203
31204 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31205         LDKChannelReady this_obj_conv;
31206         this_obj_conv.inner = untag_ptr(this_obj);
31207         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31209         ChannelReady_free(this_obj_conv);
31210 }
31211
31212 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31213         LDKChannelReady this_ptr_conv;
31214         this_ptr_conv.inner = untag_ptr(this_ptr);
31215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31217         this_ptr_conv.is_owned = false;
31218         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31219         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31220         return ret_arr;
31221 }
31222
31223 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31224         LDKChannelReady this_ptr_conv;
31225         this_ptr_conv.inner = untag_ptr(this_ptr);
31226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31228         this_ptr_conv.is_owned = false;
31229         LDKThirtyTwoBytes val_ref;
31230         CHECK(val->arr_len == 32);
31231         memcpy(val_ref.data, val->elems, 32); FREE(val);
31232         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31233 }
31234
31235 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31236         LDKChannelReady this_ptr_conv;
31237         this_ptr_conv.inner = untag_ptr(this_ptr);
31238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31240         this_ptr_conv.is_owned = false;
31241         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31242         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31243         return ret_arr;
31244 }
31245
31246 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) {
31247         LDKChannelReady this_ptr_conv;
31248         this_ptr_conv.inner = untag_ptr(this_ptr);
31249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31251         this_ptr_conv.is_owned = false;
31252         LDKPublicKey val_ref;
31253         CHECK(val->arr_len == 33);
31254         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31255         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31256 }
31257
31258 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31259         LDKChannelReady this_ptr_conv;
31260         this_ptr_conv.inner = untag_ptr(this_ptr);
31261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31263         this_ptr_conv.is_owned = false;
31264         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31265         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31266         uint64_t ret_ref = tag_ptr(ret_copy, true);
31267         return ret_ref;
31268 }
31269
31270 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) {
31271         LDKChannelReady this_ptr_conv;
31272         this_ptr_conv.inner = untag_ptr(this_ptr);
31273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31275         this_ptr_conv.is_owned = false;
31276         void* val_ptr = untag_ptr(val);
31277         CHECK_ACCESS(val_ptr);
31278         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31279         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31280         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31281 }
31282
31283 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) {
31284         LDKThirtyTwoBytes channel_id_arg_ref;
31285         CHECK(channel_id_arg->arr_len == 32);
31286         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31287         LDKPublicKey next_per_commitment_point_arg_ref;
31288         CHECK(next_per_commitment_point_arg->arr_len == 33);
31289         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31290         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31291         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31292         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31293         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31294         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31295         uint64_t ret_ref = 0;
31296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31298         return ret_ref;
31299 }
31300
31301 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31302         LDKChannelReady ret_var = ChannelReady_clone(arg);
31303         uint64_t ret_ref = 0;
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31306         return ret_ref;
31307 }
31308 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31309         LDKChannelReady arg_conv;
31310         arg_conv.inner = untag_ptr(arg);
31311         arg_conv.is_owned = ptr_is_owned(arg);
31312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31313         arg_conv.is_owned = false;
31314         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31315         return ret_conv;
31316 }
31317
31318 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31319         LDKChannelReady orig_conv;
31320         orig_conv.inner = untag_ptr(orig);
31321         orig_conv.is_owned = ptr_is_owned(orig);
31322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31323         orig_conv.is_owned = false;
31324         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31325         uint64_t ret_ref = 0;
31326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31328         return ret_ref;
31329 }
31330
31331 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31332         LDKChannelReady a_conv;
31333         a_conv.inner = untag_ptr(a);
31334         a_conv.is_owned = ptr_is_owned(a);
31335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31336         a_conv.is_owned = false;
31337         LDKChannelReady b_conv;
31338         b_conv.inner = untag_ptr(b);
31339         b_conv.is_owned = ptr_is_owned(b);
31340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31341         b_conv.is_owned = false;
31342         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31343         return ret_conv;
31344 }
31345
31346 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31347         LDKShutdown this_obj_conv;
31348         this_obj_conv.inner = untag_ptr(this_obj);
31349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31351         Shutdown_free(this_obj_conv);
31352 }
31353
31354 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31355         LDKShutdown this_ptr_conv;
31356         this_ptr_conv.inner = untag_ptr(this_ptr);
31357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31359         this_ptr_conv.is_owned = false;
31360         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31361         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31362         return ret_arr;
31363 }
31364
31365 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31366         LDKShutdown this_ptr_conv;
31367         this_ptr_conv.inner = untag_ptr(this_ptr);
31368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31370         this_ptr_conv.is_owned = false;
31371         LDKThirtyTwoBytes val_ref;
31372         CHECK(val->arr_len == 32);
31373         memcpy(val_ref.data, val->elems, 32); FREE(val);
31374         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31375 }
31376
31377 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
31378         LDKShutdown this_ptr_conv;
31379         this_ptr_conv.inner = untag_ptr(this_ptr);
31380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31382         this_ptr_conv.is_owned = false;
31383         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31384         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31385         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31386         return ret_arr;
31387 }
31388
31389 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
31390         LDKShutdown this_ptr_conv;
31391         this_ptr_conv.inner = untag_ptr(this_ptr);
31392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31394         this_ptr_conv.is_owned = false;
31395         LDKCVec_u8Z val_ref;
31396         val_ref.datalen = val->arr_len;
31397         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31398         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31399         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
31400 }
31401
31402 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
31403         LDKThirtyTwoBytes channel_id_arg_ref;
31404         CHECK(channel_id_arg->arr_len == 32);
31405         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31406         LDKCVec_u8Z scriptpubkey_arg_ref;
31407         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
31408         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31409         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
31410         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
31411         uint64_t ret_ref = 0;
31412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31414         return ret_ref;
31415 }
31416
31417 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
31418         LDKShutdown ret_var = Shutdown_clone(arg);
31419         uint64_t ret_ref = 0;
31420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31422         return ret_ref;
31423 }
31424 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
31425         LDKShutdown arg_conv;
31426         arg_conv.inner = untag_ptr(arg);
31427         arg_conv.is_owned = ptr_is_owned(arg);
31428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31429         arg_conv.is_owned = false;
31430         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
31431         return ret_conv;
31432 }
31433
31434 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
31435         LDKShutdown orig_conv;
31436         orig_conv.inner = untag_ptr(orig);
31437         orig_conv.is_owned = ptr_is_owned(orig);
31438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31439         orig_conv.is_owned = false;
31440         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
31441         uint64_t ret_ref = 0;
31442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31444         return ret_ref;
31445 }
31446
31447 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
31448         LDKShutdown a_conv;
31449         a_conv.inner = untag_ptr(a);
31450         a_conv.is_owned = ptr_is_owned(a);
31451         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31452         a_conv.is_owned = false;
31453         LDKShutdown b_conv;
31454         b_conv.inner = untag_ptr(b);
31455         b_conv.is_owned = ptr_is_owned(b);
31456         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31457         b_conv.is_owned = false;
31458         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
31459         return ret_conv;
31460 }
31461
31462 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
31463         LDKClosingSignedFeeRange this_obj_conv;
31464         this_obj_conv.inner = untag_ptr(this_obj);
31465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31467         ClosingSignedFeeRange_free(this_obj_conv);
31468 }
31469
31470 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
31471         LDKClosingSignedFeeRange this_ptr_conv;
31472         this_ptr_conv.inner = untag_ptr(this_ptr);
31473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31475         this_ptr_conv.is_owned = false;
31476         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
31477         return ret_conv;
31478 }
31479
31480 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
31481         LDKClosingSignedFeeRange this_ptr_conv;
31482         this_ptr_conv.inner = untag_ptr(this_ptr);
31483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31485         this_ptr_conv.is_owned = false;
31486         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
31487 }
31488
31489 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
31490         LDKClosingSignedFeeRange this_ptr_conv;
31491         this_ptr_conv.inner = untag_ptr(this_ptr);
31492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31494         this_ptr_conv.is_owned = false;
31495         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31496         return ret_conv;
31497 }
31498
31499 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
31500         LDKClosingSignedFeeRange 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         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31506 }
31507
31508 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
31509         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31510         uint64_t ret_ref = 0;
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31513         return ret_ref;
31514 }
31515
31516 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31517         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31518         uint64_t ret_ref = 0;
31519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31521         return ret_ref;
31522 }
31523 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
31524         LDKClosingSignedFeeRange arg_conv;
31525         arg_conv.inner = untag_ptr(arg);
31526         arg_conv.is_owned = ptr_is_owned(arg);
31527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31528         arg_conv.is_owned = false;
31529         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31530         return ret_conv;
31531 }
31532
31533 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
31534         LDKClosingSignedFeeRange orig_conv;
31535         orig_conv.inner = untag_ptr(orig);
31536         orig_conv.is_owned = ptr_is_owned(orig);
31537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31538         orig_conv.is_owned = false;
31539         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31540         uint64_t ret_ref = 0;
31541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31543         return ret_ref;
31544 }
31545
31546 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
31547         LDKClosingSignedFeeRange a_conv;
31548         a_conv.inner = untag_ptr(a);
31549         a_conv.is_owned = ptr_is_owned(a);
31550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31551         a_conv.is_owned = false;
31552         LDKClosingSignedFeeRange b_conv;
31553         b_conv.inner = untag_ptr(b);
31554         b_conv.is_owned = ptr_is_owned(b);
31555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31556         b_conv.is_owned = false;
31557         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
31558         return ret_conv;
31559 }
31560
31561 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
31562         LDKClosingSigned this_obj_conv;
31563         this_obj_conv.inner = untag_ptr(this_obj);
31564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31566         ClosingSigned_free(this_obj_conv);
31567 }
31568
31569 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
31570         LDKClosingSigned this_ptr_conv;
31571         this_ptr_conv.inner = untag_ptr(this_ptr);
31572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31574         this_ptr_conv.is_owned = false;
31575         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31576         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
31577         return ret_arr;
31578 }
31579
31580 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31581         LDKClosingSigned this_ptr_conv;
31582         this_ptr_conv.inner = untag_ptr(this_ptr);
31583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31585         this_ptr_conv.is_owned = false;
31586         LDKThirtyTwoBytes val_ref;
31587         CHECK(val->arr_len == 32);
31588         memcpy(val_ref.data, val->elems, 32); FREE(val);
31589         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31590 }
31591
31592 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
31593         LDKClosingSigned 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         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31599         return ret_conv;
31600 }
31601
31602 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
31603         LDKClosingSigned this_ptr_conv;
31604         this_ptr_conv.inner = untag_ptr(this_ptr);
31605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31607         this_ptr_conv.is_owned = false;
31608         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31609 }
31610
31611 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
31612         LDKClosingSigned this_ptr_conv;
31613         this_ptr_conv.inner = untag_ptr(this_ptr);
31614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31616         this_ptr_conv.is_owned = false;
31617         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31618         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31619         return ret_arr;
31620 }
31621
31622 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31623         LDKClosingSigned this_ptr_conv;
31624         this_ptr_conv.inner = untag_ptr(this_ptr);
31625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31627         this_ptr_conv.is_owned = false;
31628         LDKSignature val_ref;
31629         CHECK(val->arr_len == 64);
31630         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31631         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31632 }
31633
31634 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
31635         LDKClosingSigned this_ptr_conv;
31636         this_ptr_conv.inner = untag_ptr(this_ptr);
31637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31639         this_ptr_conv.is_owned = false;
31640         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31641         uint64_t ret_ref = 0;
31642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31644         return ret_ref;
31645 }
31646
31647 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
31648         LDKClosingSigned this_ptr_conv;
31649         this_ptr_conv.inner = untag_ptr(this_ptr);
31650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31652         this_ptr_conv.is_owned = false;
31653         LDKClosingSignedFeeRange val_conv;
31654         val_conv.inner = untag_ptr(val);
31655         val_conv.is_owned = ptr_is_owned(val);
31656         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31657         val_conv = ClosingSignedFeeRange_clone(&val_conv);
31658         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31659 }
31660
31661 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) {
31662         LDKThirtyTwoBytes channel_id_arg_ref;
31663         CHECK(channel_id_arg->arr_len == 32);
31664         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31665         LDKSignature signature_arg_ref;
31666         CHECK(signature_arg->arr_len == 64);
31667         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31668         LDKClosingSignedFeeRange fee_range_arg_conv;
31669         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
31670         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
31671         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31672         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31673         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31674         uint64_t ret_ref = 0;
31675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31677         return ret_ref;
31678 }
31679
31680 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31681         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31682         uint64_t ret_ref = 0;
31683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31685         return ret_ref;
31686 }
31687 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
31688         LDKClosingSigned arg_conv;
31689         arg_conv.inner = untag_ptr(arg);
31690         arg_conv.is_owned = ptr_is_owned(arg);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31692         arg_conv.is_owned = false;
31693         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
31694         return ret_conv;
31695 }
31696
31697 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
31698         LDKClosingSigned orig_conv;
31699         orig_conv.inner = untag_ptr(orig);
31700         orig_conv.is_owned = ptr_is_owned(orig);
31701         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31702         orig_conv.is_owned = false;
31703         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31704         uint64_t ret_ref = 0;
31705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31707         return ret_ref;
31708 }
31709
31710 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
31711         LDKClosingSigned a_conv;
31712         a_conv.inner = untag_ptr(a);
31713         a_conv.is_owned = ptr_is_owned(a);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31715         a_conv.is_owned = false;
31716         LDKClosingSigned b_conv;
31717         b_conv.inner = untag_ptr(b);
31718         b_conv.is_owned = ptr_is_owned(b);
31719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31720         b_conv.is_owned = false;
31721         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
31722         return ret_conv;
31723 }
31724
31725 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
31726         LDKUpdateAddHTLC this_obj_conv;
31727         this_obj_conv.inner = untag_ptr(this_obj);
31728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31730         UpdateAddHTLC_free(this_obj_conv);
31731 }
31732
31733 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
31734         LDKUpdateAddHTLC this_ptr_conv;
31735         this_ptr_conv.inner = untag_ptr(this_ptr);
31736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31738         this_ptr_conv.is_owned = false;
31739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31740         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
31741         return ret_arr;
31742 }
31743
31744 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31745         LDKUpdateAddHTLC this_ptr_conv;
31746         this_ptr_conv.inner = untag_ptr(this_ptr);
31747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31749         this_ptr_conv.is_owned = false;
31750         LDKThirtyTwoBytes val_ref;
31751         CHECK(val->arr_len == 32);
31752         memcpy(val_ref.data, val->elems, 32); FREE(val);
31753         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31754 }
31755
31756 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
31757         LDKUpdateAddHTLC this_ptr_conv;
31758         this_ptr_conv.inner = untag_ptr(this_ptr);
31759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31761         this_ptr_conv.is_owned = false;
31762         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31763         return ret_conv;
31764 }
31765
31766 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31767         LDKUpdateAddHTLC this_ptr_conv;
31768         this_ptr_conv.inner = untag_ptr(this_ptr);
31769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31771         this_ptr_conv.is_owned = false;
31772         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31773 }
31774
31775 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
31776         LDKUpdateAddHTLC this_ptr_conv;
31777         this_ptr_conv.inner = untag_ptr(this_ptr);
31778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31780         this_ptr_conv.is_owned = false;
31781         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31782         return ret_conv;
31783 }
31784
31785 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
31786         LDKUpdateAddHTLC this_ptr_conv;
31787         this_ptr_conv.inner = untag_ptr(this_ptr);
31788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31790         this_ptr_conv.is_owned = false;
31791         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31792 }
31793
31794 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
31795         LDKUpdateAddHTLC this_ptr_conv;
31796         this_ptr_conv.inner = untag_ptr(this_ptr);
31797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31799         this_ptr_conv.is_owned = false;
31800         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31801         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
31802         return ret_arr;
31803 }
31804
31805 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
31806         LDKUpdateAddHTLC this_ptr_conv;
31807         this_ptr_conv.inner = untag_ptr(this_ptr);
31808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31810         this_ptr_conv.is_owned = false;
31811         LDKThirtyTwoBytes val_ref;
31812         CHECK(val->arr_len == 32);
31813         memcpy(val_ref.data, val->elems, 32); FREE(val);
31814         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
31815 }
31816
31817 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
31818         LDKUpdateAddHTLC this_ptr_conv;
31819         this_ptr_conv.inner = untag_ptr(this_ptr);
31820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31822         this_ptr_conv.is_owned = false;
31823         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
31824         return ret_conv;
31825 }
31826
31827 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
31828         LDKUpdateAddHTLC this_ptr_conv;
31829         this_ptr_conv.inner = untag_ptr(this_ptr);
31830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31832         this_ptr_conv.is_owned = false;
31833         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
31834 }
31835
31836 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
31837         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
31838         uint64_t ret_ref = 0;
31839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31841         return ret_ref;
31842 }
31843 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
31844         LDKUpdateAddHTLC arg_conv;
31845         arg_conv.inner = untag_ptr(arg);
31846         arg_conv.is_owned = ptr_is_owned(arg);
31847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31848         arg_conv.is_owned = false;
31849         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
31850         return ret_conv;
31851 }
31852
31853 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
31854         LDKUpdateAddHTLC orig_conv;
31855         orig_conv.inner = untag_ptr(orig);
31856         orig_conv.is_owned = ptr_is_owned(orig);
31857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31858         orig_conv.is_owned = false;
31859         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
31860         uint64_t ret_ref = 0;
31861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31863         return ret_ref;
31864 }
31865
31866 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
31867         LDKUpdateAddHTLC a_conv;
31868         a_conv.inner = untag_ptr(a);
31869         a_conv.is_owned = ptr_is_owned(a);
31870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31871         a_conv.is_owned = false;
31872         LDKUpdateAddHTLC b_conv;
31873         b_conv.inner = untag_ptr(b);
31874         b_conv.is_owned = ptr_is_owned(b);
31875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31876         b_conv.is_owned = false;
31877         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
31878         return ret_conv;
31879 }
31880
31881 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
31882         LDKOnionMessage this_obj_conv;
31883         this_obj_conv.inner = untag_ptr(this_obj);
31884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31886         OnionMessage_free(this_obj_conv);
31887 }
31888
31889 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
31890         LDKOnionMessage this_ptr_conv;
31891         this_ptr_conv.inner = untag_ptr(this_ptr);
31892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31894         this_ptr_conv.is_owned = false;
31895         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31896         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
31897         return ret_arr;
31898 }
31899
31900 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
31901         LDKOnionMessage this_ptr_conv;
31902         this_ptr_conv.inner = untag_ptr(this_ptr);
31903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31905         this_ptr_conv.is_owned = false;
31906         LDKPublicKey val_ref;
31907         CHECK(val->arr_len == 33);
31908         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31909         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
31910 }
31911
31912 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
31913         LDKOnionMessage ret_var = OnionMessage_clone(arg);
31914         uint64_t ret_ref = 0;
31915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31917         return ret_ref;
31918 }
31919 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
31920         LDKOnionMessage arg_conv;
31921         arg_conv.inner = untag_ptr(arg);
31922         arg_conv.is_owned = ptr_is_owned(arg);
31923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31924         arg_conv.is_owned = false;
31925         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
31926         return ret_conv;
31927 }
31928
31929 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
31930         LDKOnionMessage orig_conv;
31931         orig_conv.inner = untag_ptr(orig);
31932         orig_conv.is_owned = ptr_is_owned(orig);
31933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31934         orig_conv.is_owned = false;
31935         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
31936         uint64_t ret_ref = 0;
31937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31939         return ret_ref;
31940 }
31941
31942 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
31943         LDKOnionMessage a_conv;
31944         a_conv.inner = untag_ptr(a);
31945         a_conv.is_owned = ptr_is_owned(a);
31946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31947         a_conv.is_owned = false;
31948         LDKOnionMessage b_conv;
31949         b_conv.inner = untag_ptr(b);
31950         b_conv.is_owned = ptr_is_owned(b);
31951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31952         b_conv.is_owned = false;
31953         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
31954         return ret_conv;
31955 }
31956
31957 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
31958         LDKUpdateFulfillHTLC this_obj_conv;
31959         this_obj_conv.inner = untag_ptr(this_obj);
31960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31962         UpdateFulfillHTLC_free(this_obj_conv);
31963 }
31964
31965 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
31966         LDKUpdateFulfillHTLC this_ptr_conv;
31967         this_ptr_conv.inner = untag_ptr(this_ptr);
31968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31970         this_ptr_conv.is_owned = false;
31971         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31972         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
31973         return ret_arr;
31974 }
31975
31976 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31977         LDKUpdateFulfillHTLC this_ptr_conv;
31978         this_ptr_conv.inner = untag_ptr(this_ptr);
31979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31981         this_ptr_conv.is_owned = false;
31982         LDKThirtyTwoBytes val_ref;
31983         CHECK(val->arr_len == 32);
31984         memcpy(val_ref.data, val->elems, 32); FREE(val);
31985         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
31986 }
31987
31988 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
31989         LDKUpdateFulfillHTLC this_ptr_conv;
31990         this_ptr_conv.inner = untag_ptr(this_ptr);
31991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993         this_ptr_conv.is_owned = false;
31994         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
31995         return ret_conv;
31996 }
31997
31998 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31999         LDKUpdateFulfillHTLC this_ptr_conv;
32000         this_ptr_conv.inner = untag_ptr(this_ptr);
32001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32003         this_ptr_conv.is_owned = false;
32004         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32005 }
32006
32007 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32008         LDKUpdateFulfillHTLC this_ptr_conv;
32009         this_ptr_conv.inner = untag_ptr(this_ptr);
32010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32012         this_ptr_conv.is_owned = false;
32013         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32014         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32015         return ret_arr;
32016 }
32017
32018 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32019         LDKUpdateFulfillHTLC this_ptr_conv;
32020         this_ptr_conv.inner = untag_ptr(this_ptr);
32021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32023         this_ptr_conv.is_owned = false;
32024         LDKThirtyTwoBytes val_ref;
32025         CHECK(val->arr_len == 32);
32026         memcpy(val_ref.data, val->elems, 32); FREE(val);
32027         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32028 }
32029
32030 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) {
32031         LDKThirtyTwoBytes channel_id_arg_ref;
32032         CHECK(channel_id_arg->arr_len == 32);
32033         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32034         LDKThirtyTwoBytes payment_preimage_arg_ref;
32035         CHECK(payment_preimage_arg->arr_len == 32);
32036         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32037         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32038         uint64_t ret_ref = 0;
32039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32041         return ret_ref;
32042 }
32043
32044 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32045         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32046         uint64_t ret_ref = 0;
32047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32049         return ret_ref;
32050 }
32051 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32052         LDKUpdateFulfillHTLC arg_conv;
32053         arg_conv.inner = untag_ptr(arg);
32054         arg_conv.is_owned = ptr_is_owned(arg);
32055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32056         arg_conv.is_owned = false;
32057         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32058         return ret_conv;
32059 }
32060
32061 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32062         LDKUpdateFulfillHTLC orig_conv;
32063         orig_conv.inner = untag_ptr(orig);
32064         orig_conv.is_owned = ptr_is_owned(orig);
32065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32066         orig_conv.is_owned = false;
32067         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32068         uint64_t ret_ref = 0;
32069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32071         return ret_ref;
32072 }
32073
32074 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32075         LDKUpdateFulfillHTLC a_conv;
32076         a_conv.inner = untag_ptr(a);
32077         a_conv.is_owned = ptr_is_owned(a);
32078         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32079         a_conv.is_owned = false;
32080         LDKUpdateFulfillHTLC b_conv;
32081         b_conv.inner = untag_ptr(b);
32082         b_conv.is_owned = ptr_is_owned(b);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32084         b_conv.is_owned = false;
32085         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32086         return ret_conv;
32087 }
32088
32089 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32090         LDKUpdateFailHTLC this_obj_conv;
32091         this_obj_conv.inner = untag_ptr(this_obj);
32092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32094         UpdateFailHTLC_free(this_obj_conv);
32095 }
32096
32097 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32098         LDKUpdateFailHTLC this_ptr_conv;
32099         this_ptr_conv.inner = untag_ptr(this_ptr);
32100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32102         this_ptr_conv.is_owned = false;
32103         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32104         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32105         return ret_arr;
32106 }
32107
32108 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32109         LDKUpdateFailHTLC this_ptr_conv;
32110         this_ptr_conv.inner = untag_ptr(this_ptr);
32111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32113         this_ptr_conv.is_owned = false;
32114         LDKThirtyTwoBytes val_ref;
32115         CHECK(val->arr_len == 32);
32116         memcpy(val_ref.data, val->elems, 32); FREE(val);
32117         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32118 }
32119
32120 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32121         LDKUpdateFailHTLC this_ptr_conv;
32122         this_ptr_conv.inner = untag_ptr(this_ptr);
32123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32125         this_ptr_conv.is_owned = false;
32126         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32127         return ret_conv;
32128 }
32129
32130 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32131         LDKUpdateFailHTLC this_ptr_conv;
32132         this_ptr_conv.inner = untag_ptr(this_ptr);
32133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32135         this_ptr_conv.is_owned = false;
32136         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32137 }
32138
32139 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32140         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32141         uint64_t ret_ref = 0;
32142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32144         return ret_ref;
32145 }
32146 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32147         LDKUpdateFailHTLC arg_conv;
32148         arg_conv.inner = untag_ptr(arg);
32149         arg_conv.is_owned = ptr_is_owned(arg);
32150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32151         arg_conv.is_owned = false;
32152         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32153         return ret_conv;
32154 }
32155
32156 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32157         LDKUpdateFailHTLC orig_conv;
32158         orig_conv.inner = untag_ptr(orig);
32159         orig_conv.is_owned = ptr_is_owned(orig);
32160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32161         orig_conv.is_owned = false;
32162         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32163         uint64_t ret_ref = 0;
32164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32166         return ret_ref;
32167 }
32168
32169 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32170         LDKUpdateFailHTLC a_conv;
32171         a_conv.inner = untag_ptr(a);
32172         a_conv.is_owned = ptr_is_owned(a);
32173         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32174         a_conv.is_owned = false;
32175         LDKUpdateFailHTLC b_conv;
32176         b_conv.inner = untag_ptr(b);
32177         b_conv.is_owned = ptr_is_owned(b);
32178         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32179         b_conv.is_owned = false;
32180         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32181         return ret_conv;
32182 }
32183
32184 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32185         LDKUpdateFailMalformedHTLC this_obj_conv;
32186         this_obj_conv.inner = untag_ptr(this_obj);
32187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32189         UpdateFailMalformedHTLC_free(this_obj_conv);
32190 }
32191
32192 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32193         LDKUpdateFailMalformedHTLC this_ptr_conv;
32194         this_ptr_conv.inner = untag_ptr(this_ptr);
32195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32197         this_ptr_conv.is_owned = false;
32198         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32199         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32200         return ret_arr;
32201 }
32202
32203 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32204         LDKUpdateFailMalformedHTLC 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         LDKThirtyTwoBytes val_ref;
32210         CHECK(val->arr_len == 32);
32211         memcpy(val_ref.data, val->elems, 32); FREE(val);
32212         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32213 }
32214
32215 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32216         LDKUpdateFailMalformedHTLC this_ptr_conv;
32217         this_ptr_conv.inner = untag_ptr(this_ptr);
32218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220         this_ptr_conv.is_owned = false;
32221         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32222         return ret_conv;
32223 }
32224
32225 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32226         LDKUpdateFailMalformedHTLC this_ptr_conv;
32227         this_ptr_conv.inner = untag_ptr(this_ptr);
32228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32230         this_ptr_conv.is_owned = false;
32231         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32232 }
32233
32234 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32235         LDKUpdateFailMalformedHTLC this_ptr_conv;
32236         this_ptr_conv.inner = untag_ptr(this_ptr);
32237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239         this_ptr_conv.is_owned = false;
32240         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32241         return ret_conv;
32242 }
32243
32244 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32245         LDKUpdateFailMalformedHTLC this_ptr_conv;
32246         this_ptr_conv.inner = untag_ptr(this_ptr);
32247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32249         this_ptr_conv.is_owned = false;
32250         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32251 }
32252
32253 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32254         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32255         uint64_t ret_ref = 0;
32256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32258         return ret_ref;
32259 }
32260 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32261         LDKUpdateFailMalformedHTLC arg_conv;
32262         arg_conv.inner = untag_ptr(arg);
32263         arg_conv.is_owned = ptr_is_owned(arg);
32264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32265         arg_conv.is_owned = false;
32266         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32267         return ret_conv;
32268 }
32269
32270 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32271         LDKUpdateFailMalformedHTLC orig_conv;
32272         orig_conv.inner = untag_ptr(orig);
32273         orig_conv.is_owned = ptr_is_owned(orig);
32274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32275         orig_conv.is_owned = false;
32276         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32277         uint64_t ret_ref = 0;
32278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32280         return ret_ref;
32281 }
32282
32283 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32284         LDKUpdateFailMalformedHTLC a_conv;
32285         a_conv.inner = untag_ptr(a);
32286         a_conv.is_owned = ptr_is_owned(a);
32287         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32288         a_conv.is_owned = false;
32289         LDKUpdateFailMalformedHTLC b_conv;
32290         b_conv.inner = untag_ptr(b);
32291         b_conv.is_owned = ptr_is_owned(b);
32292         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32293         b_conv.is_owned = false;
32294         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32295         return ret_conv;
32296 }
32297
32298 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32299         LDKCommitmentSigned this_obj_conv;
32300         this_obj_conv.inner = untag_ptr(this_obj);
32301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32303         CommitmentSigned_free(this_obj_conv);
32304 }
32305
32306 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32307         LDKCommitmentSigned this_ptr_conv;
32308         this_ptr_conv.inner = untag_ptr(this_ptr);
32309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32311         this_ptr_conv.is_owned = false;
32312         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32313         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32314         return ret_arr;
32315 }
32316
32317 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32318         LDKCommitmentSigned this_ptr_conv;
32319         this_ptr_conv.inner = untag_ptr(this_ptr);
32320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32322         this_ptr_conv.is_owned = false;
32323         LDKThirtyTwoBytes val_ref;
32324         CHECK(val->arr_len == 32);
32325         memcpy(val_ref.data, val->elems, 32); FREE(val);
32326         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32327 }
32328
32329 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32330         LDKCommitmentSigned this_ptr_conv;
32331         this_ptr_conv.inner = untag_ptr(this_ptr);
32332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32334         this_ptr_conv.is_owned = false;
32335         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32336         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32337         return ret_arr;
32338 }
32339
32340 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32341         LDKCommitmentSigned this_ptr_conv;
32342         this_ptr_conv.inner = untag_ptr(this_ptr);
32343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32345         this_ptr_conv.is_owned = false;
32346         LDKSignature val_ref;
32347         CHECK(val->arr_len == 64);
32348         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32349         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32350 }
32351
32352 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
32353         LDKCommitmentSigned this_ptr_conv;
32354         this_ptr_conv.inner = untag_ptr(this_ptr);
32355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32357         this_ptr_conv.is_owned = false;
32358         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32359         ptrArray ret_arr = NULL;
32360         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32361         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32362         for (size_t m = 0; m < ret_var.datalen; m++) {
32363                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
32364                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
32365                 ret_arr_ptr[m] = ret_conv_12_arr;
32366         }
32367         
32368         FREE(ret_var.data);
32369         return ret_arr;
32370 }
32371
32372 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
32373         LDKCommitmentSigned this_ptr_conv;
32374         this_ptr_conv.inner = untag_ptr(this_ptr);
32375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32377         this_ptr_conv.is_owned = false;
32378         LDKCVec_SignatureZ val_constr;
32379         val_constr.datalen = val->arr_len;
32380         if (val_constr.datalen > 0)
32381                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32382         else
32383                 val_constr.data = NULL;
32384         int8_tArray* val_vals = (void*) val->elems;
32385         for (size_t m = 0; m < val_constr.datalen; m++) {
32386                 int8_tArray val_conv_12 = val_vals[m];
32387                 LDKSignature val_conv_12_ref;
32388                 CHECK(val_conv_12->arr_len == 64);
32389                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
32390                 val_constr.data[m] = val_conv_12_ref;
32391         }
32392         FREE(val);
32393         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
32394 }
32395
32396 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
32397         LDKThirtyTwoBytes channel_id_arg_ref;
32398         CHECK(channel_id_arg->arr_len == 32);
32399         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32400         LDKSignature signature_arg_ref;
32401         CHECK(signature_arg->arr_len == 64);
32402         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32403         LDKCVec_SignatureZ htlc_signatures_arg_constr;
32404         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
32405         if (htlc_signatures_arg_constr.datalen > 0)
32406                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32407         else
32408                 htlc_signatures_arg_constr.data = NULL;
32409         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
32410         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
32411                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
32412                 LDKSignature htlc_signatures_arg_conv_12_ref;
32413                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
32414                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
32415                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
32416         }
32417         FREE(htlc_signatures_arg);
32418         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
32419         uint64_t ret_ref = 0;
32420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32422         return ret_ref;
32423 }
32424
32425 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
32426         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
32427         uint64_t ret_ref = 0;
32428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32430         return ret_ref;
32431 }
32432 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
32433         LDKCommitmentSigned arg_conv;
32434         arg_conv.inner = untag_ptr(arg);
32435         arg_conv.is_owned = ptr_is_owned(arg);
32436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32437         arg_conv.is_owned = false;
32438         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
32439         return ret_conv;
32440 }
32441
32442 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
32443         LDKCommitmentSigned orig_conv;
32444         orig_conv.inner = untag_ptr(orig);
32445         orig_conv.is_owned = ptr_is_owned(orig);
32446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32447         orig_conv.is_owned = false;
32448         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
32449         uint64_t ret_ref = 0;
32450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32452         return ret_ref;
32453 }
32454
32455 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
32456         LDKCommitmentSigned a_conv;
32457         a_conv.inner = untag_ptr(a);
32458         a_conv.is_owned = ptr_is_owned(a);
32459         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32460         a_conv.is_owned = false;
32461         LDKCommitmentSigned b_conv;
32462         b_conv.inner = untag_ptr(b);
32463         b_conv.is_owned = ptr_is_owned(b);
32464         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32465         b_conv.is_owned = false;
32466         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
32467         return ret_conv;
32468 }
32469
32470 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
32471         LDKRevokeAndACK this_obj_conv;
32472         this_obj_conv.inner = untag_ptr(this_obj);
32473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32475         RevokeAndACK_free(this_obj_conv);
32476 }
32477
32478 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
32479         LDKRevokeAndACK this_ptr_conv;
32480         this_ptr_conv.inner = untag_ptr(this_ptr);
32481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32483         this_ptr_conv.is_owned = false;
32484         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32485         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
32486         return ret_arr;
32487 }
32488
32489 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32490         LDKRevokeAndACK this_ptr_conv;
32491         this_ptr_conv.inner = untag_ptr(this_ptr);
32492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32494         this_ptr_conv.is_owned = false;
32495         LDKThirtyTwoBytes val_ref;
32496         CHECK(val->arr_len == 32);
32497         memcpy(val_ref.data, val->elems, 32); FREE(val);
32498         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
32499 }
32500
32501 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
32502         LDKRevokeAndACK this_ptr_conv;
32503         this_ptr_conv.inner = untag_ptr(this_ptr);
32504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32506         this_ptr_conv.is_owned = false;
32507         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32508         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
32509         return ret_arr;
32510 }
32511
32512 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
32513         LDKRevokeAndACK this_ptr_conv;
32514         this_ptr_conv.inner = untag_ptr(this_ptr);
32515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32517         this_ptr_conv.is_owned = false;
32518         LDKThirtyTwoBytes val_ref;
32519         CHECK(val->arr_len == 32);
32520         memcpy(val_ref.data, val->elems, 32); FREE(val);
32521         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
32522 }
32523
32524 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
32525         LDKRevokeAndACK this_ptr_conv;
32526         this_ptr_conv.inner = untag_ptr(this_ptr);
32527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32529         this_ptr_conv.is_owned = false;
32530         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32531         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32532         return ret_arr;
32533 }
32534
32535 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) {
32536         LDKRevokeAndACK this_ptr_conv;
32537         this_ptr_conv.inner = untag_ptr(this_ptr);
32538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32540         this_ptr_conv.is_owned = false;
32541         LDKPublicKey val_ref;
32542         CHECK(val->arr_len == 33);
32543         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32544         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32545 }
32546
32547 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) {
32548         LDKThirtyTwoBytes channel_id_arg_ref;
32549         CHECK(channel_id_arg->arr_len == 32);
32550         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32551         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
32552         CHECK(per_commitment_secret_arg->arr_len == 32);
32553         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
32554         LDKPublicKey next_per_commitment_point_arg_ref;
32555         CHECK(next_per_commitment_point_arg->arr_len == 33);
32556         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
32557         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
32558         uint64_t ret_ref = 0;
32559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32561         return ret_ref;
32562 }
32563
32564 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
32565         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
32566         uint64_t ret_ref = 0;
32567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32569         return ret_ref;
32570 }
32571 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
32572         LDKRevokeAndACK arg_conv;
32573         arg_conv.inner = untag_ptr(arg);
32574         arg_conv.is_owned = ptr_is_owned(arg);
32575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32576         arg_conv.is_owned = false;
32577         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
32578         return ret_conv;
32579 }
32580
32581 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
32582         LDKRevokeAndACK orig_conv;
32583         orig_conv.inner = untag_ptr(orig);
32584         orig_conv.is_owned = ptr_is_owned(orig);
32585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32586         orig_conv.is_owned = false;
32587         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
32588         uint64_t ret_ref = 0;
32589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32591         return ret_ref;
32592 }
32593
32594 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
32595         LDKRevokeAndACK a_conv;
32596         a_conv.inner = untag_ptr(a);
32597         a_conv.is_owned = ptr_is_owned(a);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32599         a_conv.is_owned = false;
32600         LDKRevokeAndACK b_conv;
32601         b_conv.inner = untag_ptr(b);
32602         b_conv.is_owned = ptr_is_owned(b);
32603         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32604         b_conv.is_owned = false;
32605         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
32606         return ret_conv;
32607 }
32608
32609 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
32610         LDKUpdateFee this_obj_conv;
32611         this_obj_conv.inner = untag_ptr(this_obj);
32612         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32614         UpdateFee_free(this_obj_conv);
32615 }
32616
32617 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
32618         LDKUpdateFee this_ptr_conv;
32619         this_ptr_conv.inner = untag_ptr(this_ptr);
32620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32622         this_ptr_conv.is_owned = false;
32623         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32624         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
32625         return ret_arr;
32626 }
32627
32628 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32629         LDKUpdateFee this_ptr_conv;
32630         this_ptr_conv.inner = untag_ptr(this_ptr);
32631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32633         this_ptr_conv.is_owned = false;
32634         LDKThirtyTwoBytes val_ref;
32635         CHECK(val->arr_len == 32);
32636         memcpy(val_ref.data, val->elems, 32); FREE(val);
32637         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
32638 }
32639
32640 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
32641         LDKUpdateFee this_ptr_conv;
32642         this_ptr_conv.inner = untag_ptr(this_ptr);
32643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32645         this_ptr_conv.is_owned = false;
32646         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
32647         return ret_conv;
32648 }
32649
32650 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
32651         LDKUpdateFee this_ptr_conv;
32652         this_ptr_conv.inner = untag_ptr(this_ptr);
32653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32655         this_ptr_conv.is_owned = false;
32656         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
32657 }
32658
32659 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
32660         LDKThirtyTwoBytes channel_id_arg_ref;
32661         CHECK(channel_id_arg->arr_len == 32);
32662         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32663         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
32664         uint64_t ret_ref = 0;
32665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32667         return ret_ref;
32668 }
32669
32670 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32671         LDKUpdateFee ret_var = UpdateFee_clone(arg);
32672         uint64_t ret_ref = 0;
32673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32675         return ret_ref;
32676 }
32677 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
32678         LDKUpdateFee arg_conv;
32679         arg_conv.inner = untag_ptr(arg);
32680         arg_conv.is_owned = ptr_is_owned(arg);
32681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32682         arg_conv.is_owned = false;
32683         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
32684         return ret_conv;
32685 }
32686
32687 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
32688         LDKUpdateFee orig_conv;
32689         orig_conv.inner = untag_ptr(orig);
32690         orig_conv.is_owned = ptr_is_owned(orig);
32691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32692         orig_conv.is_owned = false;
32693         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32694         uint64_t ret_ref = 0;
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32697         return ret_ref;
32698 }
32699
32700 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
32701         LDKUpdateFee a_conv;
32702         a_conv.inner = untag_ptr(a);
32703         a_conv.is_owned = ptr_is_owned(a);
32704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32705         a_conv.is_owned = false;
32706         LDKUpdateFee b_conv;
32707         b_conv.inner = untag_ptr(b);
32708         b_conv.is_owned = ptr_is_owned(b);
32709         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32710         b_conv.is_owned = false;
32711         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
32712         return ret_conv;
32713 }
32714
32715 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
32716         LDKDataLossProtect this_obj_conv;
32717         this_obj_conv.inner = untag_ptr(this_obj);
32718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32720         DataLossProtect_free(this_obj_conv);
32721 }
32722
32723 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) {
32724         LDKDataLossProtect this_ptr_conv;
32725         this_ptr_conv.inner = untag_ptr(this_ptr);
32726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32728         this_ptr_conv.is_owned = false;
32729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32730         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
32731         return ret_arr;
32732 }
32733
32734 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) {
32735         LDKDataLossProtect this_ptr_conv;
32736         this_ptr_conv.inner = untag_ptr(this_ptr);
32737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32739         this_ptr_conv.is_owned = false;
32740         LDKThirtyTwoBytes val_ref;
32741         CHECK(val->arr_len == 32);
32742         memcpy(val_ref.data, val->elems, 32); FREE(val);
32743         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32744 }
32745
32746 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) {
32747         LDKDataLossProtect this_ptr_conv;
32748         this_ptr_conv.inner = untag_ptr(this_ptr);
32749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32751         this_ptr_conv.is_owned = false;
32752         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32753         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32754         return ret_arr;
32755 }
32756
32757 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) {
32758         LDKDataLossProtect this_ptr_conv;
32759         this_ptr_conv.inner = untag_ptr(this_ptr);
32760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32762         this_ptr_conv.is_owned = false;
32763         LDKPublicKey val_ref;
32764         CHECK(val->arr_len == 33);
32765         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32766         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32767 }
32768
32769 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) {
32770         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32771         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
32772         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
32773         LDKPublicKey my_current_per_commitment_point_arg_ref;
32774         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
32775         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);
32776         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32777         uint64_t ret_ref = 0;
32778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32780         return ret_ref;
32781 }
32782
32783 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32784         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32785         uint64_t ret_ref = 0;
32786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32788         return ret_ref;
32789 }
32790 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
32791         LDKDataLossProtect arg_conv;
32792         arg_conv.inner = untag_ptr(arg);
32793         arg_conv.is_owned = ptr_is_owned(arg);
32794         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32795         arg_conv.is_owned = false;
32796         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
32797         return ret_conv;
32798 }
32799
32800 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
32801         LDKDataLossProtect orig_conv;
32802         orig_conv.inner = untag_ptr(orig);
32803         orig_conv.is_owned = ptr_is_owned(orig);
32804         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32805         orig_conv.is_owned = false;
32806         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32807         uint64_t ret_ref = 0;
32808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32810         return ret_ref;
32811 }
32812
32813 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
32814         LDKDataLossProtect a_conv;
32815         a_conv.inner = untag_ptr(a);
32816         a_conv.is_owned = ptr_is_owned(a);
32817         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32818         a_conv.is_owned = false;
32819         LDKDataLossProtect b_conv;
32820         b_conv.inner = untag_ptr(b);
32821         b_conv.is_owned = ptr_is_owned(b);
32822         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32823         b_conv.is_owned = false;
32824         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
32825         return ret_conv;
32826 }
32827
32828 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
32829         LDKChannelReestablish this_obj_conv;
32830         this_obj_conv.inner = untag_ptr(this_obj);
32831         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32833         ChannelReestablish_free(this_obj_conv);
32834 }
32835
32836 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
32837         LDKChannelReestablish this_ptr_conv;
32838         this_ptr_conv.inner = untag_ptr(this_ptr);
32839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32841         this_ptr_conv.is_owned = false;
32842         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32843         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
32844         return ret_arr;
32845 }
32846
32847 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32848         LDKChannelReestablish this_ptr_conv;
32849         this_ptr_conv.inner = untag_ptr(this_ptr);
32850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32852         this_ptr_conv.is_owned = false;
32853         LDKThirtyTwoBytes val_ref;
32854         CHECK(val->arr_len == 32);
32855         memcpy(val_ref.data, val->elems, 32); FREE(val);
32856         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32857 }
32858
32859 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
32860         LDKChannelReestablish this_ptr_conv;
32861         this_ptr_conv.inner = untag_ptr(this_ptr);
32862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32864         this_ptr_conv.is_owned = false;
32865         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32866         return ret_conv;
32867 }
32868
32869 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) {
32870         LDKChannelReestablish this_ptr_conv;
32871         this_ptr_conv.inner = untag_ptr(this_ptr);
32872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32874         this_ptr_conv.is_owned = false;
32875         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32876 }
32877
32878 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
32879         LDKChannelReestablish this_ptr_conv;
32880         this_ptr_conv.inner = untag_ptr(this_ptr);
32881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32883         this_ptr_conv.is_owned = false;
32884         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32885         return ret_conv;
32886 }
32887
32888 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) {
32889         LDKChannelReestablish this_ptr_conv;
32890         this_ptr_conv.inner = untag_ptr(this_ptr);
32891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32893         this_ptr_conv.is_owned = false;
32894         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32895 }
32896
32897 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32898         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32899         uint64_t ret_ref = 0;
32900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32902         return ret_ref;
32903 }
32904 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
32905         LDKChannelReestablish arg_conv;
32906         arg_conv.inner = untag_ptr(arg);
32907         arg_conv.is_owned = ptr_is_owned(arg);
32908         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32909         arg_conv.is_owned = false;
32910         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
32911         return ret_conv;
32912 }
32913
32914 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
32915         LDKChannelReestablish orig_conv;
32916         orig_conv.inner = untag_ptr(orig);
32917         orig_conv.is_owned = ptr_is_owned(orig);
32918         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32919         orig_conv.is_owned = false;
32920         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32921         uint64_t ret_ref = 0;
32922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32924         return ret_ref;
32925 }
32926
32927 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
32928         LDKChannelReestablish a_conv;
32929         a_conv.inner = untag_ptr(a);
32930         a_conv.is_owned = ptr_is_owned(a);
32931         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32932         a_conv.is_owned = false;
32933         LDKChannelReestablish b_conv;
32934         b_conv.inner = untag_ptr(b);
32935         b_conv.is_owned = ptr_is_owned(b);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32937         b_conv.is_owned = false;
32938         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
32939         return ret_conv;
32940 }
32941
32942 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
32943         LDKAnnouncementSignatures this_obj_conv;
32944         this_obj_conv.inner = untag_ptr(this_obj);
32945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32947         AnnouncementSignatures_free(this_obj_conv);
32948 }
32949
32950 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
32951         LDKAnnouncementSignatures this_ptr_conv;
32952         this_ptr_conv.inner = untag_ptr(this_ptr);
32953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32955         this_ptr_conv.is_owned = false;
32956         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32957         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
32958         return ret_arr;
32959 }
32960
32961 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32962         LDKAnnouncementSignatures this_ptr_conv;
32963         this_ptr_conv.inner = untag_ptr(this_ptr);
32964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32966         this_ptr_conv.is_owned = false;
32967         LDKThirtyTwoBytes val_ref;
32968         CHECK(val->arr_len == 32);
32969         memcpy(val_ref.data, val->elems, 32); FREE(val);
32970         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32971 }
32972
32973 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
32974         LDKAnnouncementSignatures this_ptr_conv;
32975         this_ptr_conv.inner = untag_ptr(this_ptr);
32976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32978         this_ptr_conv.is_owned = false;
32979         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32980         return ret_conv;
32981 }
32982
32983 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32984         LDKAnnouncementSignatures this_ptr_conv;
32985         this_ptr_conv.inner = untag_ptr(this_ptr);
32986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32988         this_ptr_conv.is_owned = false;
32989         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
32990 }
32991
32992 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
32993         LDKAnnouncementSignatures this_ptr_conv;
32994         this_ptr_conv.inner = untag_ptr(this_ptr);
32995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32997         this_ptr_conv.is_owned = false;
32998         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32999         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33000         return ret_arr;
33001 }
33002
33003 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33004         LDKAnnouncementSignatures this_ptr_conv;
33005         this_ptr_conv.inner = untag_ptr(this_ptr);
33006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33008         this_ptr_conv.is_owned = false;
33009         LDKSignature val_ref;
33010         CHECK(val->arr_len == 64);
33011         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33012         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33013 }
33014
33015 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33016         LDKAnnouncementSignatures this_ptr_conv;
33017         this_ptr_conv.inner = untag_ptr(this_ptr);
33018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33020         this_ptr_conv.is_owned = false;
33021         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33022         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33023         return ret_arr;
33024 }
33025
33026 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33027         LDKAnnouncementSignatures this_ptr_conv;
33028         this_ptr_conv.inner = untag_ptr(this_ptr);
33029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33031         this_ptr_conv.is_owned = false;
33032         LDKSignature val_ref;
33033         CHECK(val->arr_len == 64);
33034         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33035         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33036 }
33037
33038 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) {
33039         LDKThirtyTwoBytes channel_id_arg_ref;
33040         CHECK(channel_id_arg->arr_len == 32);
33041         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33042         LDKSignature node_signature_arg_ref;
33043         CHECK(node_signature_arg->arr_len == 64);
33044         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33045         LDKSignature bitcoin_signature_arg_ref;
33046         CHECK(bitcoin_signature_arg->arr_len == 64);
33047         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33048         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33049         uint64_t ret_ref = 0;
33050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33052         return ret_ref;
33053 }
33054
33055 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33056         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33057         uint64_t ret_ref = 0;
33058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33060         return ret_ref;
33061 }
33062 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33063         LDKAnnouncementSignatures arg_conv;
33064         arg_conv.inner = untag_ptr(arg);
33065         arg_conv.is_owned = ptr_is_owned(arg);
33066         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33067         arg_conv.is_owned = false;
33068         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33069         return ret_conv;
33070 }
33071
33072 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33073         LDKAnnouncementSignatures orig_conv;
33074         orig_conv.inner = untag_ptr(orig);
33075         orig_conv.is_owned = ptr_is_owned(orig);
33076         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33077         orig_conv.is_owned = false;
33078         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33079         uint64_t ret_ref = 0;
33080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33082         return ret_ref;
33083 }
33084
33085 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33086         LDKAnnouncementSignatures a_conv;
33087         a_conv.inner = untag_ptr(a);
33088         a_conv.is_owned = ptr_is_owned(a);
33089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33090         a_conv.is_owned = false;
33091         LDKAnnouncementSignatures b_conv;
33092         b_conv.inner = untag_ptr(b);
33093         b_conv.is_owned = ptr_is_owned(b);
33094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33095         b_conv.is_owned = false;
33096         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33097         return ret_conv;
33098 }
33099
33100 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33101         if (!ptr_is_owned(this_ptr)) return;
33102         void* this_ptr_ptr = untag_ptr(this_ptr);
33103         CHECK_ACCESS(this_ptr_ptr);
33104         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33105         FREE(untag_ptr(this_ptr));
33106         NetAddress_free(this_ptr_conv);
33107 }
33108
33109 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33110         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33111         *ret_copy = NetAddress_clone(arg);
33112         uint64_t ret_ref = tag_ptr(ret_copy, true);
33113         return ret_ref;
33114 }
33115 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33116         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33117         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33118         return ret_conv;
33119 }
33120
33121 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33122         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33123         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33124         *ret_copy = NetAddress_clone(orig_conv);
33125         uint64_t ret_ref = tag_ptr(ret_copy, true);
33126         return ret_ref;
33127 }
33128
33129 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33130         LDKFourBytes addr_ref;
33131         CHECK(addr->arr_len == 4);
33132         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33133         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33134         *ret_copy = NetAddress_ipv4(addr_ref, port);
33135         uint64_t ret_ref = tag_ptr(ret_copy, true);
33136         return ret_ref;
33137 }
33138
33139 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33140         LDKSixteenBytes addr_ref;
33141         CHECK(addr->arr_len == 16);
33142         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33143         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33144         *ret_copy = NetAddress_ipv6(addr_ref, port);
33145         uint64_t ret_ref = tag_ptr(ret_copy, true);
33146         return ret_ref;
33147 }
33148
33149 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33150         LDKTwelveBytes a_ref;
33151         CHECK(a->arr_len == 12);
33152         memcpy(a_ref.data, a->elems, 12); FREE(a);
33153         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33154         *ret_copy = NetAddress_onion_v2(a_ref);
33155         uint64_t ret_ref = tag_ptr(ret_copy, true);
33156         return ret_ref;
33157 }
33158
33159 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) {
33160         LDKThirtyTwoBytes ed25519_pubkey_ref;
33161         CHECK(ed25519_pubkey->arr_len == 32);
33162         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33163         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33164         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33165         uint64_t ret_ref = tag_ptr(ret_copy, true);
33166         return ret_ref;
33167 }
33168
33169 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33170         LDKHostname hostname_conv;
33171         hostname_conv.inner = untag_ptr(hostname);
33172         hostname_conv.is_owned = ptr_is_owned(hostname);
33173         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33174         hostname_conv = Hostname_clone(&hostname_conv);
33175         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33176         *ret_copy = NetAddress_hostname(hostname_conv, port);
33177         uint64_t ret_ref = tag_ptr(ret_copy, true);
33178         return ret_ref;
33179 }
33180
33181 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33182         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33183         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33184         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33185         return ret_conv;
33186 }
33187
33188 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33189         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33190         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33193         CVec_u8Z_free(ret_var);
33194         return ret_arr;
33195 }
33196
33197 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33198         LDKu8slice ser_ref;
33199         ser_ref.datalen = ser->arr_len;
33200         ser_ref.data = ser->elems;
33201         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33202         *ret_conv = NetAddress_read(ser_ref);
33203         FREE(ser);
33204         return tag_ptr(ret_conv, true);
33205 }
33206
33207 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33208         LDKUnsignedNodeAnnouncement this_obj_conv;
33209         this_obj_conv.inner = untag_ptr(this_obj);
33210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33212         UnsignedNodeAnnouncement_free(this_obj_conv);
33213 }
33214
33215 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33216         LDKUnsignedNodeAnnouncement this_ptr_conv;
33217         this_ptr_conv.inner = untag_ptr(this_ptr);
33218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33220         this_ptr_conv.is_owned = false;
33221         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33222         uint64_t ret_ref = 0;
33223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33225         return ret_ref;
33226 }
33227
33228 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33229         LDKUnsignedNodeAnnouncement this_ptr_conv;
33230         this_ptr_conv.inner = untag_ptr(this_ptr);
33231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33233         this_ptr_conv.is_owned = false;
33234         LDKNodeFeatures val_conv;
33235         val_conv.inner = untag_ptr(val);
33236         val_conv.is_owned = ptr_is_owned(val);
33237         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33238         val_conv = NodeFeatures_clone(&val_conv);
33239         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33240 }
33241
33242 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33243         LDKUnsignedNodeAnnouncement this_ptr_conv;
33244         this_ptr_conv.inner = untag_ptr(this_ptr);
33245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33247         this_ptr_conv.is_owned = false;
33248         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33249         return ret_conv;
33250 }
33251
33252 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33253         LDKUnsignedNodeAnnouncement this_ptr_conv;
33254         this_ptr_conv.inner = untag_ptr(this_ptr);
33255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33257         this_ptr_conv.is_owned = false;
33258         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33259 }
33260
33261 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33262         LDKUnsignedNodeAnnouncement this_ptr_conv;
33263         this_ptr_conv.inner = untag_ptr(this_ptr);
33264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33266         this_ptr_conv.is_owned = false;
33267         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33268         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
33269         return ret_arr;
33270 }
33271
33272 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
33273         LDKUnsignedNodeAnnouncement this_ptr_conv;
33274         this_ptr_conv.inner = untag_ptr(this_ptr);
33275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33277         this_ptr_conv.is_owned = false;
33278         LDKPublicKey val_ref;
33279         CHECK(val->arr_len == 33);
33280         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33281         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33282 }
33283
33284 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
33285         LDKUnsignedNodeAnnouncement this_ptr_conv;
33286         this_ptr_conv.inner = untag_ptr(this_ptr);
33287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33289         this_ptr_conv.is_owned = false;
33290         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
33291         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
33292         return ret_arr;
33293 }
33294
33295 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
33296         LDKUnsignedNodeAnnouncement this_ptr_conv;
33297         this_ptr_conv.inner = untag_ptr(this_ptr);
33298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33300         this_ptr_conv.is_owned = false;
33301         LDKThreeBytes val_ref;
33302         CHECK(val->arr_len == 3);
33303         memcpy(val_ref.data, val->elems, 3); FREE(val);
33304         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33305 }
33306
33307 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
33308         LDKUnsignedNodeAnnouncement this_ptr_conv;
33309         this_ptr_conv.inner = untag_ptr(this_ptr);
33310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33312         this_ptr_conv.is_owned = false;
33313         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33314         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
33315         return ret_arr;
33316 }
33317
33318 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
33319         LDKUnsignedNodeAnnouncement this_ptr_conv;
33320         this_ptr_conv.inner = untag_ptr(this_ptr);
33321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33323         this_ptr_conv.is_owned = false;
33324         LDKThirtyTwoBytes val_ref;
33325         CHECK(val->arr_len == 32);
33326         memcpy(val_ref.data, val->elems, 32); FREE(val);
33327         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33328 }
33329
33330 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
33331         LDKUnsignedNodeAnnouncement this_ptr_conv;
33332         this_ptr_conv.inner = untag_ptr(this_ptr);
33333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33335         this_ptr_conv.is_owned = false;
33336         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
33337         uint64_tArray ret_arr = NULL;
33338         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33339         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33340         for (size_t m = 0; m < ret_var.datalen; m++) {
33341                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33342                 *ret_conv_12_copy = ret_var.data[m];
33343                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
33344                 ret_arr_ptr[m] = ret_conv_12_ref;
33345         }
33346         
33347         FREE(ret_var.data);
33348         return ret_arr;
33349 }
33350
33351 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
33352         LDKUnsignedNodeAnnouncement this_ptr_conv;
33353         this_ptr_conv.inner = untag_ptr(this_ptr);
33354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33356         this_ptr_conv.is_owned = false;
33357         LDKCVec_NetAddressZ val_constr;
33358         val_constr.datalen = val->arr_len;
33359         if (val_constr.datalen > 0)
33360                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33361         else
33362                 val_constr.data = NULL;
33363         uint64_t* val_vals = val->elems;
33364         for (size_t m = 0; m < val_constr.datalen; m++) {
33365                 uint64_t val_conv_12 = val_vals[m];
33366                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
33367                 CHECK_ACCESS(val_conv_12_ptr);
33368                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33369                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
33370                 val_constr.data[m] = val_conv_12_conv;
33371         }
33372         FREE(val);
33373         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33374 }
33375
33376 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33377         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33378         uint64_t ret_ref = 0;
33379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33381         return ret_ref;
33382 }
33383 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
33384         LDKUnsignedNodeAnnouncement arg_conv;
33385         arg_conv.inner = untag_ptr(arg);
33386         arg_conv.is_owned = ptr_is_owned(arg);
33387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33388         arg_conv.is_owned = false;
33389         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33390         return ret_conv;
33391 }
33392
33393 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
33394         LDKUnsignedNodeAnnouncement orig_conv;
33395         orig_conv.inner = untag_ptr(orig);
33396         orig_conv.is_owned = ptr_is_owned(orig);
33397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33398         orig_conv.is_owned = false;
33399         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
33400         uint64_t ret_ref = 0;
33401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33403         return ret_ref;
33404 }
33405
33406 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
33407         LDKUnsignedNodeAnnouncement a_conv;
33408         a_conv.inner = untag_ptr(a);
33409         a_conv.is_owned = ptr_is_owned(a);
33410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33411         a_conv.is_owned = false;
33412         LDKUnsignedNodeAnnouncement b_conv;
33413         b_conv.inner = untag_ptr(b);
33414         b_conv.is_owned = ptr_is_owned(b);
33415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33416         b_conv.is_owned = false;
33417         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
33418         return ret_conv;
33419 }
33420
33421 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
33422         LDKNodeAnnouncement this_obj_conv;
33423         this_obj_conv.inner = untag_ptr(this_obj);
33424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33426         NodeAnnouncement_free(this_obj_conv);
33427 }
33428
33429 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
33430         LDKNodeAnnouncement this_ptr_conv;
33431         this_ptr_conv.inner = untag_ptr(this_ptr);
33432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33434         this_ptr_conv.is_owned = false;
33435         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33436         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
33437         return ret_arr;
33438 }
33439
33440 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
33441         LDKNodeAnnouncement this_ptr_conv;
33442         this_ptr_conv.inner = untag_ptr(this_ptr);
33443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33445         this_ptr_conv.is_owned = false;
33446         LDKSignature val_ref;
33447         CHECK(val->arr_len == 64);
33448         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33449         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
33450 }
33451
33452 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
33453         LDKNodeAnnouncement this_ptr_conv;
33454         this_ptr_conv.inner = untag_ptr(this_ptr);
33455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33457         this_ptr_conv.is_owned = false;
33458         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
33459         uint64_t ret_ref = 0;
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33462         return ret_ref;
33463 }
33464
33465 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
33466         LDKNodeAnnouncement this_ptr_conv;
33467         this_ptr_conv.inner = untag_ptr(this_ptr);
33468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33470         this_ptr_conv.is_owned = false;
33471         LDKUnsignedNodeAnnouncement val_conv;
33472         val_conv.inner = untag_ptr(val);
33473         val_conv.is_owned = ptr_is_owned(val);
33474         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33475         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
33476         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
33477 }
33478
33479 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
33480         LDKSignature signature_arg_ref;
33481         CHECK(signature_arg->arr_len == 64);
33482         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33483         LDKUnsignedNodeAnnouncement contents_arg_conv;
33484         contents_arg_conv.inner = untag_ptr(contents_arg);
33485         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33487         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
33488         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
33489         uint64_t ret_ref = 0;
33490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33492         return ret_ref;
33493 }
33494
33495 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
33496         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
33497         uint64_t ret_ref = 0;
33498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33500         return ret_ref;
33501 }
33502 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
33503         LDKNodeAnnouncement arg_conv;
33504         arg_conv.inner = untag_ptr(arg);
33505         arg_conv.is_owned = ptr_is_owned(arg);
33506         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33507         arg_conv.is_owned = false;
33508         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
33509         return ret_conv;
33510 }
33511
33512 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
33513         LDKNodeAnnouncement orig_conv;
33514         orig_conv.inner = untag_ptr(orig);
33515         orig_conv.is_owned = ptr_is_owned(orig);
33516         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33517         orig_conv.is_owned = false;
33518         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
33519         uint64_t ret_ref = 0;
33520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33522         return ret_ref;
33523 }
33524
33525 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
33526         LDKNodeAnnouncement a_conv;
33527         a_conv.inner = untag_ptr(a);
33528         a_conv.is_owned = ptr_is_owned(a);
33529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33530         a_conv.is_owned = false;
33531         LDKNodeAnnouncement b_conv;
33532         b_conv.inner = untag_ptr(b);
33533         b_conv.is_owned = ptr_is_owned(b);
33534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33535         b_conv.is_owned = false;
33536         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
33537         return ret_conv;
33538 }
33539
33540 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
33541         LDKUnsignedChannelAnnouncement this_obj_conv;
33542         this_obj_conv.inner = untag_ptr(this_obj);
33543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33545         UnsignedChannelAnnouncement_free(this_obj_conv);
33546 }
33547
33548 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
33549         LDKUnsignedChannelAnnouncement this_ptr_conv;
33550         this_ptr_conv.inner = untag_ptr(this_ptr);
33551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33553         this_ptr_conv.is_owned = false;
33554         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
33555         uint64_t ret_ref = 0;
33556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33558         return ret_ref;
33559 }
33560
33561 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33562         LDKUnsignedChannelAnnouncement this_ptr_conv;
33563         this_ptr_conv.inner = untag_ptr(this_ptr);
33564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33566         this_ptr_conv.is_owned = false;
33567         LDKChannelFeatures val_conv;
33568         val_conv.inner = untag_ptr(val);
33569         val_conv.is_owned = ptr_is_owned(val);
33570         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33571         val_conv = ChannelFeatures_clone(&val_conv);
33572         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
33573 }
33574
33575 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
33576         LDKUnsignedChannelAnnouncement this_ptr_conv;
33577         this_ptr_conv.inner = untag_ptr(this_ptr);
33578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33580         this_ptr_conv.is_owned = false;
33581         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33582         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
33583         return ret_arr;
33584 }
33585
33586 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33587         LDKUnsignedChannelAnnouncement this_ptr_conv;
33588         this_ptr_conv.inner = untag_ptr(this_ptr);
33589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33591         this_ptr_conv.is_owned = false;
33592         LDKThirtyTwoBytes val_ref;
33593         CHECK(val->arr_len == 32);
33594         memcpy(val_ref.data, val->elems, 32); FREE(val);
33595         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
33596 }
33597
33598 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
33599         LDKUnsignedChannelAnnouncement this_ptr_conv;
33600         this_ptr_conv.inner = untag_ptr(this_ptr);
33601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33603         this_ptr_conv.is_owned = false;
33604         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33605         return ret_conv;
33606 }
33607
33608 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33609         LDKUnsignedChannelAnnouncement this_ptr_conv;
33610         this_ptr_conv.inner = untag_ptr(this_ptr);
33611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613         this_ptr_conv.is_owned = false;
33614         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33615 }
33616
33617 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
33618         LDKUnsignedChannelAnnouncement this_ptr_conv;
33619         this_ptr_conv.inner = untag_ptr(this_ptr);
33620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33622         this_ptr_conv.is_owned = false;
33623         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33624         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
33625         return ret_arr;
33626 }
33627
33628 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
33629         LDKUnsignedChannelAnnouncement this_ptr_conv;
33630         this_ptr_conv.inner = untag_ptr(this_ptr);
33631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33633         this_ptr_conv.is_owned = false;
33634         LDKPublicKey val_ref;
33635         CHECK(val->arr_len == 33);
33636         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33637         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
33638 }
33639
33640 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
33641         LDKUnsignedChannelAnnouncement this_ptr_conv;
33642         this_ptr_conv.inner = untag_ptr(this_ptr);
33643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33645         this_ptr_conv.is_owned = false;
33646         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33647         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
33648         return ret_arr;
33649 }
33650
33651 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
33652         LDKUnsignedChannelAnnouncement this_ptr_conv;
33653         this_ptr_conv.inner = untag_ptr(this_ptr);
33654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33656         this_ptr_conv.is_owned = false;
33657         LDKPublicKey val_ref;
33658         CHECK(val->arr_len == 33);
33659         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33660         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
33661 }
33662
33663 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
33664         LDKUnsignedChannelAnnouncement this_ptr_conv;
33665         this_ptr_conv.inner = untag_ptr(this_ptr);
33666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33668         this_ptr_conv.is_owned = false;
33669         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33670         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
33671         return ret_arr;
33672 }
33673
33674 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
33675         LDKUnsignedChannelAnnouncement this_ptr_conv;
33676         this_ptr_conv.inner = untag_ptr(this_ptr);
33677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33679         this_ptr_conv.is_owned = false;
33680         LDKPublicKey val_ref;
33681         CHECK(val->arr_len == 33);
33682         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33683         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
33684 }
33685
33686 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
33687         LDKUnsignedChannelAnnouncement this_ptr_conv;
33688         this_ptr_conv.inner = untag_ptr(this_ptr);
33689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33691         this_ptr_conv.is_owned = false;
33692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33693         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
33694         return ret_arr;
33695 }
33696
33697 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
33698         LDKUnsignedChannelAnnouncement this_ptr_conv;
33699         this_ptr_conv.inner = untag_ptr(this_ptr);
33700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33702         this_ptr_conv.is_owned = false;
33703         LDKPublicKey val_ref;
33704         CHECK(val->arr_len == 33);
33705         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33706         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
33707 }
33708
33709 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
33710         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
33711         uint64_t ret_ref = 0;
33712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33714         return ret_ref;
33715 }
33716 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
33717         LDKUnsignedChannelAnnouncement arg_conv;
33718         arg_conv.inner = untag_ptr(arg);
33719         arg_conv.is_owned = ptr_is_owned(arg);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33721         arg_conv.is_owned = false;
33722         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
33723         return ret_conv;
33724 }
33725
33726 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
33727         LDKUnsignedChannelAnnouncement orig_conv;
33728         orig_conv.inner = untag_ptr(orig);
33729         orig_conv.is_owned = ptr_is_owned(orig);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33731         orig_conv.is_owned = false;
33732         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
33733         uint64_t ret_ref = 0;
33734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33736         return ret_ref;
33737 }
33738
33739 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
33740         LDKUnsignedChannelAnnouncement a_conv;
33741         a_conv.inner = untag_ptr(a);
33742         a_conv.is_owned = ptr_is_owned(a);
33743         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33744         a_conv.is_owned = false;
33745         LDKUnsignedChannelAnnouncement b_conv;
33746         b_conv.inner = untag_ptr(b);
33747         b_conv.is_owned = ptr_is_owned(b);
33748         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33749         b_conv.is_owned = false;
33750         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
33751         return ret_conv;
33752 }
33753
33754 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
33755         LDKChannelAnnouncement this_obj_conv;
33756         this_obj_conv.inner = untag_ptr(this_obj);
33757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33759         ChannelAnnouncement_free(this_obj_conv);
33760 }
33761
33762 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
33763         LDKChannelAnnouncement this_ptr_conv;
33764         this_ptr_conv.inner = untag_ptr(this_ptr);
33765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33767         this_ptr_conv.is_owned = false;
33768         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33769         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
33770         return ret_arr;
33771 }
33772
33773 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
33774         LDKChannelAnnouncement this_ptr_conv;
33775         this_ptr_conv.inner = untag_ptr(this_ptr);
33776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33778         this_ptr_conv.is_owned = false;
33779         LDKSignature val_ref;
33780         CHECK(val->arr_len == 64);
33781         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33782         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33783 }
33784
33785 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
33786         LDKChannelAnnouncement this_ptr_conv;
33787         this_ptr_conv.inner = untag_ptr(this_ptr);
33788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33790         this_ptr_conv.is_owned = false;
33791         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33792         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
33793         return ret_arr;
33794 }
33795
33796 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
33797         LDKChannelAnnouncement this_ptr_conv;
33798         this_ptr_conv.inner = untag_ptr(this_ptr);
33799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33801         this_ptr_conv.is_owned = false;
33802         LDKSignature val_ref;
33803         CHECK(val->arr_len == 64);
33804         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33805         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33806 }
33807
33808 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
33809         LDKChannelAnnouncement this_ptr_conv;
33810         this_ptr_conv.inner = untag_ptr(this_ptr);
33811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33813         this_ptr_conv.is_owned = false;
33814         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33815         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
33816         return ret_arr;
33817 }
33818
33819 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
33820         LDKChannelAnnouncement this_ptr_conv;
33821         this_ptr_conv.inner = untag_ptr(this_ptr);
33822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33824         this_ptr_conv.is_owned = false;
33825         LDKSignature val_ref;
33826         CHECK(val->arr_len == 64);
33827         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33828         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33829 }
33830
33831 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
33832         LDKChannelAnnouncement this_ptr_conv;
33833         this_ptr_conv.inner = untag_ptr(this_ptr);
33834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33836         this_ptr_conv.is_owned = false;
33837         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33838         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
33839         return ret_arr;
33840 }
33841
33842 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
33843         LDKChannelAnnouncement this_ptr_conv;
33844         this_ptr_conv.inner = untag_ptr(this_ptr);
33845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33847         this_ptr_conv.is_owned = false;
33848         LDKSignature val_ref;
33849         CHECK(val->arr_len == 64);
33850         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33851         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33852 }
33853
33854 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
33855         LDKChannelAnnouncement this_ptr_conv;
33856         this_ptr_conv.inner = untag_ptr(this_ptr);
33857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33859         this_ptr_conv.is_owned = false;
33860         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
33861         uint64_t ret_ref = 0;
33862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33864         return ret_ref;
33865 }
33866
33867 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
33868         LDKChannelAnnouncement this_ptr_conv;
33869         this_ptr_conv.inner = untag_ptr(this_ptr);
33870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33872         this_ptr_conv.is_owned = false;
33873         LDKUnsignedChannelAnnouncement val_conv;
33874         val_conv.inner = untag_ptr(val);
33875         val_conv.is_owned = ptr_is_owned(val);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33877         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33878         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33879 }
33880
33881 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) {
33882         LDKSignature node_signature_1_arg_ref;
33883         CHECK(node_signature_1_arg->arr_len == 64);
33884         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
33885         LDKSignature node_signature_2_arg_ref;
33886         CHECK(node_signature_2_arg->arr_len == 64);
33887         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
33888         LDKSignature bitcoin_signature_1_arg_ref;
33889         CHECK(bitcoin_signature_1_arg->arr_len == 64);
33890         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
33891         LDKSignature bitcoin_signature_2_arg_ref;
33892         CHECK(bitcoin_signature_2_arg->arr_len == 64);
33893         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
33894         LDKUnsignedChannelAnnouncement contents_arg_conv;
33895         contents_arg_conv.inner = untag_ptr(contents_arg);
33896         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33898         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33899         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);
33900         uint64_t ret_ref = 0;
33901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33903         return ret_ref;
33904 }
33905
33906 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33907         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33908         uint64_t ret_ref = 0;
33909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33911         return ret_ref;
33912 }
33913 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
33914         LDKChannelAnnouncement arg_conv;
33915         arg_conv.inner = untag_ptr(arg);
33916         arg_conv.is_owned = ptr_is_owned(arg);
33917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33918         arg_conv.is_owned = false;
33919         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
33920         return ret_conv;
33921 }
33922
33923 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
33924         LDKChannelAnnouncement orig_conv;
33925         orig_conv.inner = untag_ptr(orig);
33926         orig_conv.is_owned = ptr_is_owned(orig);
33927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33928         orig_conv.is_owned = false;
33929         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33930         uint64_t ret_ref = 0;
33931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33933         return ret_ref;
33934 }
33935
33936 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
33937         LDKChannelAnnouncement a_conv;
33938         a_conv.inner = untag_ptr(a);
33939         a_conv.is_owned = ptr_is_owned(a);
33940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33941         a_conv.is_owned = false;
33942         LDKChannelAnnouncement b_conv;
33943         b_conv.inner = untag_ptr(b);
33944         b_conv.is_owned = ptr_is_owned(b);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33946         b_conv.is_owned = false;
33947         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
33948         return ret_conv;
33949 }
33950
33951 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
33952         LDKUnsignedChannelUpdate this_obj_conv;
33953         this_obj_conv.inner = untag_ptr(this_obj);
33954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33956         UnsignedChannelUpdate_free(this_obj_conv);
33957 }
33958
33959 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
33960         LDKUnsignedChannelUpdate this_ptr_conv;
33961         this_ptr_conv.inner = untag_ptr(this_ptr);
33962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33964         this_ptr_conv.is_owned = false;
33965         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33966         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
33967         return ret_arr;
33968 }
33969
33970 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33971         LDKUnsignedChannelUpdate this_ptr_conv;
33972         this_ptr_conv.inner = untag_ptr(this_ptr);
33973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33975         this_ptr_conv.is_owned = false;
33976         LDKThirtyTwoBytes val_ref;
33977         CHECK(val->arr_len == 32);
33978         memcpy(val_ref.data, val->elems, 32); FREE(val);
33979         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33980 }
33981
33982 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
33983         LDKUnsignedChannelUpdate this_ptr_conv;
33984         this_ptr_conv.inner = untag_ptr(this_ptr);
33985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33987         this_ptr_conv.is_owned = false;
33988         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33989         return ret_conv;
33990 }
33991
33992 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33993         LDKUnsignedChannelUpdate this_ptr_conv;
33994         this_ptr_conv.inner = untag_ptr(this_ptr);
33995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33997         this_ptr_conv.is_owned = false;
33998         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
33999 }
34000
34001 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34002         LDKUnsignedChannelUpdate this_ptr_conv;
34003         this_ptr_conv.inner = untag_ptr(this_ptr);
34004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34006         this_ptr_conv.is_owned = false;
34007         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34008         return ret_conv;
34009 }
34010
34011 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34012         LDKUnsignedChannelUpdate this_ptr_conv;
34013         this_ptr_conv.inner = untag_ptr(this_ptr);
34014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34016         this_ptr_conv.is_owned = false;
34017         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34018 }
34019
34020 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34021         LDKUnsignedChannelUpdate this_ptr_conv;
34022         this_ptr_conv.inner = untag_ptr(this_ptr);
34023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34025         this_ptr_conv.is_owned = false;
34026         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34027         return ret_conv;
34028 }
34029
34030 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34031         LDKUnsignedChannelUpdate this_ptr_conv;
34032         this_ptr_conv.inner = untag_ptr(this_ptr);
34033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34035         this_ptr_conv.is_owned = false;
34036         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34037 }
34038
34039 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34040         LDKUnsignedChannelUpdate this_ptr_conv;
34041         this_ptr_conv.inner = untag_ptr(this_ptr);
34042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34044         this_ptr_conv.is_owned = false;
34045         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34046         return ret_conv;
34047 }
34048
34049 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34050         LDKUnsignedChannelUpdate this_ptr_conv;
34051         this_ptr_conv.inner = untag_ptr(this_ptr);
34052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34054         this_ptr_conv.is_owned = false;
34055         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34056 }
34057
34058 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34059         LDKUnsignedChannelUpdate this_ptr_conv;
34060         this_ptr_conv.inner = untag_ptr(this_ptr);
34061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34063         this_ptr_conv.is_owned = false;
34064         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34065         return ret_conv;
34066 }
34067
34068 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34069         LDKUnsignedChannelUpdate this_ptr_conv;
34070         this_ptr_conv.inner = untag_ptr(this_ptr);
34071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34073         this_ptr_conv.is_owned = false;
34074         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34075 }
34076
34077 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34078         LDKUnsignedChannelUpdate this_ptr_conv;
34079         this_ptr_conv.inner = untag_ptr(this_ptr);
34080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34082         this_ptr_conv.is_owned = false;
34083         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34084         return ret_conv;
34085 }
34086
34087 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34088         LDKUnsignedChannelUpdate this_ptr_conv;
34089         this_ptr_conv.inner = untag_ptr(this_ptr);
34090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34092         this_ptr_conv.is_owned = false;
34093         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34094 }
34095
34096 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34097         LDKUnsignedChannelUpdate this_ptr_conv;
34098         this_ptr_conv.inner = untag_ptr(this_ptr);
34099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34101         this_ptr_conv.is_owned = false;
34102         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34103         return ret_conv;
34104 }
34105
34106 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34107         LDKUnsignedChannelUpdate this_ptr_conv;
34108         this_ptr_conv.inner = untag_ptr(this_ptr);
34109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34111         this_ptr_conv.is_owned = false;
34112         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34113 }
34114
34115 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34116         LDKUnsignedChannelUpdate this_ptr_conv;
34117         this_ptr_conv.inner = untag_ptr(this_ptr);
34118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34120         this_ptr_conv.is_owned = false;
34121         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34122         return ret_conv;
34123 }
34124
34125 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34126         LDKUnsignedChannelUpdate this_ptr_conv;
34127         this_ptr_conv.inner = untag_ptr(this_ptr);
34128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130         this_ptr_conv.is_owned = false;
34131         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34132 }
34133
34134 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34135         LDKUnsignedChannelUpdate this_ptr_conv;
34136         this_ptr_conv.inner = untag_ptr(this_ptr);
34137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34139         this_ptr_conv.is_owned = false;
34140         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34143         CVec_u8Z_free(ret_var);
34144         return ret_arr;
34145 }
34146
34147 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34148         LDKUnsignedChannelUpdate this_ptr_conv;
34149         this_ptr_conv.inner = untag_ptr(this_ptr);
34150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34152         this_ptr_conv.is_owned = false;
34153         LDKCVec_u8Z val_ref;
34154         val_ref.datalen = val->arr_len;
34155         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34156         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34157         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34158 }
34159
34160 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) {
34161         LDKThirtyTwoBytes chain_hash_arg_ref;
34162         CHECK(chain_hash_arg->arr_len == 32);
34163         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34164         LDKCVec_u8Z excess_data_arg_ref;
34165         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34166         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34167         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34168         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);
34169         uint64_t ret_ref = 0;
34170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34172         return ret_ref;
34173 }
34174
34175 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34176         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34177         uint64_t ret_ref = 0;
34178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34180         return ret_ref;
34181 }
34182 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34183         LDKUnsignedChannelUpdate arg_conv;
34184         arg_conv.inner = untag_ptr(arg);
34185         arg_conv.is_owned = ptr_is_owned(arg);
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34187         arg_conv.is_owned = false;
34188         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34189         return ret_conv;
34190 }
34191
34192 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34193         LDKUnsignedChannelUpdate orig_conv;
34194         orig_conv.inner = untag_ptr(orig);
34195         orig_conv.is_owned = ptr_is_owned(orig);
34196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34197         orig_conv.is_owned = false;
34198         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34199         uint64_t ret_ref = 0;
34200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34202         return ret_ref;
34203 }
34204
34205 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34206         LDKUnsignedChannelUpdate a_conv;
34207         a_conv.inner = untag_ptr(a);
34208         a_conv.is_owned = ptr_is_owned(a);
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34210         a_conv.is_owned = false;
34211         LDKUnsignedChannelUpdate b_conv;
34212         b_conv.inner = untag_ptr(b);
34213         b_conv.is_owned = ptr_is_owned(b);
34214         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34215         b_conv.is_owned = false;
34216         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34217         return ret_conv;
34218 }
34219
34220 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34221         LDKChannelUpdate this_obj_conv;
34222         this_obj_conv.inner = untag_ptr(this_obj);
34223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34225         ChannelUpdate_free(this_obj_conv);
34226 }
34227
34228 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34229         LDKChannelUpdate this_ptr_conv;
34230         this_ptr_conv.inner = untag_ptr(this_ptr);
34231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34233         this_ptr_conv.is_owned = false;
34234         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34235         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34236         return ret_arr;
34237 }
34238
34239 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34240         LDKChannelUpdate this_ptr_conv;
34241         this_ptr_conv.inner = untag_ptr(this_ptr);
34242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34244         this_ptr_conv.is_owned = false;
34245         LDKSignature val_ref;
34246         CHECK(val->arr_len == 64);
34247         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34248         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34249 }
34250
34251 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34252         LDKChannelUpdate this_ptr_conv;
34253         this_ptr_conv.inner = untag_ptr(this_ptr);
34254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34256         this_ptr_conv.is_owned = false;
34257         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34258         uint64_t ret_ref = 0;
34259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34261         return ret_ref;
34262 }
34263
34264 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
34265         LDKChannelUpdate this_ptr_conv;
34266         this_ptr_conv.inner = untag_ptr(this_ptr);
34267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34269         this_ptr_conv.is_owned = false;
34270         LDKUnsignedChannelUpdate val_conv;
34271         val_conv.inner = untag_ptr(val);
34272         val_conv.is_owned = ptr_is_owned(val);
34273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34274         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34275         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34276 }
34277
34278 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
34279         LDKSignature signature_arg_ref;
34280         CHECK(signature_arg->arr_len == 64);
34281         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34282         LDKUnsignedChannelUpdate contents_arg_conv;
34283         contents_arg_conv.inner = untag_ptr(contents_arg);
34284         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34285         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34286         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34287         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34288         uint64_t ret_ref = 0;
34289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34291         return ret_ref;
34292 }
34293
34294 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34295         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34296         uint64_t ret_ref = 0;
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34299         return ret_ref;
34300 }
34301 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
34302         LDKChannelUpdate arg_conv;
34303         arg_conv.inner = untag_ptr(arg);
34304         arg_conv.is_owned = ptr_is_owned(arg);
34305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34306         arg_conv.is_owned = false;
34307         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34308         return ret_conv;
34309 }
34310
34311 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
34312         LDKChannelUpdate orig_conv;
34313         orig_conv.inner = untag_ptr(orig);
34314         orig_conv.is_owned = ptr_is_owned(orig);
34315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34316         orig_conv.is_owned = false;
34317         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34318         uint64_t ret_ref = 0;
34319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34321         return ret_ref;
34322 }
34323
34324 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
34325         LDKChannelUpdate a_conv;
34326         a_conv.inner = untag_ptr(a);
34327         a_conv.is_owned = ptr_is_owned(a);
34328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34329         a_conv.is_owned = false;
34330         LDKChannelUpdate b_conv;
34331         b_conv.inner = untag_ptr(b);
34332         b_conv.is_owned = ptr_is_owned(b);
34333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34334         b_conv.is_owned = false;
34335         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
34336         return ret_conv;
34337 }
34338
34339 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
34340         LDKQueryChannelRange this_obj_conv;
34341         this_obj_conv.inner = untag_ptr(this_obj);
34342         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34344         QueryChannelRange_free(this_obj_conv);
34345 }
34346
34347 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
34348         LDKQueryChannelRange this_ptr_conv;
34349         this_ptr_conv.inner = untag_ptr(this_ptr);
34350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34352         this_ptr_conv.is_owned = false;
34353         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34354         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
34355         return ret_arr;
34356 }
34357
34358 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34359         LDKQueryChannelRange this_ptr_conv;
34360         this_ptr_conv.inner = untag_ptr(this_ptr);
34361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34363         this_ptr_conv.is_owned = false;
34364         LDKThirtyTwoBytes val_ref;
34365         CHECK(val->arr_len == 32);
34366         memcpy(val_ref.data, val->elems, 32); FREE(val);
34367         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34368 }
34369
34370 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
34371         LDKQueryChannelRange this_ptr_conv;
34372         this_ptr_conv.inner = untag_ptr(this_ptr);
34373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34375         this_ptr_conv.is_owned = false;
34376         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34377         return ret_conv;
34378 }
34379
34380 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
34381         LDKQueryChannelRange this_ptr_conv;
34382         this_ptr_conv.inner = untag_ptr(this_ptr);
34383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34385         this_ptr_conv.is_owned = false;
34386         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34387 }
34388
34389 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
34390         LDKQueryChannelRange this_ptr_conv;
34391         this_ptr_conv.inner = untag_ptr(this_ptr);
34392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34394         this_ptr_conv.is_owned = false;
34395         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34396         return ret_conv;
34397 }
34398
34399 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
34400         LDKQueryChannelRange this_ptr_conv;
34401         this_ptr_conv.inner = untag_ptr(this_ptr);
34402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34404         this_ptr_conv.is_owned = false;
34405         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34406 }
34407
34408 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) {
34409         LDKThirtyTwoBytes chain_hash_arg_ref;
34410         CHECK(chain_hash_arg->arr_len == 32);
34411         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34412         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34413         uint64_t ret_ref = 0;
34414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34416         return ret_ref;
34417 }
34418
34419 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34420         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34421         uint64_t ret_ref = 0;
34422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34424         return ret_ref;
34425 }
34426 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
34427         LDKQueryChannelRange arg_conv;
34428         arg_conv.inner = untag_ptr(arg);
34429         arg_conv.is_owned = ptr_is_owned(arg);
34430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34431         arg_conv.is_owned = false;
34432         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34433         return ret_conv;
34434 }
34435
34436 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
34437         LDKQueryChannelRange orig_conv;
34438         orig_conv.inner = untag_ptr(orig);
34439         orig_conv.is_owned = ptr_is_owned(orig);
34440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34441         orig_conv.is_owned = false;
34442         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34443         uint64_t ret_ref = 0;
34444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34446         return ret_ref;
34447 }
34448
34449 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
34450         LDKQueryChannelRange a_conv;
34451         a_conv.inner = untag_ptr(a);
34452         a_conv.is_owned = ptr_is_owned(a);
34453         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34454         a_conv.is_owned = false;
34455         LDKQueryChannelRange b_conv;
34456         b_conv.inner = untag_ptr(b);
34457         b_conv.is_owned = ptr_is_owned(b);
34458         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34459         b_conv.is_owned = false;
34460         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
34461         return ret_conv;
34462 }
34463
34464 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
34465         LDKReplyChannelRange this_obj_conv;
34466         this_obj_conv.inner = untag_ptr(this_obj);
34467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34469         ReplyChannelRange_free(this_obj_conv);
34470 }
34471
34472 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
34473         LDKReplyChannelRange this_ptr_conv;
34474         this_ptr_conv.inner = untag_ptr(this_ptr);
34475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34477         this_ptr_conv.is_owned = false;
34478         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34479         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
34480         return ret_arr;
34481 }
34482
34483 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34484         LDKReplyChannelRange this_ptr_conv;
34485         this_ptr_conv.inner = untag_ptr(this_ptr);
34486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34488         this_ptr_conv.is_owned = false;
34489         LDKThirtyTwoBytes val_ref;
34490         CHECK(val->arr_len == 32);
34491         memcpy(val_ref.data, val->elems, 32); FREE(val);
34492         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34493 }
34494
34495 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
34496         LDKReplyChannelRange this_ptr_conv;
34497         this_ptr_conv.inner = untag_ptr(this_ptr);
34498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34500         this_ptr_conv.is_owned = false;
34501         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
34502         return ret_conv;
34503 }
34504
34505 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
34506         LDKReplyChannelRange this_ptr_conv;
34507         this_ptr_conv.inner = untag_ptr(this_ptr);
34508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34510         this_ptr_conv.is_owned = false;
34511         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
34512 }
34513
34514 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
34515         LDKReplyChannelRange this_ptr_conv;
34516         this_ptr_conv.inner = untag_ptr(this_ptr);
34517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34519         this_ptr_conv.is_owned = false;
34520         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
34521         return ret_conv;
34522 }
34523
34524 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
34525         LDKReplyChannelRange this_ptr_conv;
34526         this_ptr_conv.inner = untag_ptr(this_ptr);
34527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34529         this_ptr_conv.is_owned = false;
34530         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34531 }
34532
34533 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
34534         LDKReplyChannelRange this_ptr_conv;
34535         this_ptr_conv.inner = untag_ptr(this_ptr);
34536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34538         this_ptr_conv.is_owned = false;
34539         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
34540         return ret_conv;
34541 }
34542
34543 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
34544         LDKReplyChannelRange this_ptr_conv;
34545         this_ptr_conv.inner = untag_ptr(this_ptr);
34546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34548         this_ptr_conv.is_owned = false;
34549         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
34550 }
34551
34552 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
34553         LDKReplyChannelRange this_ptr_conv;
34554         this_ptr_conv.inner = untag_ptr(this_ptr);
34555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34557         this_ptr_conv.is_owned = false;
34558         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
34559         int64_tArray ret_arr = NULL;
34560         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
34561         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
34562         for (size_t i = 0; i < ret_var.datalen; i++) {
34563                 int64_t ret_conv_8_conv = ret_var.data[i];
34564                 ret_arr_ptr[i] = ret_conv_8_conv;
34565         }
34566         
34567         FREE(ret_var.data);
34568         return ret_arr;
34569 }
34570
34571 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
34572         LDKReplyChannelRange this_ptr_conv;
34573         this_ptr_conv.inner = untag_ptr(this_ptr);
34574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34576         this_ptr_conv.is_owned = false;
34577         LDKCVec_u64Z val_constr;
34578         val_constr.datalen = val->arr_len;
34579         if (val_constr.datalen > 0)
34580                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34581         else
34582                 val_constr.data = NULL;
34583         int64_t* val_vals = val->elems;
34584         for (size_t i = 0; i < val_constr.datalen; i++) {
34585                 int64_t val_conv_8 = val_vals[i];
34586                 val_constr.data[i] = val_conv_8;
34587         }
34588         FREE(val);
34589         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
34590 }
34591
34592 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) {
34593         LDKThirtyTwoBytes chain_hash_arg_ref;
34594         CHECK(chain_hash_arg->arr_len == 32);
34595         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34596         LDKCVec_u64Z short_channel_ids_arg_constr;
34597         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
34598         if (short_channel_ids_arg_constr.datalen > 0)
34599                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34600         else
34601                 short_channel_ids_arg_constr.data = NULL;
34602         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
34603         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
34604                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
34605                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
34606         }
34607         FREE(short_channel_ids_arg);
34608         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
34609         uint64_t ret_ref = 0;
34610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34612         return ret_ref;
34613 }
34614
34615 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
34616         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
34617         uint64_t ret_ref = 0;
34618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34620         return ret_ref;
34621 }
34622 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
34623         LDKReplyChannelRange arg_conv;
34624         arg_conv.inner = untag_ptr(arg);
34625         arg_conv.is_owned = ptr_is_owned(arg);
34626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34627         arg_conv.is_owned = false;
34628         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
34629         return ret_conv;
34630 }
34631
34632 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
34633         LDKReplyChannelRange orig_conv;
34634         orig_conv.inner = untag_ptr(orig);
34635         orig_conv.is_owned = ptr_is_owned(orig);
34636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34637         orig_conv.is_owned = false;
34638         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
34639         uint64_t ret_ref = 0;
34640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34642         return ret_ref;
34643 }
34644
34645 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
34646         LDKReplyChannelRange a_conv;
34647         a_conv.inner = untag_ptr(a);
34648         a_conv.is_owned = ptr_is_owned(a);
34649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34650         a_conv.is_owned = false;
34651         LDKReplyChannelRange b_conv;
34652         b_conv.inner = untag_ptr(b);
34653         b_conv.is_owned = ptr_is_owned(b);
34654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34655         b_conv.is_owned = false;
34656         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
34657         return ret_conv;
34658 }
34659
34660 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
34661         LDKQueryShortChannelIds this_obj_conv;
34662         this_obj_conv.inner = untag_ptr(this_obj);
34663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34665         QueryShortChannelIds_free(this_obj_conv);
34666 }
34667
34668 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
34669         LDKQueryShortChannelIds this_ptr_conv;
34670         this_ptr_conv.inner = untag_ptr(this_ptr);
34671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34673         this_ptr_conv.is_owned = false;
34674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34675         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
34676         return ret_arr;
34677 }
34678
34679 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34680         LDKQueryShortChannelIds this_ptr_conv;
34681         this_ptr_conv.inner = untag_ptr(this_ptr);
34682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34684         this_ptr_conv.is_owned = false;
34685         LDKThirtyTwoBytes val_ref;
34686         CHECK(val->arr_len == 32);
34687         memcpy(val_ref.data, val->elems, 32); FREE(val);
34688         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
34689 }
34690
34691 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
34692         LDKQueryShortChannelIds this_ptr_conv;
34693         this_ptr_conv.inner = untag_ptr(this_ptr);
34694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34696         this_ptr_conv.is_owned = false;
34697         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
34698         int64_tArray ret_arr = NULL;
34699         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
34700         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
34701         for (size_t i = 0; i < ret_var.datalen; i++) {
34702                 int64_t ret_conv_8_conv = ret_var.data[i];
34703                 ret_arr_ptr[i] = ret_conv_8_conv;
34704         }
34705         
34706         FREE(ret_var.data);
34707         return ret_arr;
34708 }
34709
34710 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
34711         LDKQueryShortChannelIds this_ptr_conv;
34712         this_ptr_conv.inner = untag_ptr(this_ptr);
34713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34715         this_ptr_conv.is_owned = false;
34716         LDKCVec_u64Z val_constr;
34717         val_constr.datalen = val->arr_len;
34718         if (val_constr.datalen > 0)
34719                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34720         else
34721                 val_constr.data = NULL;
34722         int64_t* val_vals = val->elems;
34723         for (size_t i = 0; i < val_constr.datalen; i++) {
34724                 int64_t val_conv_8 = val_vals[i];
34725                 val_constr.data[i] = val_conv_8;
34726         }
34727         FREE(val);
34728         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
34729 }
34730
34731 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
34732         LDKThirtyTwoBytes chain_hash_arg_ref;
34733         CHECK(chain_hash_arg->arr_len == 32);
34734         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34735         LDKCVec_u64Z short_channel_ids_arg_constr;
34736         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
34737         if (short_channel_ids_arg_constr.datalen > 0)
34738                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34739         else
34740                 short_channel_ids_arg_constr.data = NULL;
34741         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
34742         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
34743                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
34744                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
34745         }
34746         FREE(short_channel_ids_arg);
34747         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
34748         uint64_t ret_ref = 0;
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34751         return ret_ref;
34752 }
34753
34754 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
34755         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
34756         uint64_t ret_ref = 0;
34757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34759         return ret_ref;
34760 }
34761 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
34762         LDKQueryShortChannelIds arg_conv;
34763         arg_conv.inner = untag_ptr(arg);
34764         arg_conv.is_owned = ptr_is_owned(arg);
34765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34766         arg_conv.is_owned = false;
34767         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
34768         return ret_conv;
34769 }
34770
34771 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
34772         LDKQueryShortChannelIds orig_conv;
34773         orig_conv.inner = untag_ptr(orig);
34774         orig_conv.is_owned = ptr_is_owned(orig);
34775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34776         orig_conv.is_owned = false;
34777         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
34778         uint64_t ret_ref = 0;
34779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34781         return ret_ref;
34782 }
34783
34784 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
34785         LDKQueryShortChannelIds a_conv;
34786         a_conv.inner = untag_ptr(a);
34787         a_conv.is_owned = ptr_is_owned(a);
34788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34789         a_conv.is_owned = false;
34790         LDKQueryShortChannelIds b_conv;
34791         b_conv.inner = untag_ptr(b);
34792         b_conv.is_owned = ptr_is_owned(b);
34793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34794         b_conv.is_owned = false;
34795         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
34796         return ret_conv;
34797 }
34798
34799 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
34800         LDKReplyShortChannelIdsEnd this_obj_conv;
34801         this_obj_conv.inner = untag_ptr(this_obj);
34802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34804         ReplyShortChannelIdsEnd_free(this_obj_conv);
34805 }
34806
34807 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
34808         LDKReplyShortChannelIdsEnd this_ptr_conv;
34809         this_ptr_conv.inner = untag_ptr(this_ptr);
34810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34812         this_ptr_conv.is_owned = false;
34813         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34814         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
34815         return ret_arr;
34816 }
34817
34818 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34819         LDKReplyShortChannelIdsEnd this_ptr_conv;
34820         this_ptr_conv.inner = untag_ptr(this_ptr);
34821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34823         this_ptr_conv.is_owned = false;
34824         LDKThirtyTwoBytes val_ref;
34825         CHECK(val->arr_len == 32);
34826         memcpy(val_ref.data, val->elems, 32); FREE(val);
34827         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
34828 }
34829
34830 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
34831         LDKReplyShortChannelIdsEnd this_ptr_conv;
34832         this_ptr_conv.inner = untag_ptr(this_ptr);
34833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34835         this_ptr_conv.is_owned = false;
34836         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
34837         return ret_conv;
34838 }
34839
34840 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
34841         LDKReplyShortChannelIdsEnd this_ptr_conv;
34842         this_ptr_conv.inner = untag_ptr(this_ptr);
34843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34845         this_ptr_conv.is_owned = false;
34846         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
34847 }
34848
34849 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
34850         LDKThirtyTwoBytes chain_hash_arg_ref;
34851         CHECK(chain_hash_arg->arr_len == 32);
34852         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34853         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
34854         uint64_t ret_ref = 0;
34855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34857         return ret_ref;
34858 }
34859
34860 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
34861         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
34862         uint64_t ret_ref = 0;
34863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34865         return ret_ref;
34866 }
34867 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
34868         LDKReplyShortChannelIdsEnd arg_conv;
34869         arg_conv.inner = untag_ptr(arg);
34870         arg_conv.is_owned = ptr_is_owned(arg);
34871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34872         arg_conv.is_owned = false;
34873         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
34874         return ret_conv;
34875 }
34876
34877 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
34878         LDKReplyShortChannelIdsEnd orig_conv;
34879         orig_conv.inner = untag_ptr(orig);
34880         orig_conv.is_owned = ptr_is_owned(orig);
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34882         orig_conv.is_owned = false;
34883         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
34884         uint64_t ret_ref = 0;
34885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34887         return ret_ref;
34888 }
34889
34890 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
34891         LDKReplyShortChannelIdsEnd a_conv;
34892         a_conv.inner = untag_ptr(a);
34893         a_conv.is_owned = ptr_is_owned(a);
34894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34895         a_conv.is_owned = false;
34896         LDKReplyShortChannelIdsEnd b_conv;
34897         b_conv.inner = untag_ptr(b);
34898         b_conv.is_owned = ptr_is_owned(b);
34899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34900         b_conv.is_owned = false;
34901         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
34902         return ret_conv;
34903 }
34904
34905 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
34906         LDKGossipTimestampFilter this_obj_conv;
34907         this_obj_conv.inner = untag_ptr(this_obj);
34908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34910         GossipTimestampFilter_free(this_obj_conv);
34911 }
34912
34913 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
34914         LDKGossipTimestampFilter this_ptr_conv;
34915         this_ptr_conv.inner = untag_ptr(this_ptr);
34916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34918         this_ptr_conv.is_owned = false;
34919         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34920         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
34921         return ret_arr;
34922 }
34923
34924 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34925         LDKGossipTimestampFilter this_ptr_conv;
34926         this_ptr_conv.inner = untag_ptr(this_ptr);
34927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34929         this_ptr_conv.is_owned = false;
34930         LDKThirtyTwoBytes val_ref;
34931         CHECK(val->arr_len == 32);
34932         memcpy(val_ref.data, val->elems, 32); FREE(val);
34933         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34934 }
34935
34936 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
34937         LDKGossipTimestampFilter this_ptr_conv;
34938         this_ptr_conv.inner = untag_ptr(this_ptr);
34939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34941         this_ptr_conv.is_owned = false;
34942         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34943         return ret_conv;
34944 }
34945
34946 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
34947         LDKGossipTimestampFilter this_ptr_conv;
34948         this_ptr_conv.inner = untag_ptr(this_ptr);
34949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34951         this_ptr_conv.is_owned = false;
34952         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34953 }
34954
34955 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
34956         LDKGossipTimestampFilter this_ptr_conv;
34957         this_ptr_conv.inner = untag_ptr(this_ptr);
34958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34960         this_ptr_conv.is_owned = false;
34961         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34962         return ret_conv;
34963 }
34964
34965 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
34966         LDKGossipTimestampFilter this_ptr_conv;
34967         this_ptr_conv.inner = untag_ptr(this_ptr);
34968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34970         this_ptr_conv.is_owned = false;
34971         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34972 }
34973
34974 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) {
34975         LDKThirtyTwoBytes chain_hash_arg_ref;
34976         CHECK(chain_hash_arg->arr_len == 32);
34977         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34978         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34979         uint64_t ret_ref = 0;
34980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34982         return ret_ref;
34983 }
34984
34985 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34986         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34987         uint64_t ret_ref = 0;
34988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34990         return ret_ref;
34991 }
34992 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
34993         LDKGossipTimestampFilter arg_conv;
34994         arg_conv.inner = untag_ptr(arg);
34995         arg_conv.is_owned = ptr_is_owned(arg);
34996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34997         arg_conv.is_owned = false;
34998         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
34999         return ret_conv;
35000 }
35001
35002 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35003         LDKGossipTimestampFilter orig_conv;
35004         orig_conv.inner = untag_ptr(orig);
35005         orig_conv.is_owned = ptr_is_owned(orig);
35006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35007         orig_conv.is_owned = false;
35008         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35009         uint64_t ret_ref = 0;
35010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35012         return ret_ref;
35013 }
35014
35015 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35016         LDKGossipTimestampFilter a_conv;
35017         a_conv.inner = untag_ptr(a);
35018         a_conv.is_owned = ptr_is_owned(a);
35019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35020         a_conv.is_owned = false;
35021         LDKGossipTimestampFilter b_conv;
35022         b_conv.inner = untag_ptr(b);
35023         b_conv.is_owned = ptr_is_owned(b);
35024         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35025         b_conv.is_owned = false;
35026         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35027         return ret_conv;
35028 }
35029
35030 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35031         if (!ptr_is_owned(this_ptr)) return;
35032         void* this_ptr_ptr = untag_ptr(this_ptr);
35033         CHECK_ACCESS(this_ptr_ptr);
35034         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35035         FREE(untag_ptr(this_ptr));
35036         ErrorAction_free(this_ptr_conv);
35037 }
35038
35039 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35040         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35041         *ret_copy = ErrorAction_clone(arg);
35042         uint64_t ret_ref = tag_ptr(ret_copy, true);
35043         return ret_ref;
35044 }
35045 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35046         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35047         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35048         return ret_conv;
35049 }
35050
35051 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35052         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35053         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35054         *ret_copy = ErrorAction_clone(orig_conv);
35055         uint64_t ret_ref = tag_ptr(ret_copy, true);
35056         return ret_ref;
35057 }
35058
35059 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35060         LDKErrorMessage msg_conv;
35061         msg_conv.inner = untag_ptr(msg);
35062         msg_conv.is_owned = ptr_is_owned(msg);
35063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35064         msg_conv = ErrorMessage_clone(&msg_conv);
35065         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35066         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35067         uint64_t ret_ref = tag_ptr(ret_copy, true);
35068         return ret_ref;
35069 }
35070
35071 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35072         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35073         *ret_copy = ErrorAction_ignore_error();
35074         uint64_t ret_ref = tag_ptr(ret_copy, true);
35075         return ret_ref;
35076 }
35077
35078 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35079         LDKLevel a_conv = LDKLevel_from_js(a);
35080         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35081         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35082         uint64_t ret_ref = tag_ptr(ret_copy, true);
35083         return ret_ref;
35084 }
35085
35086 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35087         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35088         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35089         uint64_t ret_ref = tag_ptr(ret_copy, true);
35090         return ret_ref;
35091 }
35092
35093 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35094         LDKErrorMessage msg_conv;
35095         msg_conv.inner = untag_ptr(msg);
35096         msg_conv.is_owned = ptr_is_owned(msg);
35097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35098         msg_conv = ErrorMessage_clone(&msg_conv);
35099         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35100         *ret_copy = ErrorAction_send_error_message(msg_conv);
35101         uint64_t ret_ref = tag_ptr(ret_copy, true);
35102         return ret_ref;
35103 }
35104
35105 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35106         LDKWarningMessage msg_conv;
35107         msg_conv.inner = untag_ptr(msg);
35108         msg_conv.is_owned = ptr_is_owned(msg);
35109         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35110         msg_conv = WarningMessage_clone(&msg_conv);
35111         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35112         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35113         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35114         uint64_t ret_ref = tag_ptr(ret_copy, true);
35115         return ret_ref;
35116 }
35117
35118 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35119         LDKLightningError this_obj_conv;
35120         this_obj_conv.inner = untag_ptr(this_obj);
35121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35123         LightningError_free(this_obj_conv);
35124 }
35125
35126 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35127         LDKLightningError this_ptr_conv;
35128         this_ptr_conv.inner = untag_ptr(this_ptr);
35129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35131         this_ptr_conv.is_owned = false;
35132         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35133         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35134         Str_free(ret_str);
35135         return ret_conv;
35136 }
35137
35138 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35139         LDKLightningError this_ptr_conv;
35140         this_ptr_conv.inner = untag_ptr(this_ptr);
35141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35143         this_ptr_conv.is_owned = false;
35144         LDKStr val_conv = str_ref_to_owned_c(val);
35145         LightningError_set_err(&this_ptr_conv, val_conv);
35146 }
35147
35148 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35149         LDKLightningError this_ptr_conv;
35150         this_ptr_conv.inner = untag_ptr(this_ptr);
35151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35153         this_ptr_conv.is_owned = false;
35154         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35155         *ret_copy = LightningError_get_action(&this_ptr_conv);
35156         uint64_t ret_ref = tag_ptr(ret_copy, true);
35157         return ret_ref;
35158 }
35159
35160 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35161         LDKLightningError this_ptr_conv;
35162         this_ptr_conv.inner = untag_ptr(this_ptr);
35163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35165         this_ptr_conv.is_owned = false;
35166         void* val_ptr = untag_ptr(val);
35167         CHECK_ACCESS(val_ptr);
35168         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35169         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35170         LightningError_set_action(&this_ptr_conv, val_conv);
35171 }
35172
35173 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35174         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35175         void* action_arg_ptr = untag_ptr(action_arg);
35176         CHECK_ACCESS(action_arg_ptr);
35177         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35178         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35179         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35180         uint64_t ret_ref = 0;
35181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35183         return ret_ref;
35184 }
35185
35186 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35187         LDKLightningError ret_var = LightningError_clone(arg);
35188         uint64_t ret_ref = 0;
35189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35191         return ret_ref;
35192 }
35193 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35194         LDKLightningError arg_conv;
35195         arg_conv.inner = untag_ptr(arg);
35196         arg_conv.is_owned = ptr_is_owned(arg);
35197         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35198         arg_conv.is_owned = false;
35199         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35200         return ret_conv;
35201 }
35202
35203 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35204         LDKLightningError orig_conv;
35205         orig_conv.inner = untag_ptr(orig);
35206         orig_conv.is_owned = ptr_is_owned(orig);
35207         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35208         orig_conv.is_owned = false;
35209         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35210         uint64_t ret_ref = 0;
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35213         return ret_ref;
35214 }
35215
35216 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35217         LDKCommitmentUpdate this_obj_conv;
35218         this_obj_conv.inner = untag_ptr(this_obj);
35219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35221         CommitmentUpdate_free(this_obj_conv);
35222 }
35223
35224 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35225         LDKCommitmentUpdate this_ptr_conv;
35226         this_ptr_conv.inner = untag_ptr(this_ptr);
35227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35229         this_ptr_conv.is_owned = false;
35230         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35231         uint64_tArray ret_arr = NULL;
35232         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35233         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35234         for (size_t p = 0; p < ret_var.datalen; p++) {
35235                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35236                 uint64_t ret_conv_15_ref = 0;
35237                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35238                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35239                 ret_arr_ptr[p] = ret_conv_15_ref;
35240         }
35241         
35242         FREE(ret_var.data);
35243         return ret_arr;
35244 }
35245
35246 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35247         LDKCommitmentUpdate this_ptr_conv;
35248         this_ptr_conv.inner = untag_ptr(this_ptr);
35249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35251         this_ptr_conv.is_owned = false;
35252         LDKCVec_UpdateAddHTLCZ val_constr;
35253         val_constr.datalen = val->arr_len;
35254         if (val_constr.datalen > 0)
35255                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35256         else
35257                 val_constr.data = NULL;
35258         uint64_t* val_vals = val->elems;
35259         for (size_t p = 0; p < val_constr.datalen; p++) {
35260                 uint64_t val_conv_15 = val_vals[p];
35261                 LDKUpdateAddHTLC val_conv_15_conv;
35262                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35263                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35264                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35265                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35266                 val_constr.data[p] = val_conv_15_conv;
35267         }
35268         FREE(val);
35269         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35270 }
35271
35272 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
35273         LDKCommitmentUpdate this_ptr_conv;
35274         this_ptr_conv.inner = untag_ptr(this_ptr);
35275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35277         this_ptr_conv.is_owned = false;
35278         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35279         uint64_tArray ret_arr = NULL;
35280         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35281         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35282         for (size_t t = 0; t < ret_var.datalen; t++) {
35283                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35284                 uint64_t ret_conv_19_ref = 0;
35285                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35286                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
35287                 ret_arr_ptr[t] = ret_conv_19_ref;
35288         }
35289         
35290         FREE(ret_var.data);
35291         return ret_arr;
35292 }
35293
35294 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
35295         LDKCommitmentUpdate this_ptr_conv;
35296         this_ptr_conv.inner = untag_ptr(this_ptr);
35297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35299         this_ptr_conv.is_owned = false;
35300         LDKCVec_UpdateFulfillHTLCZ val_constr;
35301         val_constr.datalen = val->arr_len;
35302         if (val_constr.datalen > 0)
35303                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35304         else
35305                 val_constr.data = NULL;
35306         uint64_t* val_vals = val->elems;
35307         for (size_t t = 0; t < val_constr.datalen; t++) {
35308                 uint64_t val_conv_19 = val_vals[t];
35309                 LDKUpdateFulfillHTLC val_conv_19_conv;
35310                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
35311                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
35312                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35313                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35314                 val_constr.data[t] = val_conv_19_conv;
35315         }
35316         FREE(val);
35317         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35318 }
35319
35320 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
35321         LDKCommitmentUpdate this_ptr_conv;
35322         this_ptr_conv.inner = untag_ptr(this_ptr);
35323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35325         this_ptr_conv.is_owned = false;
35326         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35327         uint64_tArray ret_arr = NULL;
35328         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35329         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35330         for (size_t q = 0; q < ret_var.datalen; q++) {
35331                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35332                 uint64_t ret_conv_16_ref = 0;
35333                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35334                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35335                 ret_arr_ptr[q] = ret_conv_16_ref;
35336         }
35337         
35338         FREE(ret_var.data);
35339         return ret_arr;
35340 }
35341
35342 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
35343         LDKCommitmentUpdate this_ptr_conv;
35344         this_ptr_conv.inner = untag_ptr(this_ptr);
35345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35347         this_ptr_conv.is_owned = false;
35348         LDKCVec_UpdateFailHTLCZ val_constr;
35349         val_constr.datalen = val->arr_len;
35350         if (val_constr.datalen > 0)
35351                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35352         else
35353                 val_constr.data = NULL;
35354         uint64_t* val_vals = val->elems;
35355         for (size_t q = 0; q < val_constr.datalen; q++) {
35356                 uint64_t val_conv_16 = val_vals[q];
35357                 LDKUpdateFailHTLC val_conv_16_conv;
35358                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35359                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35360                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35361                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35362                 val_constr.data[q] = val_conv_16_conv;
35363         }
35364         FREE(val);
35365         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35366 }
35367
35368 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
35369         LDKCommitmentUpdate this_ptr_conv;
35370         this_ptr_conv.inner = untag_ptr(this_ptr);
35371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35373         this_ptr_conv.is_owned = false;
35374         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35375         uint64_tArray ret_arr = NULL;
35376         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35377         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35378         for (size_t z = 0; z < ret_var.datalen; z++) {
35379                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35380                 uint64_t ret_conv_25_ref = 0;
35381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35382                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
35383                 ret_arr_ptr[z] = ret_conv_25_ref;
35384         }
35385         
35386         FREE(ret_var.data);
35387         return ret_arr;
35388 }
35389
35390 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) {
35391         LDKCommitmentUpdate this_ptr_conv;
35392         this_ptr_conv.inner = untag_ptr(this_ptr);
35393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35395         this_ptr_conv.is_owned = false;
35396         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35397         val_constr.datalen = val->arr_len;
35398         if (val_constr.datalen > 0)
35399                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35400         else
35401                 val_constr.data = NULL;
35402         uint64_t* val_vals = val->elems;
35403         for (size_t z = 0; z < val_constr.datalen; z++) {
35404                 uint64_t val_conv_25 = val_vals[z];
35405                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35406                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
35407                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
35408                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35409                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35410                 val_constr.data[z] = val_conv_25_conv;
35411         }
35412         FREE(val);
35413         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35414 }
35415
35416 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
35417         LDKCommitmentUpdate this_ptr_conv;
35418         this_ptr_conv.inner = untag_ptr(this_ptr);
35419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35421         this_ptr_conv.is_owned = false;
35422         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35423         uint64_t ret_ref = 0;
35424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35426         return ret_ref;
35427 }
35428
35429 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
35430         LDKCommitmentUpdate this_ptr_conv;
35431         this_ptr_conv.inner = untag_ptr(this_ptr);
35432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35434         this_ptr_conv.is_owned = false;
35435         LDKUpdateFee val_conv;
35436         val_conv.inner = untag_ptr(val);
35437         val_conv.is_owned = ptr_is_owned(val);
35438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35439         val_conv = UpdateFee_clone(&val_conv);
35440         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35441 }
35442
35443 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
35444         LDKCommitmentUpdate this_ptr_conv;
35445         this_ptr_conv.inner = untag_ptr(this_ptr);
35446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35448         this_ptr_conv.is_owned = false;
35449         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35450         uint64_t ret_ref = 0;
35451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35453         return ret_ref;
35454 }
35455
35456 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
35457         LDKCommitmentUpdate this_ptr_conv;
35458         this_ptr_conv.inner = untag_ptr(this_ptr);
35459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35461         this_ptr_conv.is_owned = false;
35462         LDKCommitmentSigned val_conv;
35463         val_conv.inner = untag_ptr(val);
35464         val_conv.is_owned = ptr_is_owned(val);
35465         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35466         val_conv = CommitmentSigned_clone(&val_conv);
35467         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35468 }
35469
35470 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) {
35471         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35472         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
35473         if (update_add_htlcs_arg_constr.datalen > 0)
35474                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35475         else
35476                 update_add_htlcs_arg_constr.data = NULL;
35477         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
35478         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35479                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35480                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35481                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
35482                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
35483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35484                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35485                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35486         }
35487         FREE(update_add_htlcs_arg);
35488         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35489         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
35490         if (update_fulfill_htlcs_arg_constr.datalen > 0)
35491                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35492         else
35493                 update_fulfill_htlcs_arg_constr.data = NULL;
35494         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
35495         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35496                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35497                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35498                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
35499                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
35500                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35501                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35502                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35503         }
35504         FREE(update_fulfill_htlcs_arg);
35505         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35506         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
35507         if (update_fail_htlcs_arg_constr.datalen > 0)
35508                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35509         else
35510                 update_fail_htlcs_arg_constr.data = NULL;
35511         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
35512         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35513                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35514                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35515                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
35516                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
35517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35518                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35519                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35520         }
35521         FREE(update_fail_htlcs_arg);
35522         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35523         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
35524         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35525                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35526         else
35527                 update_fail_malformed_htlcs_arg_constr.data = NULL;
35528         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
35529         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35530                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35531                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35532                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
35533                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
35534                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35535                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35536                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35537         }
35538         FREE(update_fail_malformed_htlcs_arg);
35539         LDKUpdateFee update_fee_arg_conv;
35540         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
35541         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
35542         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35543         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35544         LDKCommitmentSigned commitment_signed_arg_conv;
35545         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
35546         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
35547         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35548         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35549         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);
35550         uint64_t ret_ref = 0;
35551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35553         return ret_ref;
35554 }
35555
35556 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
35557         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
35558         uint64_t ret_ref = 0;
35559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35561         return ret_ref;
35562 }
35563 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
35564         LDKCommitmentUpdate arg_conv;
35565         arg_conv.inner = untag_ptr(arg);
35566         arg_conv.is_owned = ptr_is_owned(arg);
35567         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35568         arg_conv.is_owned = false;
35569         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
35570         return ret_conv;
35571 }
35572
35573 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
35574         LDKCommitmentUpdate orig_conv;
35575         orig_conv.inner = untag_ptr(orig);
35576         orig_conv.is_owned = ptr_is_owned(orig);
35577         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35578         orig_conv.is_owned = false;
35579         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
35580         uint64_t ret_ref = 0;
35581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35583         return ret_ref;
35584 }
35585
35586 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
35587         LDKCommitmentUpdate a_conv;
35588         a_conv.inner = untag_ptr(a);
35589         a_conv.is_owned = ptr_is_owned(a);
35590         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35591         a_conv.is_owned = false;
35592         LDKCommitmentUpdate b_conv;
35593         b_conv.inner = untag_ptr(b);
35594         b_conv.is_owned = ptr_is_owned(b);
35595         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35596         b_conv.is_owned = false;
35597         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
35598         return ret_conv;
35599 }
35600
35601 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
35602         if (!ptr_is_owned(this_ptr)) return;
35603         void* this_ptr_ptr = untag_ptr(this_ptr);
35604         CHECK_ACCESS(this_ptr_ptr);
35605         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
35606         FREE(untag_ptr(this_ptr));
35607         ChannelMessageHandler_free(this_ptr_conv);
35608 }
35609
35610 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
35611         if (!ptr_is_owned(this_ptr)) return;
35612         void* this_ptr_ptr = untag_ptr(this_ptr);
35613         CHECK_ACCESS(this_ptr_ptr);
35614         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
35615         FREE(untag_ptr(this_ptr));
35616         RoutingMessageHandler_free(this_ptr_conv);
35617 }
35618
35619 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
35620         if (!ptr_is_owned(this_ptr)) return;
35621         void* this_ptr_ptr = untag_ptr(this_ptr);
35622         CHECK_ACCESS(this_ptr_ptr);
35623         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
35624         FREE(untag_ptr(this_ptr));
35625         OnionMessageHandler_free(this_ptr_conv);
35626 }
35627
35628 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
35629         LDKAcceptChannel obj_conv;
35630         obj_conv.inner = untag_ptr(obj);
35631         obj_conv.is_owned = ptr_is_owned(obj);
35632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35633         obj_conv.is_owned = false;
35634         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
35635         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35636         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35637         CVec_u8Z_free(ret_var);
35638         return ret_arr;
35639 }
35640
35641 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
35642         LDKu8slice ser_ref;
35643         ser_ref.datalen = ser->arr_len;
35644         ser_ref.data = ser->elems;
35645         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
35646         *ret_conv = AcceptChannel_read(ser_ref);
35647         FREE(ser);
35648         return tag_ptr(ret_conv, true);
35649 }
35650
35651 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
35652         LDKAnnouncementSignatures obj_conv;
35653         obj_conv.inner = untag_ptr(obj);
35654         obj_conv.is_owned = ptr_is_owned(obj);
35655         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35656         obj_conv.is_owned = false;
35657         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
35658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35660         CVec_u8Z_free(ret_var);
35661         return ret_arr;
35662 }
35663
35664 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
35665         LDKu8slice ser_ref;
35666         ser_ref.datalen = ser->arr_len;
35667         ser_ref.data = ser->elems;
35668         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
35669         *ret_conv = AnnouncementSignatures_read(ser_ref);
35670         FREE(ser);
35671         return tag_ptr(ret_conv, true);
35672 }
35673
35674 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
35675         LDKChannelReestablish obj_conv;
35676         obj_conv.inner = untag_ptr(obj);
35677         obj_conv.is_owned = ptr_is_owned(obj);
35678         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35679         obj_conv.is_owned = false;
35680         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
35681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35683         CVec_u8Z_free(ret_var);
35684         return ret_arr;
35685 }
35686
35687 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
35688         LDKu8slice ser_ref;
35689         ser_ref.datalen = ser->arr_len;
35690         ser_ref.data = ser->elems;
35691         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
35692         *ret_conv = ChannelReestablish_read(ser_ref);
35693         FREE(ser);
35694         return tag_ptr(ret_conv, true);
35695 }
35696
35697 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
35698         LDKClosingSigned obj_conv;
35699         obj_conv.inner = untag_ptr(obj);
35700         obj_conv.is_owned = ptr_is_owned(obj);
35701         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35702         obj_conv.is_owned = false;
35703         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
35704         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35705         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35706         CVec_u8Z_free(ret_var);
35707         return ret_arr;
35708 }
35709
35710 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
35711         LDKu8slice ser_ref;
35712         ser_ref.datalen = ser->arr_len;
35713         ser_ref.data = ser->elems;
35714         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
35715         *ret_conv = ClosingSigned_read(ser_ref);
35716         FREE(ser);
35717         return tag_ptr(ret_conv, true);
35718 }
35719
35720 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
35721         LDKClosingSignedFeeRange obj_conv;
35722         obj_conv.inner = untag_ptr(obj);
35723         obj_conv.is_owned = ptr_is_owned(obj);
35724         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35725         obj_conv.is_owned = false;
35726         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
35727         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35728         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35729         CVec_u8Z_free(ret_var);
35730         return ret_arr;
35731 }
35732
35733 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
35734         LDKu8slice ser_ref;
35735         ser_ref.datalen = ser->arr_len;
35736         ser_ref.data = ser->elems;
35737         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
35738         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
35739         FREE(ser);
35740         return tag_ptr(ret_conv, true);
35741 }
35742
35743 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
35744         LDKCommitmentSigned obj_conv;
35745         obj_conv.inner = untag_ptr(obj);
35746         obj_conv.is_owned = ptr_is_owned(obj);
35747         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35748         obj_conv.is_owned = false;
35749         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
35750         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35751         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35752         CVec_u8Z_free(ret_var);
35753         return ret_arr;
35754 }
35755
35756 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
35757         LDKu8slice ser_ref;
35758         ser_ref.datalen = ser->arr_len;
35759         ser_ref.data = ser->elems;
35760         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
35761         *ret_conv = CommitmentSigned_read(ser_ref);
35762         FREE(ser);
35763         return tag_ptr(ret_conv, true);
35764 }
35765
35766 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
35767         LDKFundingCreated obj_conv;
35768         obj_conv.inner = untag_ptr(obj);
35769         obj_conv.is_owned = ptr_is_owned(obj);
35770         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35771         obj_conv.is_owned = false;
35772         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
35773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35775         CVec_u8Z_free(ret_var);
35776         return ret_arr;
35777 }
35778
35779 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
35780         LDKu8slice ser_ref;
35781         ser_ref.datalen = ser->arr_len;
35782         ser_ref.data = ser->elems;
35783         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
35784         *ret_conv = FundingCreated_read(ser_ref);
35785         FREE(ser);
35786         return tag_ptr(ret_conv, true);
35787 }
35788
35789 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
35790         LDKFundingSigned obj_conv;
35791         obj_conv.inner = untag_ptr(obj);
35792         obj_conv.is_owned = ptr_is_owned(obj);
35793         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35794         obj_conv.is_owned = false;
35795         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
35796         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35797         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35798         CVec_u8Z_free(ret_var);
35799         return ret_arr;
35800 }
35801
35802 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
35803         LDKu8slice ser_ref;
35804         ser_ref.datalen = ser->arr_len;
35805         ser_ref.data = ser->elems;
35806         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
35807         *ret_conv = FundingSigned_read(ser_ref);
35808         FREE(ser);
35809         return tag_ptr(ret_conv, true);
35810 }
35811
35812 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
35813         LDKChannelReady obj_conv;
35814         obj_conv.inner = untag_ptr(obj);
35815         obj_conv.is_owned = ptr_is_owned(obj);
35816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35817         obj_conv.is_owned = false;
35818         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
35819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35821         CVec_u8Z_free(ret_var);
35822         return ret_arr;
35823 }
35824
35825 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
35826         LDKu8slice ser_ref;
35827         ser_ref.datalen = ser->arr_len;
35828         ser_ref.data = ser->elems;
35829         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
35830         *ret_conv = ChannelReady_read(ser_ref);
35831         FREE(ser);
35832         return tag_ptr(ret_conv, true);
35833 }
35834
35835 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
35836         LDKInit obj_conv;
35837         obj_conv.inner = untag_ptr(obj);
35838         obj_conv.is_owned = ptr_is_owned(obj);
35839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35840         obj_conv.is_owned = false;
35841         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
35842         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35843         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35844         CVec_u8Z_free(ret_var);
35845         return ret_arr;
35846 }
35847
35848 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
35849         LDKu8slice ser_ref;
35850         ser_ref.datalen = ser->arr_len;
35851         ser_ref.data = ser->elems;
35852         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
35853         *ret_conv = Init_read(ser_ref);
35854         FREE(ser);
35855         return tag_ptr(ret_conv, true);
35856 }
35857
35858 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
35859         LDKOpenChannel obj_conv;
35860         obj_conv.inner = untag_ptr(obj);
35861         obj_conv.is_owned = ptr_is_owned(obj);
35862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35863         obj_conv.is_owned = false;
35864         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
35865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35867         CVec_u8Z_free(ret_var);
35868         return ret_arr;
35869 }
35870
35871 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
35872         LDKu8slice ser_ref;
35873         ser_ref.datalen = ser->arr_len;
35874         ser_ref.data = ser->elems;
35875         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
35876         *ret_conv = OpenChannel_read(ser_ref);
35877         FREE(ser);
35878         return tag_ptr(ret_conv, true);
35879 }
35880
35881 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
35882         LDKRevokeAndACK obj_conv;
35883         obj_conv.inner = untag_ptr(obj);
35884         obj_conv.is_owned = ptr_is_owned(obj);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35886         obj_conv.is_owned = false;
35887         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
35888         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35889         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35890         CVec_u8Z_free(ret_var);
35891         return ret_arr;
35892 }
35893
35894 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
35895         LDKu8slice ser_ref;
35896         ser_ref.datalen = ser->arr_len;
35897         ser_ref.data = ser->elems;
35898         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35899         *ret_conv = RevokeAndACK_read(ser_ref);
35900         FREE(ser);
35901         return tag_ptr(ret_conv, true);
35902 }
35903
35904 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
35905         LDKShutdown obj_conv;
35906         obj_conv.inner = untag_ptr(obj);
35907         obj_conv.is_owned = ptr_is_owned(obj);
35908         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35909         obj_conv.is_owned = false;
35910         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
35911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35913         CVec_u8Z_free(ret_var);
35914         return ret_arr;
35915 }
35916
35917 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
35918         LDKu8slice ser_ref;
35919         ser_ref.datalen = ser->arr_len;
35920         ser_ref.data = ser->elems;
35921         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35922         *ret_conv = Shutdown_read(ser_ref);
35923         FREE(ser);
35924         return tag_ptr(ret_conv, true);
35925 }
35926
35927 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
35928         LDKUpdateFailHTLC obj_conv;
35929         obj_conv.inner = untag_ptr(obj);
35930         obj_conv.is_owned = ptr_is_owned(obj);
35931         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35932         obj_conv.is_owned = false;
35933         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35936         CVec_u8Z_free(ret_var);
35937         return ret_arr;
35938 }
35939
35940 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
35941         LDKu8slice ser_ref;
35942         ser_ref.datalen = ser->arr_len;
35943         ser_ref.data = ser->elems;
35944         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35945         *ret_conv = UpdateFailHTLC_read(ser_ref);
35946         FREE(ser);
35947         return tag_ptr(ret_conv, true);
35948 }
35949
35950 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
35951         LDKUpdateFailMalformedHTLC obj_conv;
35952         obj_conv.inner = untag_ptr(obj);
35953         obj_conv.is_owned = ptr_is_owned(obj);
35954         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35955         obj_conv.is_owned = false;
35956         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35957         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35958         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35959         CVec_u8Z_free(ret_var);
35960         return ret_arr;
35961 }
35962
35963 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
35964         LDKu8slice ser_ref;
35965         ser_ref.datalen = ser->arr_len;
35966         ser_ref.data = ser->elems;
35967         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35968         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35969         FREE(ser);
35970         return tag_ptr(ret_conv, true);
35971 }
35972
35973 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
35974         LDKUpdateFee obj_conv;
35975         obj_conv.inner = untag_ptr(obj);
35976         obj_conv.is_owned = ptr_is_owned(obj);
35977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35978         obj_conv.is_owned = false;
35979         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35980         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35981         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35982         CVec_u8Z_free(ret_var);
35983         return ret_arr;
35984 }
35985
35986 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
35987         LDKu8slice ser_ref;
35988         ser_ref.datalen = ser->arr_len;
35989         ser_ref.data = ser->elems;
35990         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35991         *ret_conv = UpdateFee_read(ser_ref);
35992         FREE(ser);
35993         return tag_ptr(ret_conv, true);
35994 }
35995
35996 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
35997         LDKUpdateFulfillHTLC obj_conv;
35998         obj_conv.inner = untag_ptr(obj);
35999         obj_conv.is_owned = ptr_is_owned(obj);
36000         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36001         obj_conv.is_owned = false;
36002         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36003         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36004         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36005         CVec_u8Z_free(ret_var);
36006         return ret_arr;
36007 }
36008
36009 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36010         LDKu8slice ser_ref;
36011         ser_ref.datalen = ser->arr_len;
36012         ser_ref.data = ser->elems;
36013         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36014         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36015         FREE(ser);
36016         return tag_ptr(ret_conv, true);
36017 }
36018
36019 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36020         LDKUpdateAddHTLC obj_conv;
36021         obj_conv.inner = untag_ptr(obj);
36022         obj_conv.is_owned = ptr_is_owned(obj);
36023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36024         obj_conv.is_owned = false;
36025         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36026         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36027         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36028         CVec_u8Z_free(ret_var);
36029         return ret_arr;
36030 }
36031
36032 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36033         LDKu8slice ser_ref;
36034         ser_ref.datalen = ser->arr_len;
36035         ser_ref.data = ser->elems;
36036         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36037         *ret_conv = UpdateAddHTLC_read(ser_ref);
36038         FREE(ser);
36039         return tag_ptr(ret_conv, true);
36040 }
36041
36042 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36043         LDKu8slice ser_ref;
36044         ser_ref.datalen = ser->arr_len;
36045         ser_ref.data = ser->elems;
36046         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36047         *ret_conv = OnionMessage_read(ser_ref);
36048         FREE(ser);
36049         return tag_ptr(ret_conv, true);
36050 }
36051
36052 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36053         LDKOnionMessage obj_conv;
36054         obj_conv.inner = untag_ptr(obj);
36055         obj_conv.is_owned = ptr_is_owned(obj);
36056         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36057         obj_conv.is_owned = false;
36058         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36059         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36060         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36061         CVec_u8Z_free(ret_var);
36062         return ret_arr;
36063 }
36064
36065 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36066         LDKPing obj_conv;
36067         obj_conv.inner = untag_ptr(obj);
36068         obj_conv.is_owned = ptr_is_owned(obj);
36069         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36070         obj_conv.is_owned = false;
36071         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36072         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36073         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36074         CVec_u8Z_free(ret_var);
36075         return ret_arr;
36076 }
36077
36078 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36079         LDKu8slice ser_ref;
36080         ser_ref.datalen = ser->arr_len;
36081         ser_ref.data = ser->elems;
36082         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36083         *ret_conv = Ping_read(ser_ref);
36084         FREE(ser);
36085         return tag_ptr(ret_conv, true);
36086 }
36087
36088 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36089         LDKPong obj_conv;
36090         obj_conv.inner = untag_ptr(obj);
36091         obj_conv.is_owned = ptr_is_owned(obj);
36092         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36093         obj_conv.is_owned = false;
36094         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36097         CVec_u8Z_free(ret_var);
36098         return ret_arr;
36099 }
36100
36101 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36102         LDKu8slice ser_ref;
36103         ser_ref.datalen = ser->arr_len;
36104         ser_ref.data = ser->elems;
36105         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36106         *ret_conv = Pong_read(ser_ref);
36107         FREE(ser);
36108         return tag_ptr(ret_conv, true);
36109 }
36110
36111 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36112         LDKUnsignedChannelAnnouncement obj_conv;
36113         obj_conv.inner = untag_ptr(obj);
36114         obj_conv.is_owned = ptr_is_owned(obj);
36115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36116         obj_conv.is_owned = false;
36117         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36118         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36119         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36120         CVec_u8Z_free(ret_var);
36121         return ret_arr;
36122 }
36123
36124 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36125         LDKu8slice ser_ref;
36126         ser_ref.datalen = ser->arr_len;
36127         ser_ref.data = ser->elems;
36128         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36129         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36130         FREE(ser);
36131         return tag_ptr(ret_conv, true);
36132 }
36133
36134 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36135         LDKChannelAnnouncement obj_conv;
36136         obj_conv.inner = untag_ptr(obj);
36137         obj_conv.is_owned = ptr_is_owned(obj);
36138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36139         obj_conv.is_owned = false;
36140         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36143         CVec_u8Z_free(ret_var);
36144         return ret_arr;
36145 }
36146
36147 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36148         LDKu8slice ser_ref;
36149         ser_ref.datalen = ser->arr_len;
36150         ser_ref.data = ser->elems;
36151         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36152         *ret_conv = ChannelAnnouncement_read(ser_ref);
36153         FREE(ser);
36154         return tag_ptr(ret_conv, true);
36155 }
36156
36157 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36158         LDKUnsignedChannelUpdate obj_conv;
36159         obj_conv.inner = untag_ptr(obj);
36160         obj_conv.is_owned = ptr_is_owned(obj);
36161         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36162         obj_conv.is_owned = false;
36163         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36164         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36165         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36166         CVec_u8Z_free(ret_var);
36167         return ret_arr;
36168 }
36169
36170 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36171         LDKu8slice ser_ref;
36172         ser_ref.datalen = ser->arr_len;
36173         ser_ref.data = ser->elems;
36174         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36175         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36176         FREE(ser);
36177         return tag_ptr(ret_conv, true);
36178 }
36179
36180 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36181         LDKChannelUpdate obj_conv;
36182         obj_conv.inner = untag_ptr(obj);
36183         obj_conv.is_owned = ptr_is_owned(obj);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36185         obj_conv.is_owned = false;
36186         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36189         CVec_u8Z_free(ret_var);
36190         return ret_arr;
36191 }
36192
36193 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36194         LDKu8slice ser_ref;
36195         ser_ref.datalen = ser->arr_len;
36196         ser_ref.data = ser->elems;
36197         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36198         *ret_conv = ChannelUpdate_read(ser_ref);
36199         FREE(ser);
36200         return tag_ptr(ret_conv, true);
36201 }
36202
36203 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36204         LDKErrorMessage obj_conv;
36205         obj_conv.inner = untag_ptr(obj);
36206         obj_conv.is_owned = ptr_is_owned(obj);
36207         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36208         obj_conv.is_owned = false;
36209         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36210         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36211         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36212         CVec_u8Z_free(ret_var);
36213         return ret_arr;
36214 }
36215
36216 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36217         LDKu8slice ser_ref;
36218         ser_ref.datalen = ser->arr_len;
36219         ser_ref.data = ser->elems;
36220         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36221         *ret_conv = ErrorMessage_read(ser_ref);
36222         FREE(ser);
36223         return tag_ptr(ret_conv, true);
36224 }
36225
36226 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36227         LDKWarningMessage obj_conv;
36228         obj_conv.inner = untag_ptr(obj);
36229         obj_conv.is_owned = ptr_is_owned(obj);
36230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36231         obj_conv.is_owned = false;
36232         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36235         CVec_u8Z_free(ret_var);
36236         return ret_arr;
36237 }
36238
36239 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36240         LDKu8slice ser_ref;
36241         ser_ref.datalen = ser->arr_len;
36242         ser_ref.data = ser->elems;
36243         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36244         *ret_conv = WarningMessage_read(ser_ref);
36245         FREE(ser);
36246         return tag_ptr(ret_conv, true);
36247 }
36248
36249 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36250         LDKUnsignedNodeAnnouncement obj_conv;
36251         obj_conv.inner = untag_ptr(obj);
36252         obj_conv.is_owned = ptr_is_owned(obj);
36253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36254         obj_conv.is_owned = false;
36255         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36258         CVec_u8Z_free(ret_var);
36259         return ret_arr;
36260 }
36261
36262 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36263         LDKu8slice ser_ref;
36264         ser_ref.datalen = ser->arr_len;
36265         ser_ref.data = ser->elems;
36266         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36267         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36268         FREE(ser);
36269         return tag_ptr(ret_conv, true);
36270 }
36271
36272 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
36273         LDKNodeAnnouncement obj_conv;
36274         obj_conv.inner = untag_ptr(obj);
36275         obj_conv.is_owned = ptr_is_owned(obj);
36276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36277         obj_conv.is_owned = false;
36278         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36279         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36280         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36281         CVec_u8Z_free(ret_var);
36282         return ret_arr;
36283 }
36284
36285 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
36286         LDKu8slice ser_ref;
36287         ser_ref.datalen = ser->arr_len;
36288         ser_ref.data = ser->elems;
36289         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36290         *ret_conv = NodeAnnouncement_read(ser_ref);
36291         FREE(ser);
36292         return tag_ptr(ret_conv, true);
36293 }
36294
36295 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
36296         LDKu8slice ser_ref;
36297         ser_ref.datalen = ser->arr_len;
36298         ser_ref.data = ser->elems;
36299         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36300         *ret_conv = QueryShortChannelIds_read(ser_ref);
36301         FREE(ser);
36302         return tag_ptr(ret_conv, true);
36303 }
36304
36305 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
36306         LDKQueryShortChannelIds obj_conv;
36307         obj_conv.inner = untag_ptr(obj);
36308         obj_conv.is_owned = ptr_is_owned(obj);
36309         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36310         obj_conv.is_owned = false;
36311         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36312         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36313         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36314         CVec_u8Z_free(ret_var);
36315         return ret_arr;
36316 }
36317
36318 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
36319         LDKReplyShortChannelIdsEnd obj_conv;
36320         obj_conv.inner = untag_ptr(obj);
36321         obj_conv.is_owned = ptr_is_owned(obj);
36322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36323         obj_conv.is_owned = false;
36324         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36327         CVec_u8Z_free(ret_var);
36328         return ret_arr;
36329 }
36330
36331 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
36332         LDKu8slice ser_ref;
36333         ser_ref.datalen = ser->arr_len;
36334         ser_ref.data = ser->elems;
36335         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36336         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36337         FREE(ser);
36338         return tag_ptr(ret_conv, true);
36339 }
36340
36341 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
36342         LDKQueryChannelRange this_arg_conv;
36343         this_arg_conv.inner = untag_ptr(this_arg);
36344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36346         this_arg_conv.is_owned = false;
36347         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36348         return ret_conv;
36349 }
36350
36351 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
36352         LDKQueryChannelRange obj_conv;
36353         obj_conv.inner = untag_ptr(obj);
36354         obj_conv.is_owned = ptr_is_owned(obj);
36355         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36356         obj_conv.is_owned = false;
36357         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36360         CVec_u8Z_free(ret_var);
36361         return ret_arr;
36362 }
36363
36364 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
36365         LDKu8slice ser_ref;
36366         ser_ref.datalen = ser->arr_len;
36367         ser_ref.data = ser->elems;
36368         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36369         *ret_conv = QueryChannelRange_read(ser_ref);
36370         FREE(ser);
36371         return tag_ptr(ret_conv, true);
36372 }
36373
36374 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
36375         LDKu8slice ser_ref;
36376         ser_ref.datalen = ser->arr_len;
36377         ser_ref.data = ser->elems;
36378         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36379         *ret_conv = ReplyChannelRange_read(ser_ref);
36380         FREE(ser);
36381         return tag_ptr(ret_conv, true);
36382 }
36383
36384 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
36385         LDKReplyChannelRange obj_conv;
36386         obj_conv.inner = untag_ptr(obj);
36387         obj_conv.is_owned = ptr_is_owned(obj);
36388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36389         obj_conv.is_owned = false;
36390         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36391         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36392         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36393         CVec_u8Z_free(ret_var);
36394         return ret_arr;
36395 }
36396
36397 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
36398         LDKGossipTimestampFilter obj_conv;
36399         obj_conv.inner = untag_ptr(obj);
36400         obj_conv.is_owned = ptr_is_owned(obj);
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36402         obj_conv.is_owned = false;
36403         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36404         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36405         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36406         CVec_u8Z_free(ret_var);
36407         return ret_arr;
36408 }
36409
36410 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
36411         LDKu8slice ser_ref;
36412         ser_ref.datalen = ser->arr_len;
36413         ser_ref.data = ser->elems;
36414         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36415         *ret_conv = GossipTimestampFilter_read(ser_ref);
36416         FREE(ser);
36417         return tag_ptr(ret_conv, true);
36418 }
36419
36420 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
36421         if (!ptr_is_owned(this_ptr)) return;
36422         void* this_ptr_ptr = untag_ptr(this_ptr);
36423         CHECK_ACCESS(this_ptr_ptr);
36424         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36425         FREE(untag_ptr(this_ptr));
36426         CustomMessageHandler_free(this_ptr_conv);
36427 }
36428
36429 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
36430         LDKIgnoringMessageHandler this_obj_conv;
36431         this_obj_conv.inner = untag_ptr(this_obj);
36432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36434         IgnoringMessageHandler_free(this_obj_conv);
36435 }
36436
36437 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
36438         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36439         uint64_t ret_ref = 0;
36440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36442         return ret_ref;
36443 }
36444
36445 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
36446         LDKIgnoringMessageHandler this_arg_conv;
36447         this_arg_conv.inner = untag_ptr(this_arg);
36448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36450         this_arg_conv.is_owned = false;
36451         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36452         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36453         return tag_ptr(ret_ret, true);
36454 }
36455
36456 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
36457         LDKIgnoringMessageHandler this_arg_conv;
36458         this_arg_conv.inner = untag_ptr(this_arg);
36459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36461         this_arg_conv.is_owned = false;
36462         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36463         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36464         return tag_ptr(ret_ret, true);
36465 }
36466
36467 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
36468         LDKIgnoringMessageHandler this_arg_conv;
36469         this_arg_conv.inner = untag_ptr(this_arg);
36470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36472         this_arg_conv.is_owned = false;
36473         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
36474         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
36475         return tag_ptr(ret_ret, true);
36476 }
36477
36478 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
36479         LDKIgnoringMessageHandler this_arg_conv;
36480         this_arg_conv.inner = untag_ptr(this_arg);
36481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36483         this_arg_conv.is_owned = false;
36484         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
36485         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
36486         return tag_ptr(ret_ret, true);
36487 }
36488
36489 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
36490         LDKIgnoringMessageHandler this_arg_conv;
36491         this_arg_conv.inner = untag_ptr(this_arg);
36492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36494         this_arg_conv.is_owned = false;
36495         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
36496         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
36497         return tag_ptr(ret_ret, true);
36498 }
36499
36500 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
36501         LDKIgnoringMessageHandler this_arg_conv;
36502         this_arg_conv.inner = untag_ptr(this_arg);
36503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36505         this_arg_conv.is_owned = false;
36506         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36507         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36508         return tag_ptr(ret_ret, true);
36509 }
36510
36511 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
36512         LDKIgnoringMessageHandler this_arg_conv;
36513         this_arg_conv.inner = untag_ptr(this_arg);
36514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36516         this_arg_conv.is_owned = false;
36517         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36518         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36519         return tag_ptr(ret_ret, true);
36520 }
36521
36522 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
36523         LDKErroringMessageHandler this_obj_conv;
36524         this_obj_conv.inner = untag_ptr(this_obj);
36525         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36527         ErroringMessageHandler_free(this_obj_conv);
36528 }
36529
36530 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
36531         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36532         uint64_t ret_ref = 0;
36533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36535         return ret_ref;
36536 }
36537
36538 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
36539         LDKErroringMessageHandler this_arg_conv;
36540         this_arg_conv.inner = untag_ptr(this_arg);
36541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36543         this_arg_conv.is_owned = false;
36544         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36545         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36546         return tag_ptr(ret_ret, true);
36547 }
36548
36549 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
36550         LDKErroringMessageHandler this_arg_conv;
36551         this_arg_conv.inner = untag_ptr(this_arg);
36552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36554         this_arg_conv.is_owned = false;
36555         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36556         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36557         return tag_ptr(ret_ret, true);
36558 }
36559
36560 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
36561         LDKMessageHandler this_obj_conv;
36562         this_obj_conv.inner = untag_ptr(this_obj);
36563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36565         MessageHandler_free(this_obj_conv);
36566 }
36567
36568 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
36569         LDKMessageHandler this_ptr_conv;
36570         this_ptr_conv.inner = untag_ptr(this_ptr);
36571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36573         this_ptr_conv.is_owned = false;
36574         // WARNING: This object doesn't live past this scope, needs clone!
36575         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
36576         return ret_ret;
36577 }
36578
36579 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
36580         LDKMessageHandler this_ptr_conv;
36581         this_ptr_conv.inner = untag_ptr(this_ptr);
36582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36584         this_ptr_conv.is_owned = false;
36585         void* val_ptr = untag_ptr(val);
36586         CHECK_ACCESS(val_ptr);
36587         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36588         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36590                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36591         }
36592         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36593 }
36594
36595 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
36596         LDKMessageHandler this_ptr_conv;
36597         this_ptr_conv.inner = untag_ptr(this_ptr);
36598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36600         this_ptr_conv.is_owned = false;
36601         // WARNING: This object doesn't live past this scope, needs clone!
36602         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
36603         return ret_ret;
36604 }
36605
36606 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
36607         LDKMessageHandler this_ptr_conv;
36608         this_ptr_conv.inner = untag_ptr(this_ptr);
36609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36611         this_ptr_conv.is_owned = false;
36612         void* val_ptr = untag_ptr(val);
36613         CHECK_ACCESS(val_ptr);
36614         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36615         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36616                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36617                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36618         }
36619         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36620 }
36621
36622 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
36623         LDKMessageHandler this_ptr_conv;
36624         this_ptr_conv.inner = untag_ptr(this_ptr);
36625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36627         this_ptr_conv.is_owned = false;
36628         // WARNING: This object doesn't live past this scope, needs clone!
36629         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
36630         return ret_ret;
36631 }
36632
36633 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
36634         LDKMessageHandler this_ptr_conv;
36635         this_ptr_conv.inner = untag_ptr(this_ptr);
36636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36638         this_ptr_conv.is_owned = false;
36639         void* val_ptr = untag_ptr(val);
36640         CHECK_ACCESS(val_ptr);
36641         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
36642         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
36643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36644                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
36645         }
36646         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
36647 }
36648
36649 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) {
36650         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
36651         CHECK_ACCESS(chan_handler_arg_ptr);
36652         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36653         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36654                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36655                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36656         }
36657         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
36658         CHECK_ACCESS(route_handler_arg_ptr);
36659         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36660         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36662                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
36663         }
36664         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
36665         CHECK_ACCESS(onion_message_handler_arg_ptr);
36666         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
36667         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
36668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36669                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
36670         }
36671         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
36672         uint64_t ret_ref = 0;
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36675         return ret_ref;
36676 }
36677
36678 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
36679         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36680         *ret_ret = SocketDescriptor_clone(arg);
36681         return tag_ptr(ret_ret, true);
36682 }
36683 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
36684         void* arg_ptr = untag_ptr(arg);
36685         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
36686         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
36687         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
36688         return ret_conv;
36689 }
36690
36691 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
36692         void* orig_ptr = untag_ptr(orig);
36693         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
36694         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
36695         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36696         *ret_ret = SocketDescriptor_clone(orig_conv);
36697         return tag_ptr(ret_ret, true);
36698 }
36699
36700 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
36701         if (!ptr_is_owned(this_ptr)) return;
36702         void* this_ptr_ptr = untag_ptr(this_ptr);
36703         CHECK_ACCESS(this_ptr_ptr);
36704         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
36705         FREE(untag_ptr(this_ptr));
36706         SocketDescriptor_free(this_ptr_conv);
36707 }
36708
36709 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
36710         LDKPeerHandleError this_obj_conv;
36711         this_obj_conv.inner = untag_ptr(this_obj);
36712         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36714         PeerHandleError_free(this_obj_conv);
36715 }
36716
36717 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
36718         LDKPeerHandleError this_ptr_conv;
36719         this_ptr_conv.inner = untag_ptr(this_ptr);
36720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36722         this_ptr_conv.is_owned = false;
36723         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
36724         return ret_conv;
36725 }
36726
36727 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
36728         LDKPeerHandleError this_ptr_conv;
36729         this_ptr_conv.inner = untag_ptr(this_ptr);
36730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36732         this_ptr_conv.is_owned = false;
36733         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
36734 }
36735
36736 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
36737         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
36738         uint64_t ret_ref = 0;
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36741         return ret_ref;
36742 }
36743
36744 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
36745         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
36746         uint64_t ret_ref = 0;
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36749         return ret_ref;
36750 }
36751 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
36752         LDKPeerHandleError arg_conv;
36753         arg_conv.inner = untag_ptr(arg);
36754         arg_conv.is_owned = ptr_is_owned(arg);
36755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36756         arg_conv.is_owned = false;
36757         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
36758         return ret_conv;
36759 }
36760
36761 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
36762         LDKPeerHandleError orig_conv;
36763         orig_conv.inner = untag_ptr(orig);
36764         orig_conv.is_owned = ptr_is_owned(orig);
36765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36766         orig_conv.is_owned = false;
36767         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
36768         uint64_t ret_ref = 0;
36769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36771         return ret_ref;
36772 }
36773
36774 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
36775         LDKPeerManager this_obj_conv;
36776         this_obj_conv.inner = untag_ptr(this_obj);
36777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36779         PeerManager_free(this_obj_conv);
36780 }
36781
36782 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) {
36783         LDKMessageHandler message_handler_conv;
36784         message_handler_conv.inner = untag_ptr(message_handler);
36785         message_handler_conv.is_owned = ptr_is_owned(message_handler);
36786         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
36787         // WARNING: we need a move here but no clone is available for LDKMessageHandler
36788         
36789         LDKSecretKey our_node_secret_ref;
36790         CHECK(our_node_secret->arr_len == 32);
36791         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
36792         unsigned char ephemeral_random_data_arr[32];
36793         CHECK(ephemeral_random_data->arr_len == 32);
36794         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
36795         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
36796         void* logger_ptr = untag_ptr(logger);
36797         CHECK_ACCESS(logger_ptr);
36798         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36799         if (logger_conv.free == LDKLogger_JCalls_free) {
36800                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36801                 LDKLogger_JCalls_cloned(&logger_conv);
36802         }
36803         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
36804         CHECK_ACCESS(custom_message_handler_ptr);
36805         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
36806         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
36807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36808                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
36809         }
36810         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
36811         uint64_t ret_ref = 0;
36812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36814         return ret_ref;
36815 }
36816
36817 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
36818         LDKPeerManager this_arg_conv;
36819         this_arg_conv.inner = untag_ptr(this_arg);
36820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36822         this_arg_conv.is_owned = false;
36823         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
36824         ptrArray ret_arr = NULL;
36825         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
36826         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
36827         for (size_t m = 0; m < ret_var.datalen; m++) {
36828                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
36829                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
36830                 ret_arr_ptr[m] = ret_conv_12_arr;
36831         }
36832         
36833         FREE(ret_var.data);
36834         return ret_arr;
36835 }
36836
36837 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) {
36838         LDKPeerManager this_arg_conv;
36839         this_arg_conv.inner = untag_ptr(this_arg);
36840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36842         this_arg_conv.is_owned = false;
36843         LDKPublicKey their_node_id_ref;
36844         CHECK(their_node_id->arr_len == 33);
36845         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
36846         void* descriptor_ptr = untag_ptr(descriptor);
36847         CHECK_ACCESS(descriptor_ptr);
36848         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36849         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36850                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36851                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36852         }
36853         void* remote_network_address_ptr = untag_ptr(remote_network_address);
36854         CHECK_ACCESS(remote_network_address_ptr);
36855         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36856         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
36857         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
36858         return tag_ptr(ret_conv, true);
36859 }
36860
36861 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) {
36862         LDKPeerManager this_arg_conv;
36863         this_arg_conv.inner = untag_ptr(this_arg);
36864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36866         this_arg_conv.is_owned = false;
36867         void* descriptor_ptr = untag_ptr(descriptor);
36868         CHECK_ACCESS(descriptor_ptr);
36869         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36870         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36872                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36873         }
36874         void* remote_network_address_ptr = untag_ptr(remote_network_address);
36875         CHECK_ACCESS(remote_network_address_ptr);
36876         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36877         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36878         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
36879         return tag_ptr(ret_conv, true);
36880 }
36881
36882 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
36883         LDKPeerManager this_arg_conv;
36884         this_arg_conv.inner = untag_ptr(this_arg);
36885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36887         this_arg_conv.is_owned = false;
36888         void* descriptor_ptr = untag_ptr(descriptor);
36889         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
36890         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36891         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36892         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
36893         return tag_ptr(ret_conv, true);
36894 }
36895
36896 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
36897         LDKPeerManager this_arg_conv;
36898         this_arg_conv.inner = untag_ptr(this_arg);
36899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36901         this_arg_conv.is_owned = false;
36902         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
36903         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
36904         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
36905         LDKu8slice data_ref;
36906         data_ref.datalen = data->arr_len;
36907         data_ref.data = data->elems;
36908         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
36909         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
36910         FREE(data);
36911         return tag_ptr(ret_conv, true);
36912 }
36913
36914 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
36915         LDKPeerManager this_arg_conv;
36916         this_arg_conv.inner = untag_ptr(this_arg);
36917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36919         this_arg_conv.is_owned = false;
36920         PeerManager_process_events(&this_arg_conv);
36921 }
36922
36923 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
36924         LDKPeerManager this_arg_conv;
36925         this_arg_conv.inner = untag_ptr(this_arg);
36926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36928         this_arg_conv.is_owned = false;
36929         void* descriptor_ptr = untag_ptr(descriptor);
36930         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
36931         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36932         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
36933 }
36934
36935 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) {
36936         LDKPeerManager this_arg_conv;
36937         this_arg_conv.inner = untag_ptr(this_arg);
36938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36940         this_arg_conv.is_owned = false;
36941         LDKPublicKey node_id_ref;
36942         CHECK(node_id->arr_len == 33);
36943         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
36944         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
36945 }
36946
36947 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
36948         LDKPeerManager this_arg_conv;
36949         this_arg_conv.inner = untag_ptr(this_arg);
36950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36952         this_arg_conv.is_owned = false;
36953         PeerManager_disconnect_all_peers(&this_arg_conv);
36954 }
36955
36956 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
36957         LDKPeerManager this_arg_conv;
36958         this_arg_conv.inner = untag_ptr(this_arg);
36959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36961         this_arg_conv.is_owned = false;
36962         PeerManager_timer_tick_occurred(&this_arg_conv);
36963 }
36964
36965 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) {
36966         LDKPeerManager this_arg_conv;
36967         this_arg_conv.inner = untag_ptr(this_arg);
36968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36970         this_arg_conv.is_owned = false;
36971         LDKThreeBytes rgb_ref;
36972         CHECK(rgb->arr_len == 3);
36973         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
36974         LDKThirtyTwoBytes alias_ref;
36975         CHECK(alias->arr_len == 32);
36976         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
36977         LDKCVec_NetAddressZ addresses_constr;
36978         addresses_constr.datalen = addresses->arr_len;
36979         if (addresses_constr.datalen > 0)
36980                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36981         else
36982                 addresses_constr.data = NULL;
36983         uint64_t* addresses_vals = addresses->elems;
36984         for (size_t m = 0; m < addresses_constr.datalen; m++) {
36985                 uint64_t addresses_conv_12 = addresses_vals[m];
36986                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
36987                 CHECK_ACCESS(addresses_conv_12_ptr);
36988                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
36989                 addresses_constr.data[m] = addresses_conv_12_conv;
36990         }
36991         FREE(addresses);
36992         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
36993 }
36994
36995 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
36996         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
36997         return ret_conv;
36998 }
36999
37000 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37001         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37002         return ret_conv;
37003 }
37004
37005 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37006         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37007         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37008         return ret_conv;
37009 }
37010
37011 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37012         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37013         return ret_conv;
37014 }
37015
37016 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37017         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37018         return ret_conv;
37019 }
37020
37021 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37022         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37023         return ret_conv;
37024 }
37025
37026 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37027         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37028         return ret_conv;
37029 }
37030
37031 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37032         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37033         return ret_conv;
37034 }
37035
37036 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37037         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37038         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37039         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37040         return ret_conv;
37041 }
37042
37043 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37044         LDKWitness witness_ref;
37045         witness_ref.datalen = witness->arr_len;
37046         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37047         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37048         witness_ref.data_is_owned = true;
37049         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37050         *ret_copy = HTLCClaim_from_witness(witness_ref);
37051         uint64_t ret_ref = tag_ptr(ret_copy, true);
37052         return ret_ref;
37053 }
37054
37055 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37056         unsigned char commitment_seed_arr[32];
37057         CHECK(commitment_seed->arr_len == 32);
37058         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37059         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37060         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37061         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37062         return ret_arr;
37063 }
37064
37065 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) {
37066         LDKCVec_u8Z to_holder_script_ref;
37067         to_holder_script_ref.datalen = to_holder_script->arr_len;
37068         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37069         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37070         LDKCVec_u8Z to_counterparty_script_ref;
37071         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37072         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37073         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37074         LDKOutPoint funding_outpoint_conv;
37075         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37076         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37078         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37079         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);
37080         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37081         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37082         Transaction_free(ret_var);
37083         return ret_arr;
37084 }
37085
37086 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37087         LDKCounterpartyCommitmentSecrets this_obj_conv;
37088         this_obj_conv.inner = untag_ptr(this_obj);
37089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37091         CounterpartyCommitmentSecrets_free(this_obj_conv);
37092 }
37093
37094 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37095         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37096         uint64_t ret_ref = 0;
37097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37099         return ret_ref;
37100 }
37101 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37102         LDKCounterpartyCommitmentSecrets arg_conv;
37103         arg_conv.inner = untag_ptr(arg);
37104         arg_conv.is_owned = ptr_is_owned(arg);
37105         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37106         arg_conv.is_owned = false;
37107         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37108         return ret_conv;
37109 }
37110
37111 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37112         LDKCounterpartyCommitmentSecrets orig_conv;
37113         orig_conv.inner = untag_ptr(orig);
37114         orig_conv.is_owned = ptr_is_owned(orig);
37115         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37116         orig_conv.is_owned = false;
37117         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37118         uint64_t ret_ref = 0;
37119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37121         return ret_ref;
37122 }
37123
37124 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37125         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
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 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37133         LDKCounterpartyCommitmentSecrets this_arg_conv;
37134         this_arg_conv.inner = untag_ptr(this_arg);
37135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37137         this_arg_conv.is_owned = false;
37138         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37139         return ret_conv;
37140 }
37141
37142 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37143         LDKCounterpartyCommitmentSecrets this_arg_conv;
37144         this_arg_conv.inner = untag_ptr(this_arg);
37145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37147         this_arg_conv.is_owned = false;
37148         LDKThirtyTwoBytes secret_ref;
37149         CHECK(secret->arr_len == 32);
37150         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37151         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37152         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37153         return tag_ptr(ret_conv, true);
37154 }
37155
37156 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37157         LDKCounterpartyCommitmentSecrets this_arg_conv;
37158         this_arg_conv.inner = untag_ptr(this_arg);
37159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37161         this_arg_conv.is_owned = false;
37162         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37163         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37164         return ret_arr;
37165 }
37166
37167 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37168         LDKCounterpartyCommitmentSecrets obj_conv;
37169         obj_conv.inner = untag_ptr(obj);
37170         obj_conv.is_owned = ptr_is_owned(obj);
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37172         obj_conv.is_owned = false;
37173         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37174         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37175         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37176         CVec_u8Z_free(ret_var);
37177         return ret_arr;
37178 }
37179
37180 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37181         LDKu8slice ser_ref;
37182         ser_ref.datalen = ser->arr_len;
37183         ser_ref.data = ser->elems;
37184         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37185         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37186         FREE(ser);
37187         return tag_ptr(ret_conv, true);
37188 }
37189
37190 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37191         LDKPublicKey per_commitment_point_ref;
37192         CHECK(per_commitment_point->arr_len == 33);
37193         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37194         unsigned char base_secret_arr[32];
37195         CHECK(base_secret->arr_len == 32);
37196         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37197         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37198         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37199         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37200         return ret_arr;
37201 }
37202
37203 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37204         LDKPublicKey per_commitment_point_ref;
37205         CHECK(per_commitment_point->arr_len == 33);
37206         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37207         LDKPublicKey base_point_ref;
37208         CHECK(base_point->arr_len == 33);
37209         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37210         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37211         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37212         return ret_arr;
37213 }
37214
37215 int8_tArray  __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
37216         unsigned char per_commitment_secret_arr[32];
37217         CHECK(per_commitment_secret->arr_len == 32);
37218         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37219         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37220         unsigned char countersignatory_revocation_base_secret_arr[32];
37221         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37222         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37223         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37224         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37225         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37226         return ret_arr;
37227 }
37228
37229 int8_tArray  __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
37230         LDKPublicKey per_commitment_point_ref;
37231         CHECK(per_commitment_point->arr_len == 33);
37232         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37233         LDKPublicKey countersignatory_revocation_base_point_ref;
37234         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37235         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37236         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37237         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37238         return ret_arr;
37239 }
37240
37241 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37242         LDKTxCreationKeys this_obj_conv;
37243         this_obj_conv.inner = untag_ptr(this_obj);
37244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37246         TxCreationKeys_free(this_obj_conv);
37247 }
37248
37249 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37250         LDKTxCreationKeys this_ptr_conv;
37251         this_ptr_conv.inner = untag_ptr(this_ptr);
37252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37254         this_ptr_conv.is_owned = false;
37255         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37256         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37257         return ret_arr;
37258 }
37259
37260 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37261         LDKTxCreationKeys this_ptr_conv;
37262         this_ptr_conv.inner = untag_ptr(this_ptr);
37263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37265         this_ptr_conv.is_owned = false;
37266         LDKPublicKey val_ref;
37267         CHECK(val->arr_len == 33);
37268         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37269         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37270 }
37271
37272 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37273         LDKTxCreationKeys this_ptr_conv;
37274         this_ptr_conv.inner = untag_ptr(this_ptr);
37275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37277         this_ptr_conv.is_owned = false;
37278         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37279         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
37280         return ret_arr;
37281 }
37282
37283 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
37284         LDKTxCreationKeys this_ptr_conv;
37285         this_ptr_conv.inner = untag_ptr(this_ptr);
37286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37288         this_ptr_conv.is_owned = false;
37289         LDKPublicKey val_ref;
37290         CHECK(val->arr_len == 33);
37291         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37292         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37293 }
37294
37295 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
37296         LDKTxCreationKeys this_ptr_conv;
37297         this_ptr_conv.inner = untag_ptr(this_ptr);
37298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37300         this_ptr_conv.is_owned = false;
37301         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37302         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
37303         return ret_arr;
37304 }
37305
37306 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
37307         LDKTxCreationKeys this_ptr_conv;
37308         this_ptr_conv.inner = untag_ptr(this_ptr);
37309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37311         this_ptr_conv.is_owned = false;
37312         LDKPublicKey val_ref;
37313         CHECK(val->arr_len == 33);
37314         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37315         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37316 }
37317
37318 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
37319         LDKTxCreationKeys this_ptr_conv;
37320         this_ptr_conv.inner = untag_ptr(this_ptr);
37321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37323         this_ptr_conv.is_owned = false;
37324         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37325         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
37326         return ret_arr;
37327 }
37328
37329 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
37330         LDKTxCreationKeys this_ptr_conv;
37331         this_ptr_conv.inner = untag_ptr(this_ptr);
37332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37334         this_ptr_conv.is_owned = false;
37335         LDKPublicKey val_ref;
37336         CHECK(val->arr_len == 33);
37337         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37338         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37339 }
37340
37341 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
37342         LDKTxCreationKeys this_ptr_conv;
37343         this_ptr_conv.inner = untag_ptr(this_ptr);
37344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37346         this_ptr_conv.is_owned = false;
37347         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37348         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
37349         return ret_arr;
37350 }
37351
37352 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) {
37353         LDKTxCreationKeys this_ptr_conv;
37354         this_ptr_conv.inner = untag_ptr(this_ptr);
37355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37357         this_ptr_conv.is_owned = false;
37358         LDKPublicKey val_ref;
37359         CHECK(val->arr_len == 33);
37360         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37361         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37362 }
37363
37364 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) {
37365         LDKPublicKey per_commitment_point_arg_ref;
37366         CHECK(per_commitment_point_arg->arr_len == 33);
37367         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
37368         LDKPublicKey revocation_key_arg_ref;
37369         CHECK(revocation_key_arg->arr_len == 33);
37370         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
37371         LDKPublicKey broadcaster_htlc_key_arg_ref;
37372         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
37373         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
37374         LDKPublicKey countersignatory_htlc_key_arg_ref;
37375         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
37376         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
37377         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37378         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
37379         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
37380         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);
37381         uint64_t ret_ref = 0;
37382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37384         return ret_ref;
37385 }
37386
37387 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
37388         LDKTxCreationKeys a_conv;
37389         a_conv.inner = untag_ptr(a);
37390         a_conv.is_owned = ptr_is_owned(a);
37391         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37392         a_conv.is_owned = false;
37393         LDKTxCreationKeys b_conv;
37394         b_conv.inner = untag_ptr(b);
37395         b_conv.is_owned = ptr_is_owned(b);
37396         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37397         b_conv.is_owned = false;
37398         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
37399         return ret_conv;
37400 }
37401
37402 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37403         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37404         uint64_t ret_ref = 0;
37405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37407         return ret_ref;
37408 }
37409 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
37410         LDKTxCreationKeys arg_conv;
37411         arg_conv.inner = untag_ptr(arg);
37412         arg_conv.is_owned = ptr_is_owned(arg);
37413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37414         arg_conv.is_owned = false;
37415         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37416         return ret_conv;
37417 }
37418
37419 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
37420         LDKTxCreationKeys orig_conv;
37421         orig_conv.inner = untag_ptr(orig);
37422         orig_conv.is_owned = ptr_is_owned(orig);
37423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37424         orig_conv.is_owned = false;
37425         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37426         uint64_t ret_ref = 0;
37427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37429         return ret_ref;
37430 }
37431
37432 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
37433         LDKTxCreationKeys obj_conv;
37434         obj_conv.inner = untag_ptr(obj);
37435         obj_conv.is_owned = ptr_is_owned(obj);
37436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37437         obj_conv.is_owned = false;
37438         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37441         CVec_u8Z_free(ret_var);
37442         return ret_arr;
37443 }
37444
37445 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
37446         LDKu8slice ser_ref;
37447         ser_ref.datalen = ser->arr_len;
37448         ser_ref.data = ser->elems;
37449         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37450         *ret_conv = TxCreationKeys_read(ser_ref);
37451         FREE(ser);
37452         return tag_ptr(ret_conv, true);
37453 }
37454
37455 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
37456         LDKChannelPublicKeys this_obj_conv;
37457         this_obj_conv.inner = untag_ptr(this_obj);
37458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37460         ChannelPublicKeys_free(this_obj_conv);
37461 }
37462
37463 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
37464         LDKChannelPublicKeys this_ptr_conv;
37465         this_ptr_conv.inner = untag_ptr(this_ptr);
37466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37468         this_ptr_conv.is_owned = false;
37469         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37470         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37471         return ret_arr;
37472 }
37473
37474 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37475         LDKChannelPublicKeys this_ptr_conv;
37476         this_ptr_conv.inner = untag_ptr(this_ptr);
37477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37479         this_ptr_conv.is_owned = false;
37480         LDKPublicKey val_ref;
37481         CHECK(val->arr_len == 33);
37482         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37483         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37484 }
37485
37486 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
37487         LDKChannelPublicKeys this_ptr_conv;
37488         this_ptr_conv.inner = untag_ptr(this_ptr);
37489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37491         this_ptr_conv.is_owned = false;
37492         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37493         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37494         return ret_arr;
37495 }
37496
37497 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37498         LDKChannelPublicKeys this_ptr_conv;
37499         this_ptr_conv.inner = untag_ptr(this_ptr);
37500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37502         this_ptr_conv.is_owned = false;
37503         LDKPublicKey val_ref;
37504         CHECK(val->arr_len == 33);
37505         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37506         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37507 }
37508
37509 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
37510         LDKChannelPublicKeys this_ptr_conv;
37511         this_ptr_conv.inner = untag_ptr(this_ptr);
37512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37514         this_ptr_conv.is_owned = false;
37515         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37516         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
37517         return ret_arr;
37518 }
37519
37520 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37521         LDKChannelPublicKeys this_ptr_conv;
37522         this_ptr_conv.inner = untag_ptr(this_ptr);
37523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37525         this_ptr_conv.is_owned = false;
37526         LDKPublicKey val_ref;
37527         CHECK(val->arr_len == 33);
37528         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37529         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37530 }
37531
37532 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
37533         LDKChannelPublicKeys this_ptr_conv;
37534         this_ptr_conv.inner = untag_ptr(this_ptr);
37535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37537         this_ptr_conv.is_owned = false;
37538         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37539         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37540         return ret_arr;
37541 }
37542
37543 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37544         LDKChannelPublicKeys this_ptr_conv;
37545         this_ptr_conv.inner = untag_ptr(this_ptr);
37546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37548         this_ptr_conv.is_owned = false;
37549         LDKPublicKey val_ref;
37550         CHECK(val->arr_len == 33);
37551         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37552         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37553 }
37554
37555 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
37556         LDKChannelPublicKeys this_ptr_conv;
37557         this_ptr_conv.inner = untag_ptr(this_ptr);
37558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37560         this_ptr_conv.is_owned = false;
37561         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37562         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37563         return ret_arr;
37564 }
37565
37566 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37567         LDKChannelPublicKeys this_ptr_conv;
37568         this_ptr_conv.inner = untag_ptr(this_ptr);
37569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37571         this_ptr_conv.is_owned = false;
37572         LDKPublicKey val_ref;
37573         CHECK(val->arr_len == 33);
37574         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37575         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37576 }
37577
37578 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) {
37579         LDKPublicKey funding_pubkey_arg_ref;
37580         CHECK(funding_pubkey_arg->arr_len == 33);
37581         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37582         LDKPublicKey revocation_basepoint_arg_ref;
37583         CHECK(revocation_basepoint_arg->arr_len == 33);
37584         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37585         LDKPublicKey payment_point_arg_ref;
37586         CHECK(payment_point_arg->arr_len == 33);
37587         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37588         LDKPublicKey delayed_payment_basepoint_arg_ref;
37589         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37590         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37591         LDKPublicKey htlc_basepoint_arg_ref;
37592         CHECK(htlc_basepoint_arg->arr_len == 33);
37593         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37594         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);
37595         uint64_t ret_ref = 0;
37596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37598         return ret_ref;
37599 }
37600
37601 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37602         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37603         uint64_t ret_ref = 0;
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37606         return ret_ref;
37607 }
37608 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
37609         LDKChannelPublicKeys arg_conv;
37610         arg_conv.inner = untag_ptr(arg);
37611         arg_conv.is_owned = ptr_is_owned(arg);
37612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37613         arg_conv.is_owned = false;
37614         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37615         return ret_conv;
37616 }
37617
37618 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
37619         LDKChannelPublicKeys orig_conv;
37620         orig_conv.inner = untag_ptr(orig);
37621         orig_conv.is_owned = ptr_is_owned(orig);
37622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37623         orig_conv.is_owned = false;
37624         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37625         uint64_t ret_ref = 0;
37626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37628         return ret_ref;
37629 }
37630
37631 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
37632         LDKChannelPublicKeys a_conv;
37633         a_conv.inner = untag_ptr(a);
37634         a_conv.is_owned = ptr_is_owned(a);
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37636         a_conv.is_owned = false;
37637         LDKChannelPublicKeys b_conv;
37638         b_conv.inner = untag_ptr(b);
37639         b_conv.is_owned = ptr_is_owned(b);
37640         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37641         b_conv.is_owned = false;
37642         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
37643         return ret_conv;
37644 }
37645
37646 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
37647         LDKChannelPublicKeys obj_conv;
37648         obj_conv.inner = untag_ptr(obj);
37649         obj_conv.is_owned = ptr_is_owned(obj);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37651         obj_conv.is_owned = false;
37652         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37653         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37654         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37655         CVec_u8Z_free(ret_var);
37656         return ret_arr;
37657 }
37658
37659 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
37660         LDKu8slice ser_ref;
37661         ser_ref.datalen = ser->arr_len;
37662         ser_ref.data = ser->elems;
37663         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37664         *ret_conv = ChannelPublicKeys_read(ser_ref);
37665         FREE(ser);
37666         return tag_ptr(ret_conv, true);
37667 }
37668
37669 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) {
37670         LDKPublicKey per_commitment_point_ref;
37671         CHECK(per_commitment_point->arr_len == 33);
37672         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37673         LDKPublicKey broadcaster_delayed_payment_base_ref;
37674         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
37675         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
37676         LDKPublicKey broadcaster_htlc_base_ref;
37677         CHECK(broadcaster_htlc_base->arr_len == 33);
37678         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
37679         LDKPublicKey countersignatory_revocation_base_ref;
37680         CHECK(countersignatory_revocation_base->arr_len == 33);
37681         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
37682         LDKPublicKey countersignatory_htlc_base_ref;
37683         CHECK(countersignatory_htlc_base->arr_len == 33);
37684         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
37685         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
37686         uint64_t ret_ref = 0;
37687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37689         return ret_ref;
37690 }
37691
37692 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) {
37693         LDKPublicKey per_commitment_point_ref;
37694         CHECK(per_commitment_point->arr_len == 33);
37695         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37696         LDKChannelPublicKeys broadcaster_keys_conv;
37697         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37698         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37699         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37700         broadcaster_keys_conv.is_owned = false;
37701         LDKChannelPublicKeys countersignatory_keys_conv;
37702         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37703         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37704         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37705         countersignatory_keys_conv.is_owned = false;
37706         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37707         uint64_t ret_ref = 0;
37708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37710         return ret_ref;
37711 }
37712
37713 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) {
37714         LDKPublicKey revocation_key_ref;
37715         CHECK(revocation_key->arr_len == 33);
37716         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
37717         LDKPublicKey broadcaster_delayed_payment_key_ref;
37718         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
37719         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
37720         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37723         CVec_u8Z_free(ret_var);
37724         return ret_arr;
37725 }
37726
37727 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
37728         LDKHTLCOutputInCommitment this_obj_conv;
37729         this_obj_conv.inner = untag_ptr(this_obj);
37730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37732         HTLCOutputInCommitment_free(this_obj_conv);
37733 }
37734
37735 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
37736         LDKHTLCOutputInCommitment this_ptr_conv;
37737         this_ptr_conv.inner = untag_ptr(this_ptr);
37738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37740         this_ptr_conv.is_owned = false;
37741         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37742         return ret_conv;
37743 }
37744
37745 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
37746         LDKHTLCOutputInCommitment this_ptr_conv;
37747         this_ptr_conv.inner = untag_ptr(this_ptr);
37748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37750         this_ptr_conv.is_owned = false;
37751         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37752 }
37753
37754 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
37755         LDKHTLCOutputInCommitment this_ptr_conv;
37756         this_ptr_conv.inner = untag_ptr(this_ptr);
37757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37759         this_ptr_conv.is_owned = false;
37760         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37761         return ret_conv;
37762 }
37763
37764 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
37765         LDKHTLCOutputInCommitment this_ptr_conv;
37766         this_ptr_conv.inner = untag_ptr(this_ptr);
37767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37769         this_ptr_conv.is_owned = false;
37770         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37771 }
37772
37773 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
37774         LDKHTLCOutputInCommitment this_ptr_conv;
37775         this_ptr_conv.inner = untag_ptr(this_ptr);
37776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37778         this_ptr_conv.is_owned = false;
37779         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37780         return ret_conv;
37781 }
37782
37783 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
37784         LDKHTLCOutputInCommitment this_ptr_conv;
37785         this_ptr_conv.inner = untag_ptr(this_ptr);
37786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37788         this_ptr_conv.is_owned = false;
37789         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
37790 }
37791
37792 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
37793         LDKHTLCOutputInCommitment this_ptr_conv;
37794         this_ptr_conv.inner = untag_ptr(this_ptr);
37795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37797         this_ptr_conv.is_owned = false;
37798         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37799         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
37800         return ret_arr;
37801 }
37802
37803 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
37804         LDKHTLCOutputInCommitment this_ptr_conv;
37805         this_ptr_conv.inner = untag_ptr(this_ptr);
37806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37808         this_ptr_conv.is_owned = false;
37809         LDKThirtyTwoBytes val_ref;
37810         CHECK(val->arr_len == 32);
37811         memcpy(val_ref.data, val->elems, 32); FREE(val);
37812         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
37813 }
37814
37815 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
37816         LDKHTLCOutputInCommitment this_ptr_conv;
37817         this_ptr_conv.inner = untag_ptr(this_ptr);
37818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37820         this_ptr_conv.is_owned = false;
37821         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37822         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
37823         uint64_t ret_ref = tag_ptr(ret_copy, true);
37824         return ret_ref;
37825 }
37826
37827 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
37828         LDKHTLCOutputInCommitment this_ptr_conv;
37829         this_ptr_conv.inner = untag_ptr(this_ptr);
37830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37832         this_ptr_conv.is_owned = false;
37833         void* val_ptr = untag_ptr(val);
37834         CHECK_ACCESS(val_ptr);
37835         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37836         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37837         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
37838 }
37839
37840 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) {
37841         LDKThirtyTwoBytes payment_hash_arg_ref;
37842         CHECK(payment_hash_arg->arr_len == 32);
37843         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
37844         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
37845         CHECK_ACCESS(transaction_output_index_arg_ptr);
37846         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
37847         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
37848         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
37849         uint64_t ret_ref = 0;
37850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37852         return ret_ref;
37853 }
37854
37855 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
37856         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
37857         uint64_t ret_ref = 0;
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37860         return ret_ref;
37861 }
37862 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
37863         LDKHTLCOutputInCommitment arg_conv;
37864         arg_conv.inner = untag_ptr(arg);
37865         arg_conv.is_owned = ptr_is_owned(arg);
37866         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37867         arg_conv.is_owned = false;
37868         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
37869         return ret_conv;
37870 }
37871
37872 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
37873         LDKHTLCOutputInCommitment orig_conv;
37874         orig_conv.inner = untag_ptr(orig);
37875         orig_conv.is_owned = ptr_is_owned(orig);
37876         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37877         orig_conv.is_owned = false;
37878         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
37879         uint64_t ret_ref = 0;
37880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37882         return ret_ref;
37883 }
37884
37885 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
37886         LDKHTLCOutputInCommitment a_conv;
37887         a_conv.inner = untag_ptr(a);
37888         a_conv.is_owned = ptr_is_owned(a);
37889         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37890         a_conv.is_owned = false;
37891         LDKHTLCOutputInCommitment b_conv;
37892         b_conv.inner = untag_ptr(b);
37893         b_conv.is_owned = ptr_is_owned(b);
37894         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37895         b_conv.is_owned = false;
37896         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
37897         return ret_conv;
37898 }
37899
37900 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
37901         LDKHTLCOutputInCommitment obj_conv;
37902         obj_conv.inner = untag_ptr(obj);
37903         obj_conv.is_owned = ptr_is_owned(obj);
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37905         obj_conv.is_owned = false;
37906         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
37907         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37908         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37909         CVec_u8Z_free(ret_var);
37910         return ret_arr;
37911 }
37912
37913 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
37914         LDKu8slice ser_ref;
37915         ser_ref.datalen = ser->arr_len;
37916         ser_ref.data = ser->elems;
37917         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37918         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
37919         FREE(ser);
37920         return tag_ptr(ret_conv, true);
37921 }
37922
37923 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
37924         LDKHTLCOutputInCommitment htlc_conv;
37925         htlc_conv.inner = untag_ptr(htlc);
37926         htlc_conv.is_owned = ptr_is_owned(htlc);
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37928         htlc_conv.is_owned = false;
37929         LDKTxCreationKeys keys_conv;
37930         keys_conv.inner = untag_ptr(keys);
37931         keys_conv.is_owned = ptr_is_owned(keys);
37932         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
37933         keys_conv.is_owned = false;
37934         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
37935         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37936         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37937         CVec_u8Z_free(ret_var);
37938         return ret_arr;
37939 }
37940
37941 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
37942         LDKPublicKey broadcaster_ref;
37943         CHECK(broadcaster->arr_len == 33);
37944         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
37945         LDKPublicKey countersignatory_ref;
37946         CHECK(countersignatory->arr_len == 33);
37947         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
37948         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
37949         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37950         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37951         CVec_u8Z_free(ret_var);
37952         return ret_arr;
37953 }
37954
37955 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, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
37956         unsigned char commitment_txid_arr[32];
37957         CHECK(commitment_txid->arr_len == 32);
37958         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
37959         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
37960         LDKHTLCOutputInCommitment htlc_conv;
37961         htlc_conv.inner = untag_ptr(htlc);
37962         htlc_conv.is_owned = ptr_is_owned(htlc);
37963         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37964         htlc_conv.is_owned = false;
37965         LDKPublicKey broadcaster_delayed_payment_key_ref;
37966         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
37967         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
37968         LDKPublicKey revocation_key_ref;
37969         CHECK(revocation_key->arr_len == 33);
37970         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
37971         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, use_non_zero_fee_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
37972         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37973         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37974         Transaction_free(ret_var);
37975         return ret_arr;
37976 }
37977
37978 int8_tArray  __attribute__((export_name("TS_build_htlc_input_witness"))) TS_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, int8_tArray preimage, int8_tArray redeem_script, jboolean opt_anchors) {
37979         LDKSignature local_sig_ref;
37980         CHECK(local_sig->arr_len == 64);
37981         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
37982         LDKSignature remote_sig_ref;
37983         CHECK(remote_sig->arr_len == 64);
37984         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
37985         LDKThirtyTwoBytes preimage_ref;
37986         CHECK(preimage->arr_len == 32);
37987         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
37988         LDKu8slice redeem_script_ref;
37989         redeem_script_ref.datalen = redeem_script->arr_len;
37990         redeem_script_ref.data = redeem_script->elems;
37991         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
37992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37994         Witness_free(ret_var);
37995         FREE(redeem_script);
37996         return ret_arr;
37997 }
37998
37999 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38000         LDKPublicKey payment_point_ref;
38001         CHECK(payment_point->arr_len == 33);
38002         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38003         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38004         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38005         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38006         CVec_u8Z_free(ret_var);
38007         return ret_arr;
38008 }
38009
38010 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38011         LDKPublicKey funding_pubkey_ref;
38012         CHECK(funding_pubkey->arr_len == 33);
38013         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38014         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38015         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38016         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38017         CVec_u8Z_free(ret_var);
38018         return ret_arr;
38019 }
38020
38021 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38022         LDKPublicKey funding_key_ref;
38023         CHECK(funding_key->arr_len == 33);
38024         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38025         LDKSignature funding_sig_ref;
38026         CHECK(funding_sig->arr_len == 64);
38027         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38028         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38029         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38030         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38031         Witness_free(ret_var);
38032         return ret_arr;
38033 }
38034
38035 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38036         LDKChannelTransactionParameters this_obj_conv;
38037         this_obj_conv.inner = untag_ptr(this_obj);
38038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38040         ChannelTransactionParameters_free(this_obj_conv);
38041 }
38042
38043 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38044         LDKChannelTransactionParameters this_ptr_conv;
38045         this_ptr_conv.inner = untag_ptr(this_ptr);
38046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38048         this_ptr_conv.is_owned = false;
38049         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38050         uint64_t ret_ref = 0;
38051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38053         return ret_ref;
38054 }
38055
38056 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38057         LDKChannelTransactionParameters this_ptr_conv;
38058         this_ptr_conv.inner = untag_ptr(this_ptr);
38059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38061         this_ptr_conv.is_owned = false;
38062         LDKChannelPublicKeys val_conv;
38063         val_conv.inner = untag_ptr(val);
38064         val_conv.is_owned = ptr_is_owned(val);
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38066         val_conv = ChannelPublicKeys_clone(&val_conv);
38067         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38068 }
38069
38070 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38071         LDKChannelTransactionParameters this_ptr_conv;
38072         this_ptr_conv.inner = untag_ptr(this_ptr);
38073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38075         this_ptr_conv.is_owned = false;
38076         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38077         return ret_conv;
38078 }
38079
38080 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) {
38081         LDKChannelTransactionParameters this_ptr_conv;
38082         this_ptr_conv.inner = untag_ptr(this_ptr);
38083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38085         this_ptr_conv.is_owned = false;
38086         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38087 }
38088
38089 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38090         LDKChannelTransactionParameters this_ptr_conv;
38091         this_ptr_conv.inner = untag_ptr(this_ptr);
38092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38094         this_ptr_conv.is_owned = false;
38095         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38096         return ret_conv;
38097 }
38098
38099 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38100         LDKChannelTransactionParameters this_ptr_conv;
38101         this_ptr_conv.inner = untag_ptr(this_ptr);
38102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38104         this_ptr_conv.is_owned = false;
38105         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38106 }
38107
38108 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38109         LDKChannelTransactionParameters this_ptr_conv;
38110         this_ptr_conv.inner = untag_ptr(this_ptr);
38111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38113         this_ptr_conv.is_owned = false;
38114         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38115         uint64_t ret_ref = 0;
38116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38118         return ret_ref;
38119 }
38120
38121 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38122         LDKChannelTransactionParameters this_ptr_conv;
38123         this_ptr_conv.inner = untag_ptr(this_ptr);
38124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38126         this_ptr_conv.is_owned = false;
38127         LDKCounterpartyChannelTransactionParameters val_conv;
38128         val_conv.inner = untag_ptr(val);
38129         val_conv.is_owned = ptr_is_owned(val);
38130         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38131         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38132         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38133 }
38134
38135 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38136         LDKChannelTransactionParameters this_ptr_conv;
38137         this_ptr_conv.inner = untag_ptr(this_ptr);
38138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38140         this_ptr_conv.is_owned = false;
38141         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38142         uint64_t ret_ref = 0;
38143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38145         return ret_ref;
38146 }
38147
38148 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38149         LDKChannelTransactionParameters this_ptr_conv;
38150         this_ptr_conv.inner = untag_ptr(this_ptr);
38151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38153         this_ptr_conv.is_owned = false;
38154         LDKOutPoint val_conv;
38155         val_conv.inner = untag_ptr(val);
38156         val_conv.is_owned = ptr_is_owned(val);
38157         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38158         val_conv = OutPoint_clone(&val_conv);
38159         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38160 }
38161
38162 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38163         LDKChannelTransactionParameters this_ptr_conv;
38164         this_ptr_conv.inner = untag_ptr(this_ptr);
38165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38167         this_ptr_conv.is_owned = false;
38168         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38169         return ret_conv;
38170 }
38171
38172 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38173         LDKChannelTransactionParameters this_ptr_conv;
38174         this_ptr_conv.inner = untag_ptr(this_ptr);
38175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38177         this_ptr_conv.is_owned = false;
38178         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38179         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38180 }
38181
38182 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors(uint64_t this_ptr) {
38183         LDKChannelTransactionParameters this_ptr_conv;
38184         this_ptr_conv.inner = untag_ptr(this_ptr);
38185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38187         this_ptr_conv.is_owned = false;
38188         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
38189         return ret_conv;
38190 }
38191
38192 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors(uint64_t this_ptr, uint32_t val) {
38193         LDKChannelTransactionParameters this_ptr_conv;
38194         this_ptr_conv.inner = untag_ptr(this_ptr);
38195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38197         this_ptr_conv.is_owned = false;
38198         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38199         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38200 }
38201
38202 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, uint32_t opt_non_zero_fee_anchors_arg) {
38203         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38204         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38205         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38206         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38207         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38208         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38209         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38210         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38211         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38212         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38213         LDKOutPoint funding_outpoint_arg_conv;
38214         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38215         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38216         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38217         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38218         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38219         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38220         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, opt_non_zero_fee_anchors_arg_conv);
38221         uint64_t ret_ref = 0;
38222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38224         return ret_ref;
38225 }
38226
38227 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38228         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38229         uint64_t ret_ref = 0;
38230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38232         return ret_ref;
38233 }
38234 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38235         LDKChannelTransactionParameters arg_conv;
38236         arg_conv.inner = untag_ptr(arg);
38237         arg_conv.is_owned = ptr_is_owned(arg);
38238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38239         arg_conv.is_owned = false;
38240         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38241         return ret_conv;
38242 }
38243
38244 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38245         LDKChannelTransactionParameters orig_conv;
38246         orig_conv.inner = untag_ptr(orig);
38247         orig_conv.is_owned = ptr_is_owned(orig);
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38249         orig_conv.is_owned = false;
38250         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38251         uint64_t ret_ref = 0;
38252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38254         return ret_ref;
38255 }
38256
38257 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38258         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38259         this_obj_conv.inner = untag_ptr(this_obj);
38260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38262         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38263 }
38264
38265 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
38266         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38267         this_ptr_conv.inner = untag_ptr(this_ptr);
38268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38270         this_ptr_conv.is_owned = false;
38271         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38272         uint64_t ret_ref = 0;
38273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38275         return ret_ref;
38276 }
38277
38278 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
38279         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38280         this_ptr_conv.inner = untag_ptr(this_ptr);
38281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38283         this_ptr_conv.is_owned = false;
38284         LDKChannelPublicKeys val_conv;
38285         val_conv.inner = untag_ptr(val);
38286         val_conv.is_owned = ptr_is_owned(val);
38287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38288         val_conv = ChannelPublicKeys_clone(&val_conv);
38289         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38290 }
38291
38292 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
38293         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38294         this_ptr_conv.inner = untag_ptr(this_ptr);
38295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38297         this_ptr_conv.is_owned = false;
38298         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38299         return ret_conv;
38300 }
38301
38302 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
38303         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38304         this_ptr_conv.inner = untag_ptr(this_ptr);
38305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38307         this_ptr_conv.is_owned = false;
38308         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38309 }
38310
38311 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
38312         LDKChannelPublicKeys pubkeys_arg_conv;
38313         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
38314         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
38315         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38316         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38317         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38318         uint64_t ret_ref = 0;
38319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38321         return ret_ref;
38322 }
38323
38324 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38325         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38326         uint64_t ret_ref = 0;
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38329         return ret_ref;
38330 }
38331 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
38332         LDKCounterpartyChannelTransactionParameters arg_conv;
38333         arg_conv.inner = untag_ptr(arg);
38334         arg_conv.is_owned = ptr_is_owned(arg);
38335         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38336         arg_conv.is_owned = false;
38337         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38338         return ret_conv;
38339 }
38340
38341 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
38342         LDKCounterpartyChannelTransactionParameters orig_conv;
38343         orig_conv.inner = untag_ptr(orig);
38344         orig_conv.is_owned = ptr_is_owned(orig);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38346         orig_conv.is_owned = false;
38347         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38348         uint64_t ret_ref = 0;
38349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38351         return ret_ref;
38352 }
38353
38354 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
38355         LDKChannelTransactionParameters this_arg_conv;
38356         this_arg_conv.inner = untag_ptr(this_arg);
38357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38359         this_arg_conv.is_owned = false;
38360         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38361         return ret_conv;
38362 }
38363
38364 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
38365         LDKChannelTransactionParameters this_arg_conv;
38366         this_arg_conv.inner = untag_ptr(this_arg);
38367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38369         this_arg_conv.is_owned = false;
38370         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38371         uint64_t ret_ref = 0;
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38374         return ret_ref;
38375 }
38376
38377 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
38378         LDKChannelTransactionParameters this_arg_conv;
38379         this_arg_conv.inner = untag_ptr(this_arg);
38380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38382         this_arg_conv.is_owned = false;
38383         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38384         uint64_t ret_ref = 0;
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38387         return ret_ref;
38388 }
38389
38390 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
38391         LDKCounterpartyChannelTransactionParameters obj_conv;
38392         obj_conv.inner = untag_ptr(obj);
38393         obj_conv.is_owned = ptr_is_owned(obj);
38394         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38395         obj_conv.is_owned = false;
38396         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38397         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38398         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38399         CVec_u8Z_free(ret_var);
38400         return ret_arr;
38401 }
38402
38403 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
38404         LDKu8slice ser_ref;
38405         ser_ref.datalen = ser->arr_len;
38406         ser_ref.data = ser->elems;
38407         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38408         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38409         FREE(ser);
38410         return tag_ptr(ret_conv, true);
38411 }
38412
38413 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
38414         LDKChannelTransactionParameters obj_conv;
38415         obj_conv.inner = untag_ptr(obj);
38416         obj_conv.is_owned = ptr_is_owned(obj);
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38418         obj_conv.is_owned = false;
38419         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38420         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38421         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38422         CVec_u8Z_free(ret_var);
38423         return ret_arr;
38424 }
38425
38426 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
38427         LDKu8slice ser_ref;
38428         ser_ref.datalen = ser->arr_len;
38429         ser_ref.data = ser->elems;
38430         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38431         *ret_conv = ChannelTransactionParameters_read(ser_ref);
38432         FREE(ser);
38433         return tag_ptr(ret_conv, true);
38434 }
38435
38436 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
38437         LDKDirectedChannelTransactionParameters this_obj_conv;
38438         this_obj_conv.inner = untag_ptr(this_obj);
38439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38441         DirectedChannelTransactionParameters_free(this_obj_conv);
38442 }
38443
38444 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
38445         LDKDirectedChannelTransactionParameters this_arg_conv;
38446         this_arg_conv.inner = untag_ptr(this_arg);
38447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38449         this_arg_conv.is_owned = false;
38450         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38451         uint64_t ret_ref = 0;
38452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38454         return ret_ref;
38455 }
38456
38457 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
38458         LDKDirectedChannelTransactionParameters this_arg_conv;
38459         this_arg_conv.inner = untag_ptr(this_arg);
38460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38462         this_arg_conv.is_owned = false;
38463         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38464         uint64_t ret_ref = 0;
38465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38467         return ret_ref;
38468 }
38469
38470 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
38471         LDKDirectedChannelTransactionParameters this_arg_conv;
38472         this_arg_conv.inner = untag_ptr(this_arg);
38473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38475         this_arg_conv.is_owned = false;
38476         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38477         return ret_conv;
38478 }
38479
38480 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
38481         LDKDirectedChannelTransactionParameters this_arg_conv;
38482         this_arg_conv.inner = untag_ptr(this_arg);
38483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38485         this_arg_conv.is_owned = false;
38486         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38487         return ret_conv;
38488 }
38489
38490 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
38491         LDKDirectedChannelTransactionParameters this_arg_conv;
38492         this_arg_conv.inner = untag_ptr(this_arg);
38493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38495         this_arg_conv.is_owned = false;
38496         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38497         uint64_t ret_ref = 0;
38498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38500         return ret_ref;
38501 }
38502
38503 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
38504         LDKDirectedChannelTransactionParameters this_arg_conv;
38505         this_arg_conv.inner = untag_ptr(this_arg);
38506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38508         this_arg_conv.is_owned = false;
38509         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38510         return ret_conv;
38511 }
38512
38513 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
38514         LDKHolderCommitmentTransaction this_obj_conv;
38515         this_obj_conv.inner = untag_ptr(this_obj);
38516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38518         HolderCommitmentTransaction_free(this_obj_conv);
38519 }
38520
38521 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
38522         LDKHolderCommitmentTransaction this_ptr_conv;
38523         this_ptr_conv.inner = untag_ptr(this_ptr);
38524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38526         this_ptr_conv.is_owned = false;
38527         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38528         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
38529         return ret_arr;
38530 }
38531
38532 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
38533         LDKHolderCommitmentTransaction this_ptr_conv;
38534         this_ptr_conv.inner = untag_ptr(this_ptr);
38535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38537         this_ptr_conv.is_owned = false;
38538         LDKSignature val_ref;
38539         CHECK(val->arr_len == 64);
38540         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38541         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38542 }
38543
38544 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
38545         LDKHolderCommitmentTransaction this_ptr_conv;
38546         this_ptr_conv.inner = untag_ptr(this_ptr);
38547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38549         this_ptr_conv.is_owned = false;
38550         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
38551         ptrArray ret_arr = NULL;
38552         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
38553         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
38554         for (size_t m = 0; m < ret_var.datalen; m++) {
38555                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
38556                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
38557                 ret_arr_ptr[m] = ret_conv_12_arr;
38558         }
38559         
38560         FREE(ret_var.data);
38561         return ret_arr;
38562 }
38563
38564 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
38565         LDKHolderCommitmentTransaction this_ptr_conv;
38566         this_ptr_conv.inner = untag_ptr(this_ptr);
38567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38569         this_ptr_conv.is_owned = false;
38570         LDKCVec_SignatureZ val_constr;
38571         val_constr.datalen = val->arr_len;
38572         if (val_constr.datalen > 0)
38573                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38574         else
38575                 val_constr.data = NULL;
38576         int8_tArray* val_vals = (void*) val->elems;
38577         for (size_t m = 0; m < val_constr.datalen; m++) {
38578                 int8_tArray val_conv_12 = val_vals[m];
38579                 LDKSignature val_conv_12_ref;
38580                 CHECK(val_conv_12->arr_len == 64);
38581                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
38582                 val_constr.data[m] = val_conv_12_ref;
38583         }
38584         FREE(val);
38585         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38586 }
38587
38588 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38589         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38590         uint64_t ret_ref = 0;
38591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38593         return ret_ref;
38594 }
38595 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
38596         LDKHolderCommitmentTransaction arg_conv;
38597         arg_conv.inner = untag_ptr(arg);
38598         arg_conv.is_owned = ptr_is_owned(arg);
38599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38600         arg_conv.is_owned = false;
38601         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38602         return ret_conv;
38603 }
38604
38605 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
38606         LDKHolderCommitmentTransaction orig_conv;
38607         orig_conv.inner = untag_ptr(orig);
38608         orig_conv.is_owned = ptr_is_owned(orig);
38609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38610         orig_conv.is_owned = false;
38611         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38612         uint64_t ret_ref = 0;
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38615         return ret_ref;
38616 }
38617
38618 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
38619         LDKHolderCommitmentTransaction obj_conv;
38620         obj_conv.inner = untag_ptr(obj);
38621         obj_conv.is_owned = ptr_is_owned(obj);
38622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38623         obj_conv.is_owned = false;
38624         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38627         CVec_u8Z_free(ret_var);
38628         return ret_arr;
38629 }
38630
38631 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
38632         LDKu8slice ser_ref;
38633         ser_ref.datalen = ser->arr_len;
38634         ser_ref.data = ser->elems;
38635         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38636         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38637         FREE(ser);
38638         return tag_ptr(ret_conv, true);
38639 }
38640
38641 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) {
38642         LDKCommitmentTransaction commitment_tx_conv;
38643         commitment_tx_conv.inner = untag_ptr(commitment_tx);
38644         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
38645         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38646         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38647         LDKSignature counterparty_sig_ref;
38648         CHECK(counterparty_sig->arr_len == 64);
38649         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
38650         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38651         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
38652         if (counterparty_htlc_sigs_constr.datalen > 0)
38653                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38654         else
38655                 counterparty_htlc_sigs_constr.data = NULL;
38656         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
38657         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
38658                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
38659                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
38660                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
38661                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
38662                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
38663         }
38664         FREE(counterparty_htlc_sigs);
38665         LDKPublicKey holder_funding_key_ref;
38666         CHECK(holder_funding_key->arr_len == 33);
38667         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
38668         LDKPublicKey counterparty_funding_key_ref;
38669         CHECK(counterparty_funding_key->arr_len == 33);
38670         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
38671         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38672         uint64_t ret_ref = 0;
38673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38675         return ret_ref;
38676 }
38677
38678 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
38679         LDKBuiltCommitmentTransaction this_obj_conv;
38680         this_obj_conv.inner = untag_ptr(this_obj);
38681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38683         BuiltCommitmentTransaction_free(this_obj_conv);
38684 }
38685
38686 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
38687         LDKBuiltCommitmentTransaction this_ptr_conv;
38688         this_ptr_conv.inner = untag_ptr(this_ptr);
38689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38691         this_ptr_conv.is_owned = false;
38692         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38693         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38694         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38695         Transaction_free(ret_var);
38696         return ret_arr;
38697 }
38698
38699 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
38700         LDKBuiltCommitmentTransaction this_ptr_conv;
38701         this_ptr_conv.inner = untag_ptr(this_ptr);
38702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38704         this_ptr_conv.is_owned = false;
38705         LDKTransaction val_ref;
38706         val_ref.datalen = val->arr_len;
38707         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38708         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38709         val_ref.data_is_owned = true;
38710         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38711 }
38712
38713 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
38714         LDKBuiltCommitmentTransaction this_ptr_conv;
38715         this_ptr_conv.inner = untag_ptr(this_ptr);
38716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38718         this_ptr_conv.is_owned = false;
38719         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38720         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
38721         return ret_arr;
38722 }
38723
38724 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
38725         LDKBuiltCommitmentTransaction this_ptr_conv;
38726         this_ptr_conv.inner = untag_ptr(this_ptr);
38727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38729         this_ptr_conv.is_owned = false;
38730         LDKThirtyTwoBytes val_ref;
38731         CHECK(val->arr_len == 32);
38732         memcpy(val_ref.data, val->elems, 32); FREE(val);
38733         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38734 }
38735
38736 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
38737         LDKTransaction transaction_arg_ref;
38738         transaction_arg_ref.datalen = transaction_arg->arr_len;
38739         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38740         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
38741         transaction_arg_ref.data_is_owned = true;
38742         LDKThirtyTwoBytes txid_arg_ref;
38743         CHECK(txid_arg->arr_len == 32);
38744         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
38745         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38746         uint64_t ret_ref = 0;
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38749         return ret_ref;
38750 }
38751
38752 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38753         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38754         uint64_t ret_ref = 0;
38755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38757         return ret_ref;
38758 }
38759 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
38760         LDKBuiltCommitmentTransaction arg_conv;
38761         arg_conv.inner = untag_ptr(arg);
38762         arg_conv.is_owned = ptr_is_owned(arg);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38764         arg_conv.is_owned = false;
38765         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38766         return ret_conv;
38767 }
38768
38769 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
38770         LDKBuiltCommitmentTransaction orig_conv;
38771         orig_conv.inner = untag_ptr(orig);
38772         orig_conv.is_owned = ptr_is_owned(orig);
38773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38774         orig_conv.is_owned = false;
38775         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38776         uint64_t ret_ref = 0;
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38779         return ret_ref;
38780 }
38781
38782 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
38783         LDKBuiltCommitmentTransaction obj_conv;
38784         obj_conv.inner = untag_ptr(obj);
38785         obj_conv.is_owned = ptr_is_owned(obj);
38786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38787         obj_conv.is_owned = false;
38788         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38789         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38790         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38791         CVec_u8Z_free(ret_var);
38792         return ret_arr;
38793 }
38794
38795 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
38796         LDKu8slice ser_ref;
38797         ser_ref.datalen = ser->arr_len;
38798         ser_ref.data = ser->elems;
38799         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38800         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38801         FREE(ser);
38802         return tag_ptr(ret_conv, true);
38803 }
38804
38805 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) {
38806         LDKBuiltCommitmentTransaction this_arg_conv;
38807         this_arg_conv.inner = untag_ptr(this_arg);
38808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38810         this_arg_conv.is_owned = false;
38811         LDKu8slice funding_redeemscript_ref;
38812         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
38813         funding_redeemscript_ref.data = funding_redeemscript->elems;
38814         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38815         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
38816         FREE(funding_redeemscript);
38817         return ret_arr;
38818 }
38819
38820 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) {
38821         LDKBuiltCommitmentTransaction this_arg_conv;
38822         this_arg_conv.inner = untag_ptr(this_arg);
38823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38825         this_arg_conv.is_owned = false;
38826         unsigned char funding_key_arr[32];
38827         CHECK(funding_key->arr_len == 32);
38828         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
38829         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38830         LDKu8slice funding_redeemscript_ref;
38831         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
38832         funding_redeemscript_ref.data = funding_redeemscript->elems;
38833         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38834         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
38835         FREE(funding_redeemscript);
38836         return ret_arr;
38837 }
38838
38839 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
38840         LDKClosingTransaction this_obj_conv;
38841         this_obj_conv.inner = untag_ptr(this_obj);
38842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38844         ClosingTransaction_free(this_obj_conv);
38845 }
38846
38847 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38848         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38849         uint64_t ret_ref = 0;
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38852         return ret_ref;
38853 }
38854 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
38855         LDKClosingTransaction arg_conv;
38856         arg_conv.inner = untag_ptr(arg);
38857         arg_conv.is_owned = ptr_is_owned(arg);
38858         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38859         arg_conv.is_owned = false;
38860         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38861         return ret_conv;
38862 }
38863
38864 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
38865         LDKClosingTransaction orig_conv;
38866         orig_conv.inner = untag_ptr(orig);
38867         orig_conv.is_owned = ptr_is_owned(orig);
38868         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38869         orig_conv.is_owned = false;
38870         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
38871         uint64_t ret_ref = 0;
38872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38874         return ret_ref;
38875 }
38876
38877 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
38878         LDKClosingTransaction o_conv;
38879         o_conv.inner = untag_ptr(o);
38880         o_conv.is_owned = ptr_is_owned(o);
38881         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38882         o_conv.is_owned = false;
38883         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
38884         return ret_conv;
38885 }
38886
38887 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
38888         LDKClosingTransaction a_conv;
38889         a_conv.inner = untag_ptr(a);
38890         a_conv.is_owned = ptr_is_owned(a);
38891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38892         a_conv.is_owned = false;
38893         LDKClosingTransaction b_conv;
38894         b_conv.inner = untag_ptr(b);
38895         b_conv.is_owned = ptr_is_owned(b);
38896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38897         b_conv.is_owned = false;
38898         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
38899         return ret_conv;
38900 }
38901
38902 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) {
38903         LDKCVec_u8Z to_holder_script_ref;
38904         to_holder_script_ref.datalen = to_holder_script->arr_len;
38905         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38906         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
38907         LDKCVec_u8Z to_counterparty_script_ref;
38908         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
38909         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38910         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
38911         LDKOutPoint funding_outpoint_conv;
38912         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38913         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38915         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38916         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
38917         uint64_t ret_ref = 0;
38918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38920         return ret_ref;
38921 }
38922
38923 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
38924         LDKClosingTransaction this_arg_conv;
38925         this_arg_conv.inner = untag_ptr(this_arg);
38926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38928         this_arg_conv.is_owned = false;
38929         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
38930         uint64_t ret_ref = 0;
38931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38933         return ret_ref;
38934 }
38935
38936 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
38937         LDKClosingTransaction this_arg_conv;
38938         this_arg_conv.inner = untag_ptr(this_arg);
38939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38941         this_arg_conv.is_owned = false;
38942         LDKOutPoint funding_outpoint_conv;
38943         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38944         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38945         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38946         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38947         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
38948         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
38949         return tag_ptr(ret_conv, true);
38950 }
38951
38952 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
38953         LDKClosingTransaction this_arg_conv;
38954         this_arg_conv.inner = untag_ptr(this_arg);
38955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38957         this_arg_conv.is_owned = false;
38958         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
38959         return ret_conv;
38960 }
38961
38962 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
38963         LDKClosingTransaction this_arg_conv;
38964         this_arg_conv.inner = untag_ptr(this_arg);
38965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38967         this_arg_conv.is_owned = false;
38968         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
38969         return ret_conv;
38970 }
38971
38972 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
38973         LDKClosingTransaction this_arg_conv;
38974         this_arg_conv.inner = untag_ptr(this_arg);
38975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38977         this_arg_conv.is_owned = false;
38978         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
38979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38981         return ret_arr;
38982 }
38983
38984 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
38985         LDKClosingTransaction this_arg_conv;
38986         this_arg_conv.inner = untag_ptr(this_arg);
38987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38989         this_arg_conv.is_owned = false;
38990         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
38991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38993         return ret_arr;
38994 }
38995
38996 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
38997         LDKTrustedClosingTransaction this_obj_conv;
38998         this_obj_conv.inner = untag_ptr(this_obj);
38999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39001         TrustedClosingTransaction_free(this_obj_conv);
39002 }
39003
39004 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39005         LDKTrustedClosingTransaction this_arg_conv;
39006         this_arg_conv.inner = untag_ptr(this_arg);
39007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39009         this_arg_conv.is_owned = false;
39010         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39013         Transaction_free(ret_var);
39014         return ret_arr;
39015 }
39016
39017 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) {
39018         LDKTrustedClosingTransaction 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         LDKu8slice funding_redeemscript_ref;
39024         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39025         funding_redeemscript_ref.data = funding_redeemscript->elems;
39026         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39027         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39028         FREE(funding_redeemscript);
39029         return ret_arr;
39030 }
39031
39032 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) {
39033         LDKTrustedClosingTransaction this_arg_conv;
39034         this_arg_conv.inner = untag_ptr(this_arg);
39035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39037         this_arg_conv.is_owned = false;
39038         unsigned char funding_key_arr[32];
39039         CHECK(funding_key->arr_len == 32);
39040         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39041         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39042         LDKu8slice funding_redeemscript_ref;
39043         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39044         funding_redeemscript_ref.data = funding_redeemscript->elems;
39045         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39046         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39047         FREE(funding_redeemscript);
39048         return ret_arr;
39049 }
39050
39051 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39052         LDKCommitmentTransaction this_obj_conv;
39053         this_obj_conv.inner = untag_ptr(this_obj);
39054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39056         CommitmentTransaction_free(this_obj_conv);
39057 }
39058
39059 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39060         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39061         uint64_t ret_ref = 0;
39062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39064         return ret_ref;
39065 }
39066 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39067         LDKCommitmentTransaction arg_conv;
39068         arg_conv.inner = untag_ptr(arg);
39069         arg_conv.is_owned = ptr_is_owned(arg);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39071         arg_conv.is_owned = false;
39072         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39073         return ret_conv;
39074 }
39075
39076 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39077         LDKCommitmentTransaction orig_conv;
39078         orig_conv.inner = untag_ptr(orig);
39079         orig_conv.is_owned = ptr_is_owned(orig);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39081         orig_conv.is_owned = false;
39082         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39083         uint64_t ret_ref = 0;
39084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39086         return ret_ref;
39087 }
39088
39089 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39090         LDKCommitmentTransaction obj_conv;
39091         obj_conv.inner = untag_ptr(obj);
39092         obj_conv.is_owned = ptr_is_owned(obj);
39093         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39094         obj_conv.is_owned = false;
39095         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39096         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39097         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39098         CVec_u8Z_free(ret_var);
39099         return ret_arr;
39100 }
39101
39102 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39103         LDKu8slice ser_ref;
39104         ser_ref.datalen = ser->arr_len;
39105         ser_ref.data = ser->elems;
39106         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39107         *ret_conv = CommitmentTransaction_read(ser_ref);
39108         FREE(ser);
39109         return tag_ptr(ret_conv, true);
39110 }
39111
39112 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39113         LDKCommitmentTransaction this_arg_conv;
39114         this_arg_conv.inner = untag_ptr(this_arg);
39115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39117         this_arg_conv.is_owned = false;
39118         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39119         return ret_conv;
39120 }
39121
39122 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39123         LDKCommitmentTransaction 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         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39129         return ret_conv;
39130 }
39131
39132 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39133         LDKCommitmentTransaction this_arg_conv;
39134         this_arg_conv.inner = untag_ptr(this_arg);
39135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39137         this_arg_conv.is_owned = false;
39138         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39139         return ret_conv;
39140 }
39141
39142 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39143         LDKCommitmentTransaction this_arg_conv;
39144         this_arg_conv.inner = untag_ptr(this_arg);
39145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39147         this_arg_conv.is_owned = false;
39148         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39149         return ret_conv;
39150 }
39151
39152 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39153         LDKCommitmentTransaction this_arg_conv;
39154         this_arg_conv.inner = untag_ptr(this_arg);
39155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39157         this_arg_conv.is_owned = false;
39158         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39159         uint64_t ret_ref = 0;
39160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39162         return ret_ref;
39163 }
39164
39165 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) {
39166         LDKCommitmentTransaction this_arg_conv;
39167         this_arg_conv.inner = untag_ptr(this_arg);
39168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39170         this_arg_conv.is_owned = false;
39171         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39172         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39173         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39174         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39175         channel_parameters_conv.is_owned = false;
39176         LDKChannelPublicKeys broadcaster_keys_conv;
39177         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39178         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39179         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39180         broadcaster_keys_conv.is_owned = false;
39181         LDKChannelPublicKeys countersignatory_keys_conv;
39182         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39183         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39184         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39185         countersignatory_keys_conv.is_owned = false;
39186         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39187         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39188         return tag_ptr(ret_conv, true);
39189 }
39190
39191 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39192         LDKTrustedCommitmentTransaction this_obj_conv;
39193         this_obj_conv.inner = untag_ptr(this_obj);
39194         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39196         TrustedCommitmentTransaction_free(this_obj_conv);
39197 }
39198
39199 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39200         LDKTrustedCommitmentTransaction 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39206         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39207         return ret_arr;
39208 }
39209
39210 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39211         LDKTrustedCommitmentTransaction this_arg_conv;
39212         this_arg_conv.inner = untag_ptr(this_arg);
39213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39215         this_arg_conv.is_owned = false;
39216         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39217         uint64_t ret_ref = 0;
39218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39220         return ret_ref;
39221 }
39222
39223 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39224         LDKTrustedCommitmentTransaction this_arg_conv;
39225         this_arg_conv.inner = untag_ptr(this_arg);
39226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39228         this_arg_conv.is_owned = false;
39229         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39230         uint64_t ret_ref = 0;
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39233         return ret_ref;
39234 }
39235
39236 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
39237         LDKTrustedCommitmentTransaction 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         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39243         return ret_conv;
39244 }
39245
39246 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) {
39247         LDKTrustedCommitmentTransaction this_arg_conv;
39248         this_arg_conv.inner = untag_ptr(this_arg);
39249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39251         this_arg_conv.is_owned = false;
39252         unsigned char htlc_base_key_arr[32];
39253         CHECK(htlc_base_key->arr_len == 32);
39254         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
39255         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39256         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39257         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39258         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39259         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39260         channel_parameters_conv.is_owned = false;
39261         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39262         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39263         return tag_ptr(ret_conv, true);
39264 }
39265
39266 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) {
39267         LDKPublicKey broadcaster_payment_basepoint_ref;
39268         CHECK(broadcaster_payment_basepoint->arr_len == 33);
39269         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
39270         LDKPublicKey countersignatory_payment_basepoint_ref;
39271         CHECK(countersignatory_payment_basepoint->arr_len == 33);
39272         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
39273         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39274         return ret_conv;
39275 }
39276
39277 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
39278         LDKInitFeatures a_conv;
39279         a_conv.inner = untag_ptr(a);
39280         a_conv.is_owned = ptr_is_owned(a);
39281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39282         a_conv.is_owned = false;
39283         LDKInitFeatures b_conv;
39284         b_conv.inner = untag_ptr(b);
39285         b_conv.is_owned = ptr_is_owned(b);
39286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39287         b_conv.is_owned = false;
39288         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39289         return ret_conv;
39290 }
39291
39292 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
39293         LDKNodeFeatures a_conv;
39294         a_conv.inner = untag_ptr(a);
39295         a_conv.is_owned = ptr_is_owned(a);
39296         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39297         a_conv.is_owned = false;
39298         LDKNodeFeatures b_conv;
39299         b_conv.inner = untag_ptr(b);
39300         b_conv.is_owned = ptr_is_owned(b);
39301         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39302         b_conv.is_owned = false;
39303         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39304         return ret_conv;
39305 }
39306
39307 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
39308         LDKChannelFeatures a_conv;
39309         a_conv.inner = untag_ptr(a);
39310         a_conv.is_owned = ptr_is_owned(a);
39311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39312         a_conv.is_owned = false;
39313         LDKChannelFeatures b_conv;
39314         b_conv.inner = untag_ptr(b);
39315         b_conv.is_owned = ptr_is_owned(b);
39316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39317         b_conv.is_owned = false;
39318         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39319         return ret_conv;
39320 }
39321
39322 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
39323         LDKInvoiceFeatures a_conv;
39324         a_conv.inner = untag_ptr(a);
39325         a_conv.is_owned = ptr_is_owned(a);
39326         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39327         a_conv.is_owned = false;
39328         LDKInvoiceFeatures b_conv;
39329         b_conv.inner = untag_ptr(b);
39330         b_conv.is_owned = ptr_is_owned(b);
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39332         b_conv.is_owned = false;
39333         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39334         return ret_conv;
39335 }
39336
39337 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
39338         LDKOfferFeatures a_conv;
39339         a_conv.inner = untag_ptr(a);
39340         a_conv.is_owned = ptr_is_owned(a);
39341         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39342         a_conv.is_owned = false;
39343         LDKOfferFeatures b_conv;
39344         b_conv.inner = untag_ptr(b);
39345         b_conv.is_owned = ptr_is_owned(b);
39346         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39347         b_conv.is_owned = false;
39348         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
39349         return ret_conv;
39350 }
39351
39352 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
39353         LDKInvoiceRequestFeatures a_conv;
39354         a_conv.inner = untag_ptr(a);
39355         a_conv.is_owned = ptr_is_owned(a);
39356         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39357         a_conv.is_owned = false;
39358         LDKInvoiceRequestFeatures b_conv;
39359         b_conv.inner = untag_ptr(b);
39360         b_conv.is_owned = ptr_is_owned(b);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39362         b_conv.is_owned = false;
39363         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
39364         return ret_conv;
39365 }
39366
39367 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
39368         LDKChannelTypeFeatures a_conv;
39369         a_conv.inner = untag_ptr(a);
39370         a_conv.is_owned = ptr_is_owned(a);
39371         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39372         a_conv.is_owned = false;
39373         LDKChannelTypeFeatures b_conv;
39374         b_conv.inner = untag_ptr(b);
39375         b_conv.is_owned = ptr_is_owned(b);
39376         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39377         b_conv.is_owned = false;
39378         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39379         return ret_conv;
39380 }
39381
39382 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39383         LDKInitFeatures ret_var = InitFeatures_clone(arg);
39384         uint64_t ret_ref = 0;
39385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39387         return ret_ref;
39388 }
39389 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
39390         LDKInitFeatures arg_conv;
39391         arg_conv.inner = untag_ptr(arg);
39392         arg_conv.is_owned = ptr_is_owned(arg);
39393         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39394         arg_conv.is_owned = false;
39395         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39396         return ret_conv;
39397 }
39398
39399 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
39400         LDKInitFeatures orig_conv;
39401         orig_conv.inner = untag_ptr(orig);
39402         orig_conv.is_owned = ptr_is_owned(orig);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39404         orig_conv.is_owned = false;
39405         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39406         uint64_t ret_ref = 0;
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39409         return ret_ref;
39410 }
39411
39412 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39413         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39414         uint64_t ret_ref = 0;
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39417         return ret_ref;
39418 }
39419 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
39420         LDKNodeFeatures arg_conv;
39421         arg_conv.inner = untag_ptr(arg);
39422         arg_conv.is_owned = ptr_is_owned(arg);
39423         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39424         arg_conv.is_owned = false;
39425         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39426         return ret_conv;
39427 }
39428
39429 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
39430         LDKNodeFeatures orig_conv;
39431         orig_conv.inner = untag_ptr(orig);
39432         orig_conv.is_owned = ptr_is_owned(orig);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39434         orig_conv.is_owned = false;
39435         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39436         uint64_t ret_ref = 0;
39437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39439         return ret_ref;
39440 }
39441
39442 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39443         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39444         uint64_t ret_ref = 0;
39445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39447         return ret_ref;
39448 }
39449 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
39450         LDKChannelFeatures arg_conv;
39451         arg_conv.inner = untag_ptr(arg);
39452         arg_conv.is_owned = ptr_is_owned(arg);
39453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39454         arg_conv.is_owned = false;
39455         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39456         return ret_conv;
39457 }
39458
39459 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
39460         LDKChannelFeatures orig_conv;
39461         orig_conv.inner = untag_ptr(orig);
39462         orig_conv.is_owned = ptr_is_owned(orig);
39463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39464         orig_conv.is_owned = false;
39465         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39466         uint64_t ret_ref = 0;
39467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39469         return ret_ref;
39470 }
39471
39472 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39473         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39474         uint64_t ret_ref = 0;
39475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39477         return ret_ref;
39478 }
39479 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
39480         LDKInvoiceFeatures arg_conv;
39481         arg_conv.inner = untag_ptr(arg);
39482         arg_conv.is_owned = ptr_is_owned(arg);
39483         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39484         arg_conv.is_owned = false;
39485         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39486         return ret_conv;
39487 }
39488
39489 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
39490         LDKInvoiceFeatures orig_conv;
39491         orig_conv.inner = untag_ptr(orig);
39492         orig_conv.is_owned = ptr_is_owned(orig);
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39494         orig_conv.is_owned = false;
39495         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39496         uint64_t ret_ref = 0;
39497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39499         return ret_ref;
39500 }
39501
39502 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
39503         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
39504         uint64_t ret_ref = 0;
39505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39507         return ret_ref;
39508 }
39509 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
39510         LDKOfferFeatures arg_conv;
39511         arg_conv.inner = untag_ptr(arg);
39512         arg_conv.is_owned = ptr_is_owned(arg);
39513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39514         arg_conv.is_owned = false;
39515         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
39516         return ret_conv;
39517 }
39518
39519 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
39520         LDKOfferFeatures orig_conv;
39521         orig_conv.inner = untag_ptr(orig);
39522         orig_conv.is_owned = ptr_is_owned(orig);
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39524         orig_conv.is_owned = false;
39525         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
39526         uint64_t ret_ref = 0;
39527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39529         return ret_ref;
39530 }
39531
39532 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
39533         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
39534         uint64_t ret_ref = 0;
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39537         return ret_ref;
39538 }
39539 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
39540         LDKInvoiceRequestFeatures arg_conv;
39541         arg_conv.inner = untag_ptr(arg);
39542         arg_conv.is_owned = ptr_is_owned(arg);
39543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39544         arg_conv.is_owned = false;
39545         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
39546         return ret_conv;
39547 }
39548
39549 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
39550         LDKInvoiceRequestFeatures orig_conv;
39551         orig_conv.inner = untag_ptr(orig);
39552         orig_conv.is_owned = ptr_is_owned(orig);
39553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39554         orig_conv.is_owned = false;
39555         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
39556         uint64_t ret_ref = 0;
39557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39559         return ret_ref;
39560 }
39561
39562 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39563         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39564         uint64_t ret_ref = 0;
39565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39567         return ret_ref;
39568 }
39569 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
39570         LDKChannelTypeFeatures arg_conv;
39571         arg_conv.inner = untag_ptr(arg);
39572         arg_conv.is_owned = ptr_is_owned(arg);
39573         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39574         arg_conv.is_owned = false;
39575         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39576         return ret_conv;
39577 }
39578
39579 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
39580         LDKChannelTypeFeatures orig_conv;
39581         orig_conv.inner = untag_ptr(orig);
39582         orig_conv.is_owned = ptr_is_owned(orig);
39583         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39584         orig_conv.is_owned = false;
39585         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39586         uint64_t ret_ref = 0;
39587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39589         return ret_ref;
39590 }
39591
39592 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
39593         LDKInitFeatures this_obj_conv;
39594         this_obj_conv.inner = untag_ptr(this_obj);
39595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39597         InitFeatures_free(this_obj_conv);
39598 }
39599
39600 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
39601         LDKNodeFeatures this_obj_conv;
39602         this_obj_conv.inner = untag_ptr(this_obj);
39603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39605         NodeFeatures_free(this_obj_conv);
39606 }
39607
39608 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
39609         LDKChannelFeatures this_obj_conv;
39610         this_obj_conv.inner = untag_ptr(this_obj);
39611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39613         ChannelFeatures_free(this_obj_conv);
39614 }
39615
39616 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
39617         LDKInvoiceFeatures this_obj_conv;
39618         this_obj_conv.inner = untag_ptr(this_obj);
39619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39621         InvoiceFeatures_free(this_obj_conv);
39622 }
39623
39624 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
39625         LDKOfferFeatures this_obj_conv;
39626         this_obj_conv.inner = untag_ptr(this_obj);
39627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39629         OfferFeatures_free(this_obj_conv);
39630 }
39631
39632 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
39633         LDKInvoiceRequestFeatures this_obj_conv;
39634         this_obj_conv.inner = untag_ptr(this_obj);
39635         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39637         InvoiceRequestFeatures_free(this_obj_conv);
39638 }
39639
39640 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
39641         LDKChannelTypeFeatures this_obj_conv;
39642         this_obj_conv.inner = untag_ptr(this_obj);
39643         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39645         ChannelTypeFeatures_free(this_obj_conv);
39646 }
39647
39648 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
39649         LDKInitFeatures ret_var = InitFeatures_empty();
39650         uint64_t ret_ref = 0;
39651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39653         return ret_ref;
39654 }
39655
39656 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
39657         LDKInitFeatures this_arg_conv;
39658         this_arg_conv.inner = untag_ptr(this_arg);
39659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39661         this_arg_conv.is_owned = false;
39662         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39663         return ret_conv;
39664 }
39665
39666 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
39667         LDKNodeFeatures ret_var = NodeFeatures_empty();
39668         uint64_t ret_ref = 0;
39669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39671         return ret_ref;
39672 }
39673
39674 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
39675         LDKNodeFeatures this_arg_conv;
39676         this_arg_conv.inner = untag_ptr(this_arg);
39677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39679         this_arg_conv.is_owned = false;
39680         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39681         return ret_conv;
39682 }
39683
39684 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
39685         LDKChannelFeatures ret_var = ChannelFeatures_empty();
39686         uint64_t ret_ref = 0;
39687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39689         return ret_ref;
39690 }
39691
39692 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
39693         LDKChannelFeatures this_arg_conv;
39694         this_arg_conv.inner = untag_ptr(this_arg);
39695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39697         this_arg_conv.is_owned = false;
39698         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39699         return ret_conv;
39700 }
39701
39702 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
39703         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39704         uint64_t ret_ref = 0;
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39707         return ret_ref;
39708 }
39709
39710 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
39711         LDKInvoiceFeatures this_arg_conv;
39712         this_arg_conv.inner = untag_ptr(this_arg);
39713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39715         this_arg_conv.is_owned = false;
39716         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39717         return ret_conv;
39718 }
39719
39720 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
39721         LDKOfferFeatures ret_var = OfferFeatures_empty();
39722         uint64_t ret_ref = 0;
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39725         return ret_ref;
39726 }
39727
39728 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
39729         LDKOfferFeatures this_arg_conv;
39730         this_arg_conv.inner = untag_ptr(this_arg);
39731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39733         this_arg_conv.is_owned = false;
39734         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
39735         return ret_conv;
39736 }
39737
39738 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
39739         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
39740         uint64_t ret_ref = 0;
39741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39743         return ret_ref;
39744 }
39745
39746 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
39747         LDKInvoiceRequestFeatures this_arg_conv;
39748         this_arg_conv.inner = untag_ptr(this_arg);
39749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39751         this_arg_conv.is_owned = false;
39752         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
39753         return ret_conv;
39754 }
39755
39756 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
39757         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39758         uint64_t ret_ref = 0;
39759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39761         return ret_ref;
39762 }
39763
39764 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
39765         LDKChannelTypeFeatures this_arg_conv;
39766         this_arg_conv.inner = untag_ptr(this_arg);
39767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39769         this_arg_conv.is_owned = false;
39770         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39771         return ret_conv;
39772 }
39773
39774 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
39775         LDKInitFeatures obj_conv;
39776         obj_conv.inner = untag_ptr(obj);
39777         obj_conv.is_owned = ptr_is_owned(obj);
39778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39779         obj_conv.is_owned = false;
39780         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39781         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39782         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39783         CVec_u8Z_free(ret_var);
39784         return ret_arr;
39785 }
39786
39787 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
39788         LDKu8slice ser_ref;
39789         ser_ref.datalen = ser->arr_len;
39790         ser_ref.data = ser->elems;
39791         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39792         *ret_conv = InitFeatures_read(ser_ref);
39793         FREE(ser);
39794         return tag_ptr(ret_conv, true);
39795 }
39796
39797 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
39798         LDKChannelFeatures obj_conv;
39799         obj_conv.inner = untag_ptr(obj);
39800         obj_conv.is_owned = ptr_is_owned(obj);
39801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39802         obj_conv.is_owned = false;
39803         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39806         CVec_u8Z_free(ret_var);
39807         return ret_arr;
39808 }
39809
39810 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
39811         LDKu8slice ser_ref;
39812         ser_ref.datalen = ser->arr_len;
39813         ser_ref.data = ser->elems;
39814         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39815         *ret_conv = ChannelFeatures_read(ser_ref);
39816         FREE(ser);
39817         return tag_ptr(ret_conv, true);
39818 }
39819
39820 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
39821         LDKNodeFeatures obj_conv;
39822         obj_conv.inner = untag_ptr(obj);
39823         obj_conv.is_owned = ptr_is_owned(obj);
39824         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39825         obj_conv.is_owned = false;
39826         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39829         CVec_u8Z_free(ret_var);
39830         return ret_arr;
39831 }
39832
39833 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
39834         LDKu8slice ser_ref;
39835         ser_ref.datalen = ser->arr_len;
39836         ser_ref.data = ser->elems;
39837         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39838         *ret_conv = NodeFeatures_read(ser_ref);
39839         FREE(ser);
39840         return tag_ptr(ret_conv, true);
39841 }
39842
39843 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
39844         LDKInvoiceFeatures obj_conv;
39845         obj_conv.inner = untag_ptr(obj);
39846         obj_conv.is_owned = ptr_is_owned(obj);
39847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39848         obj_conv.is_owned = false;
39849         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39852         CVec_u8Z_free(ret_var);
39853         return ret_arr;
39854 }
39855
39856 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
39857         LDKu8slice ser_ref;
39858         ser_ref.datalen = ser->arr_len;
39859         ser_ref.data = ser->elems;
39860         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39861         *ret_conv = InvoiceFeatures_read(ser_ref);
39862         FREE(ser);
39863         return tag_ptr(ret_conv, true);
39864 }
39865
39866 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
39867         LDKChannelTypeFeatures obj_conv;
39868         obj_conv.inner = untag_ptr(obj);
39869         obj_conv.is_owned = ptr_is_owned(obj);
39870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39871         obj_conv.is_owned = false;
39872         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39873         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39874         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39875         CVec_u8Z_free(ret_var);
39876         return ret_arr;
39877 }
39878
39879 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
39880         LDKu8slice ser_ref;
39881         ser_ref.datalen = ser->arr_len;
39882         ser_ref.data = ser->elems;
39883         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39884         *ret_conv = ChannelTypeFeatures_read(ser_ref);
39885         FREE(ser);
39886         return tag_ptr(ret_conv, true);
39887 }
39888
39889 int8_tArray  __attribute__((export_name("TS_OfferFeatures_write"))) TS_OfferFeatures_write(uint64_t obj) {
39890         LDKOfferFeatures obj_conv;
39891         obj_conv.inner = untag_ptr(obj);
39892         obj_conv.is_owned = ptr_is_owned(obj);
39893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39894         obj_conv.is_owned = false;
39895         LDKCVec_u8Z ret_var = OfferFeatures_write(&obj_conv);
39896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39898         CVec_u8Z_free(ret_var);
39899         return ret_arr;
39900 }
39901
39902 uint64_t  __attribute__((export_name("TS_OfferFeatures_read"))) TS_OfferFeatures_read(int8_tArray ser) {
39903         LDKu8slice ser_ref;
39904         ser_ref.datalen = ser->arr_len;
39905         ser_ref.data = ser->elems;
39906         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
39907         *ret_conv = OfferFeatures_read(ser_ref);
39908         FREE(ser);
39909         return tag_ptr(ret_conv, true);
39910 }
39911
39912 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFeatures_write"))) TS_InvoiceRequestFeatures_write(uint64_t obj) {
39913         LDKInvoiceRequestFeatures obj_conv;
39914         obj_conv.inner = untag_ptr(obj);
39915         obj_conv.is_owned = ptr_is_owned(obj);
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39917         obj_conv.is_owned = false;
39918         LDKCVec_u8Z ret_var = InvoiceRequestFeatures_write(&obj_conv);
39919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39921         CVec_u8Z_free(ret_var);
39922         return ret_arr;
39923 }
39924
39925 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_read"))) TS_InvoiceRequestFeatures_read(int8_tArray ser) {
39926         LDKu8slice ser_ref;
39927         ser_ref.datalen = ser->arr_len;
39928         ser_ref.data = ser->elems;
39929         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
39930         *ret_conv = InvoiceRequestFeatures_read(ser_ref);
39931         FREE(ser);
39932         return tag_ptr(ret_conv, true);
39933 }
39934
39935 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
39936         LDKInitFeatures this_arg_conv;
39937         this_arg_conv.inner = untag_ptr(this_arg);
39938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39940         this_arg_conv.is_owned = false;
39941         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
39942 }
39943
39944 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
39945         LDKInitFeatures this_arg_conv;
39946         this_arg_conv.inner = untag_ptr(this_arg);
39947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39949         this_arg_conv.is_owned = false;
39950         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
39951 }
39952
39953 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
39954         LDKInitFeatures this_arg_conv;
39955         this_arg_conv.inner = untag_ptr(this_arg);
39956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39958         this_arg_conv.is_owned = false;
39959         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
39960         return ret_conv;
39961 }
39962
39963 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
39964         LDKNodeFeatures this_arg_conv;
39965         this_arg_conv.inner = untag_ptr(this_arg);
39966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39968         this_arg_conv.is_owned = false;
39969         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
39970 }
39971
39972 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
39973         LDKNodeFeatures this_arg_conv;
39974         this_arg_conv.inner = untag_ptr(this_arg);
39975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39977         this_arg_conv.is_owned = false;
39978         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
39979 }
39980
39981 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
39982         LDKNodeFeatures this_arg_conv;
39983         this_arg_conv.inner = untag_ptr(this_arg);
39984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39986         this_arg_conv.is_owned = false;
39987         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
39988         return ret_conv;
39989 }
39990
39991 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
39992         LDKInitFeatures this_arg_conv;
39993         this_arg_conv.inner = untag_ptr(this_arg);
39994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39996         this_arg_conv.is_owned = false;
39997         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
39998         return ret_conv;
39999 }
40000
40001 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40002         LDKNodeFeatures this_arg_conv;
40003         this_arg_conv.inner = untag_ptr(this_arg);
40004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40006         this_arg_conv.is_owned = false;
40007         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40008         return ret_conv;
40009 }
40010
40011 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40012         LDKInitFeatures this_arg_conv;
40013         this_arg_conv.inner = untag_ptr(this_arg);
40014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40016         this_arg_conv.is_owned = false;
40017         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40018 }
40019
40020 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40021         LDKInitFeatures this_arg_conv;
40022         this_arg_conv.inner = untag_ptr(this_arg);
40023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40025         this_arg_conv.is_owned = false;
40026         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40027 }
40028
40029 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40030         LDKInitFeatures this_arg_conv;
40031         this_arg_conv.inner = untag_ptr(this_arg);
40032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40034         this_arg_conv.is_owned = false;
40035         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40036         return ret_conv;
40037 }
40038
40039 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40040         LDKInitFeatures this_arg_conv;
40041         this_arg_conv.inner = untag_ptr(this_arg);
40042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40044         this_arg_conv.is_owned = false;
40045         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40046 }
40047
40048 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40049         LDKInitFeatures this_arg_conv;
40050         this_arg_conv.inner = untag_ptr(this_arg);
40051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40053         this_arg_conv.is_owned = false;
40054         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40055 }
40056
40057 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40058         LDKInitFeatures this_arg_conv;
40059         this_arg_conv.inner = untag_ptr(this_arg);
40060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40062         this_arg_conv.is_owned = false;
40063         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40064         return ret_conv;
40065 }
40066
40067 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40068         LDKNodeFeatures this_arg_conv;
40069         this_arg_conv.inner = untag_ptr(this_arg);
40070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40072         this_arg_conv.is_owned = false;
40073         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40074 }
40075
40076 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40077         LDKNodeFeatures this_arg_conv;
40078         this_arg_conv.inner = untag_ptr(this_arg);
40079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40081         this_arg_conv.is_owned = false;
40082         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40083 }
40084
40085 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40086         LDKNodeFeatures this_arg_conv;
40087         this_arg_conv.inner = untag_ptr(this_arg);
40088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40090         this_arg_conv.is_owned = false;
40091         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40092         return ret_conv;
40093 }
40094
40095 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40096         LDKInitFeatures this_arg_conv;
40097         this_arg_conv.inner = untag_ptr(this_arg);
40098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40100         this_arg_conv.is_owned = false;
40101         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40102         return ret_conv;
40103 }
40104
40105 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40106         LDKNodeFeatures this_arg_conv;
40107         this_arg_conv.inner = untag_ptr(this_arg);
40108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40110         this_arg_conv.is_owned = false;
40111         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40112         return ret_conv;
40113 }
40114
40115 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
40116         LDKInitFeatures this_arg_conv;
40117         this_arg_conv.inner = untag_ptr(this_arg);
40118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40120         this_arg_conv.is_owned = false;
40121         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40122 }
40123
40124 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
40125         LDKInitFeatures this_arg_conv;
40126         this_arg_conv.inner = untag_ptr(this_arg);
40127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40129         this_arg_conv.is_owned = false;
40130         InitFeatures_set_gossip_queries_required(&this_arg_conv);
40131 }
40132
40133 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
40134         LDKInitFeatures this_arg_conv;
40135         this_arg_conv.inner = untag_ptr(this_arg);
40136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40138         this_arg_conv.is_owned = false;
40139         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40140         return ret_conv;
40141 }
40142
40143 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
40144         LDKNodeFeatures this_arg_conv;
40145         this_arg_conv.inner = untag_ptr(this_arg);
40146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40148         this_arg_conv.is_owned = false;
40149         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40150 }
40151
40152 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
40153         LDKNodeFeatures this_arg_conv;
40154         this_arg_conv.inner = untag_ptr(this_arg);
40155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40157         this_arg_conv.is_owned = false;
40158         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40159 }
40160
40161 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
40162         LDKNodeFeatures this_arg_conv;
40163         this_arg_conv.inner = untag_ptr(this_arg);
40164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40166         this_arg_conv.is_owned = false;
40167         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40168         return ret_conv;
40169 }
40170
40171 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
40172         LDKInitFeatures this_arg_conv;
40173         this_arg_conv.inner = untag_ptr(this_arg);
40174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40176         this_arg_conv.is_owned = false;
40177         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40178         return ret_conv;
40179 }
40180
40181 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
40182         LDKNodeFeatures this_arg_conv;
40183         this_arg_conv.inner = untag_ptr(this_arg);
40184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40186         this_arg_conv.is_owned = false;
40187         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40188         return ret_conv;
40189 }
40190
40191 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40192         LDKInitFeatures this_arg_conv;
40193         this_arg_conv.inner = untag_ptr(this_arg);
40194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40196         this_arg_conv.is_owned = false;
40197         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40198 }
40199
40200 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40201         LDKInitFeatures this_arg_conv;
40202         this_arg_conv.inner = untag_ptr(this_arg);
40203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40205         this_arg_conv.is_owned = false;
40206         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40207 }
40208
40209 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
40210         LDKInitFeatures this_arg_conv;
40211         this_arg_conv.inner = untag_ptr(this_arg);
40212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40214         this_arg_conv.is_owned = false;
40215         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40216         return ret_conv;
40217 }
40218
40219 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40220         LDKNodeFeatures this_arg_conv;
40221         this_arg_conv.inner = untag_ptr(this_arg);
40222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40224         this_arg_conv.is_owned = false;
40225         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40226 }
40227
40228 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40229         LDKNodeFeatures this_arg_conv;
40230         this_arg_conv.inner = untag_ptr(this_arg);
40231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40233         this_arg_conv.is_owned = false;
40234         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40235 }
40236
40237 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
40238         LDKNodeFeatures this_arg_conv;
40239         this_arg_conv.inner = untag_ptr(this_arg);
40240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40242         this_arg_conv.is_owned = false;
40243         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40244         return ret_conv;
40245 }
40246
40247 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40248         LDKInvoiceFeatures this_arg_conv;
40249         this_arg_conv.inner = untag_ptr(this_arg);
40250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40252         this_arg_conv.is_owned = false;
40253         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40254 }
40255
40256 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40257         LDKInvoiceFeatures this_arg_conv;
40258         this_arg_conv.inner = untag_ptr(this_arg);
40259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40261         this_arg_conv.is_owned = false;
40262         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40263 }
40264
40265 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
40266         LDKInvoiceFeatures this_arg_conv;
40267         this_arg_conv.inner = untag_ptr(this_arg);
40268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40270         this_arg_conv.is_owned = false;
40271         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40272         return ret_conv;
40273 }
40274
40275 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
40276         LDKInitFeatures this_arg_conv;
40277         this_arg_conv.inner = untag_ptr(this_arg);
40278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40280         this_arg_conv.is_owned = false;
40281         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40282         return ret_conv;
40283 }
40284
40285 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
40286         LDKNodeFeatures this_arg_conv;
40287         this_arg_conv.inner = untag_ptr(this_arg);
40288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40290         this_arg_conv.is_owned = false;
40291         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40292         return ret_conv;
40293 }
40294
40295 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
40296         LDKInvoiceFeatures this_arg_conv;
40297         this_arg_conv.inner = untag_ptr(this_arg);
40298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40300         this_arg_conv.is_owned = false;
40301         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40302         return ret_conv;
40303 }
40304
40305 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40306         LDKInitFeatures this_arg_conv;
40307         this_arg_conv.inner = untag_ptr(this_arg);
40308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40310         this_arg_conv.is_owned = false;
40311         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40312 }
40313
40314 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
40315         LDKInitFeatures this_arg_conv;
40316         this_arg_conv.inner = untag_ptr(this_arg);
40317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40319         this_arg_conv.is_owned = false;
40320         InitFeatures_set_static_remote_key_required(&this_arg_conv);
40321 }
40322
40323 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
40324         LDKInitFeatures this_arg_conv;
40325         this_arg_conv.inner = untag_ptr(this_arg);
40326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40328         this_arg_conv.is_owned = false;
40329         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40330         return ret_conv;
40331 }
40332
40333 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40334         LDKNodeFeatures this_arg_conv;
40335         this_arg_conv.inner = untag_ptr(this_arg);
40336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40338         this_arg_conv.is_owned = false;
40339         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40340 }
40341
40342 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
40343         LDKNodeFeatures this_arg_conv;
40344         this_arg_conv.inner = untag_ptr(this_arg);
40345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40347         this_arg_conv.is_owned = false;
40348         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40349 }
40350
40351 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
40352         LDKNodeFeatures this_arg_conv;
40353         this_arg_conv.inner = untag_ptr(this_arg);
40354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40356         this_arg_conv.is_owned = false;
40357         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40358         return ret_conv;
40359 }
40360
40361 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40362         LDKChannelTypeFeatures this_arg_conv;
40363         this_arg_conv.inner = untag_ptr(this_arg);
40364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40366         this_arg_conv.is_owned = false;
40367         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40368 }
40369
40370 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
40371         LDKChannelTypeFeatures this_arg_conv;
40372         this_arg_conv.inner = untag_ptr(this_arg);
40373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40375         this_arg_conv.is_owned = false;
40376         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40377 }
40378
40379 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
40380         LDKChannelTypeFeatures this_arg_conv;
40381         this_arg_conv.inner = untag_ptr(this_arg);
40382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40384         this_arg_conv.is_owned = false;
40385         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40386         return ret_conv;
40387 }
40388
40389 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
40390         LDKInitFeatures this_arg_conv;
40391         this_arg_conv.inner = untag_ptr(this_arg);
40392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40394         this_arg_conv.is_owned = false;
40395         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40396         return ret_conv;
40397 }
40398
40399 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
40400         LDKNodeFeatures this_arg_conv;
40401         this_arg_conv.inner = untag_ptr(this_arg);
40402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40404         this_arg_conv.is_owned = false;
40405         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40406         return ret_conv;
40407 }
40408
40409 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
40410         LDKChannelTypeFeatures this_arg_conv;
40411         this_arg_conv.inner = untag_ptr(this_arg);
40412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40414         this_arg_conv.is_owned = false;
40415         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40416         return ret_conv;
40417 }
40418
40419 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
40420         LDKInitFeatures this_arg_conv;
40421         this_arg_conv.inner = untag_ptr(this_arg);
40422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40424         this_arg_conv.is_owned = false;
40425         InitFeatures_set_payment_secret_optional(&this_arg_conv);
40426 }
40427
40428 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
40429         LDKInitFeatures this_arg_conv;
40430         this_arg_conv.inner = untag_ptr(this_arg);
40431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40433         this_arg_conv.is_owned = false;
40434         InitFeatures_set_payment_secret_required(&this_arg_conv);
40435 }
40436
40437 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
40438         LDKInitFeatures this_arg_conv;
40439         this_arg_conv.inner = untag_ptr(this_arg);
40440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40442         this_arg_conv.is_owned = false;
40443         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40444         return ret_conv;
40445 }
40446
40447 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
40448         LDKNodeFeatures this_arg_conv;
40449         this_arg_conv.inner = untag_ptr(this_arg);
40450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40452         this_arg_conv.is_owned = false;
40453         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40454 }
40455
40456 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
40457         LDKNodeFeatures this_arg_conv;
40458         this_arg_conv.inner = untag_ptr(this_arg);
40459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40461         this_arg_conv.is_owned = false;
40462         NodeFeatures_set_payment_secret_required(&this_arg_conv);
40463 }
40464
40465 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
40466         LDKNodeFeatures this_arg_conv;
40467         this_arg_conv.inner = untag_ptr(this_arg);
40468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40470         this_arg_conv.is_owned = false;
40471         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40472         return ret_conv;
40473 }
40474
40475 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
40476         LDKInvoiceFeatures this_arg_conv;
40477         this_arg_conv.inner = untag_ptr(this_arg);
40478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40480         this_arg_conv.is_owned = false;
40481         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40482 }
40483
40484 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
40485         LDKInvoiceFeatures this_arg_conv;
40486         this_arg_conv.inner = untag_ptr(this_arg);
40487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40489         this_arg_conv.is_owned = false;
40490         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40491 }
40492
40493 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
40494         LDKInvoiceFeatures this_arg_conv;
40495         this_arg_conv.inner = untag_ptr(this_arg);
40496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40498         this_arg_conv.is_owned = false;
40499         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40500         return ret_conv;
40501 }
40502
40503 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
40504         LDKInitFeatures this_arg_conv;
40505         this_arg_conv.inner = untag_ptr(this_arg);
40506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40508         this_arg_conv.is_owned = false;
40509         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40510         return ret_conv;
40511 }
40512
40513 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
40514         LDKNodeFeatures this_arg_conv;
40515         this_arg_conv.inner = untag_ptr(this_arg);
40516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40518         this_arg_conv.is_owned = false;
40519         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40520         return ret_conv;
40521 }
40522
40523 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
40524         LDKInvoiceFeatures this_arg_conv;
40525         this_arg_conv.inner = untag_ptr(this_arg);
40526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40528         this_arg_conv.is_owned = false;
40529         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40530         return ret_conv;
40531 }
40532
40533 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40534         LDKInitFeatures this_arg_conv;
40535         this_arg_conv.inner = untag_ptr(this_arg);
40536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40538         this_arg_conv.is_owned = false;
40539         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40540 }
40541
40542 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
40543         LDKInitFeatures this_arg_conv;
40544         this_arg_conv.inner = untag_ptr(this_arg);
40545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40547         this_arg_conv.is_owned = false;
40548         InitFeatures_set_basic_mpp_required(&this_arg_conv);
40549 }
40550
40551 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
40552         LDKInitFeatures this_arg_conv;
40553         this_arg_conv.inner = untag_ptr(this_arg);
40554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40556         this_arg_conv.is_owned = false;
40557         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40558         return ret_conv;
40559 }
40560
40561 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40562         LDKNodeFeatures this_arg_conv;
40563         this_arg_conv.inner = untag_ptr(this_arg);
40564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40566         this_arg_conv.is_owned = false;
40567         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40568 }
40569
40570 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
40571         LDKNodeFeatures this_arg_conv;
40572         this_arg_conv.inner = untag_ptr(this_arg);
40573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40575         this_arg_conv.is_owned = false;
40576         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40577 }
40578
40579 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
40580         LDKNodeFeatures this_arg_conv;
40581         this_arg_conv.inner = untag_ptr(this_arg);
40582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40584         this_arg_conv.is_owned = false;
40585         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40586         return ret_conv;
40587 }
40588
40589 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40590         LDKInvoiceFeatures this_arg_conv;
40591         this_arg_conv.inner = untag_ptr(this_arg);
40592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40594         this_arg_conv.is_owned = false;
40595         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40596 }
40597
40598 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
40599         LDKInvoiceFeatures this_arg_conv;
40600         this_arg_conv.inner = untag_ptr(this_arg);
40601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40603         this_arg_conv.is_owned = false;
40604         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40605 }
40606
40607 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
40608         LDKInvoiceFeatures this_arg_conv;
40609         this_arg_conv.inner = untag_ptr(this_arg);
40610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40612         this_arg_conv.is_owned = false;
40613         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40614         return ret_conv;
40615 }
40616
40617 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
40618         LDKInitFeatures this_arg_conv;
40619         this_arg_conv.inner = untag_ptr(this_arg);
40620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40622         this_arg_conv.is_owned = false;
40623         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40624         return ret_conv;
40625 }
40626
40627 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
40628         LDKNodeFeatures this_arg_conv;
40629         this_arg_conv.inner = untag_ptr(this_arg);
40630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40632         this_arg_conv.is_owned = false;
40633         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40634         return ret_conv;
40635 }
40636
40637 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
40638         LDKInvoiceFeatures this_arg_conv;
40639         this_arg_conv.inner = untag_ptr(this_arg);
40640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40642         this_arg_conv.is_owned = false;
40643         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40644         return ret_conv;
40645 }
40646
40647 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
40648         LDKInitFeatures this_arg_conv;
40649         this_arg_conv.inner = untag_ptr(this_arg);
40650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40652         this_arg_conv.is_owned = false;
40653         InitFeatures_set_wumbo_optional(&this_arg_conv);
40654 }
40655
40656 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
40657         LDKInitFeatures this_arg_conv;
40658         this_arg_conv.inner = untag_ptr(this_arg);
40659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40661         this_arg_conv.is_owned = false;
40662         InitFeatures_set_wumbo_required(&this_arg_conv);
40663 }
40664
40665 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
40666         LDKInitFeatures this_arg_conv;
40667         this_arg_conv.inner = untag_ptr(this_arg);
40668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40670         this_arg_conv.is_owned = false;
40671         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40672         return ret_conv;
40673 }
40674
40675 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
40676         LDKNodeFeatures this_arg_conv;
40677         this_arg_conv.inner = untag_ptr(this_arg);
40678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40680         this_arg_conv.is_owned = false;
40681         NodeFeatures_set_wumbo_optional(&this_arg_conv);
40682 }
40683
40684 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
40685         LDKNodeFeatures this_arg_conv;
40686         this_arg_conv.inner = untag_ptr(this_arg);
40687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40689         this_arg_conv.is_owned = false;
40690         NodeFeatures_set_wumbo_required(&this_arg_conv);
40691 }
40692
40693 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
40694         LDKNodeFeatures this_arg_conv;
40695         this_arg_conv.inner = untag_ptr(this_arg);
40696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40698         this_arg_conv.is_owned = false;
40699         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40700         return ret_conv;
40701 }
40702
40703 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
40704         LDKInitFeatures this_arg_conv;
40705         this_arg_conv.inner = untag_ptr(this_arg);
40706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40708         this_arg_conv.is_owned = false;
40709         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40710         return ret_conv;
40711 }
40712
40713 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
40714         LDKNodeFeatures this_arg_conv;
40715         this_arg_conv.inner = untag_ptr(this_arg);
40716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40718         this_arg_conv.is_owned = false;
40719         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40720         return ret_conv;
40721 }
40722
40723 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
40724         LDKInitFeatures this_arg_conv;
40725         this_arg_conv.inner = untag_ptr(this_arg);
40726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40728         this_arg_conv.is_owned = false;
40729         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40730 }
40731
40732 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
40733         LDKInitFeatures this_arg_conv;
40734         this_arg_conv.inner = untag_ptr(this_arg);
40735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40737         this_arg_conv.is_owned = false;
40738         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40739 }
40740
40741 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
40742         LDKInitFeatures this_arg_conv;
40743         this_arg_conv.inner = untag_ptr(this_arg);
40744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40746         this_arg_conv.is_owned = false;
40747         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40748         return ret_conv;
40749 }
40750
40751 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
40752         LDKNodeFeatures this_arg_conv;
40753         this_arg_conv.inner = untag_ptr(this_arg);
40754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40756         this_arg_conv.is_owned = false;
40757         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40758 }
40759
40760 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
40761         LDKNodeFeatures this_arg_conv;
40762         this_arg_conv.inner = untag_ptr(this_arg);
40763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40765         this_arg_conv.is_owned = false;
40766         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40767 }
40768
40769 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
40770         LDKNodeFeatures this_arg_conv;
40771         this_arg_conv.inner = untag_ptr(this_arg);
40772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40774         this_arg_conv.is_owned = false;
40775         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40776         return ret_conv;
40777 }
40778
40779 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
40780         LDKInitFeatures this_arg_conv;
40781         this_arg_conv.inner = untag_ptr(this_arg);
40782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40784         this_arg_conv.is_owned = false;
40785         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40786         return ret_conv;
40787 }
40788
40789 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
40790         LDKNodeFeatures this_arg_conv;
40791         this_arg_conv.inner = untag_ptr(this_arg);
40792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40794         this_arg_conv.is_owned = false;
40795         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40796         return ret_conv;
40797 }
40798
40799 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
40800         LDKInitFeatures this_arg_conv;
40801         this_arg_conv.inner = untag_ptr(this_arg);
40802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40804         this_arg_conv.is_owned = false;
40805         InitFeatures_set_onion_messages_optional(&this_arg_conv);
40806 }
40807
40808 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
40809         LDKInitFeatures this_arg_conv;
40810         this_arg_conv.inner = untag_ptr(this_arg);
40811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40813         this_arg_conv.is_owned = false;
40814         InitFeatures_set_onion_messages_required(&this_arg_conv);
40815 }
40816
40817 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
40818         LDKInitFeatures this_arg_conv;
40819         this_arg_conv.inner = untag_ptr(this_arg);
40820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40822         this_arg_conv.is_owned = false;
40823         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
40824         return ret_conv;
40825 }
40826
40827 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
40828         LDKNodeFeatures this_arg_conv;
40829         this_arg_conv.inner = untag_ptr(this_arg);
40830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40832         this_arg_conv.is_owned = false;
40833         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
40834 }
40835
40836 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
40837         LDKNodeFeatures this_arg_conv;
40838         this_arg_conv.inner = untag_ptr(this_arg);
40839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40841         this_arg_conv.is_owned = false;
40842         NodeFeatures_set_onion_messages_required(&this_arg_conv);
40843 }
40844
40845 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
40846         LDKNodeFeatures this_arg_conv;
40847         this_arg_conv.inner = untag_ptr(this_arg);
40848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40850         this_arg_conv.is_owned = false;
40851         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
40852         return ret_conv;
40853 }
40854
40855 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
40856         LDKInitFeatures this_arg_conv;
40857         this_arg_conv.inner = untag_ptr(this_arg);
40858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40860         this_arg_conv.is_owned = false;
40861         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
40862         return ret_conv;
40863 }
40864
40865 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
40866         LDKNodeFeatures this_arg_conv;
40867         this_arg_conv.inner = untag_ptr(this_arg);
40868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40870         this_arg_conv.is_owned = false;
40871         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
40872         return ret_conv;
40873 }
40874
40875 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
40876         LDKInitFeatures this_arg_conv;
40877         this_arg_conv.inner = untag_ptr(this_arg);
40878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40880         this_arg_conv.is_owned = false;
40881         InitFeatures_set_channel_type_optional(&this_arg_conv);
40882 }
40883
40884 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
40885         LDKInitFeatures this_arg_conv;
40886         this_arg_conv.inner = untag_ptr(this_arg);
40887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40889         this_arg_conv.is_owned = false;
40890         InitFeatures_set_channel_type_required(&this_arg_conv);
40891 }
40892
40893 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
40894         LDKInitFeatures this_arg_conv;
40895         this_arg_conv.inner = untag_ptr(this_arg);
40896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40898         this_arg_conv.is_owned = false;
40899         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
40900         return ret_conv;
40901 }
40902
40903 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
40904         LDKNodeFeatures this_arg_conv;
40905         this_arg_conv.inner = untag_ptr(this_arg);
40906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40908         this_arg_conv.is_owned = false;
40909         NodeFeatures_set_channel_type_optional(&this_arg_conv);
40910 }
40911
40912 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
40913         LDKNodeFeatures this_arg_conv;
40914         this_arg_conv.inner = untag_ptr(this_arg);
40915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40917         this_arg_conv.is_owned = false;
40918         NodeFeatures_set_channel_type_required(&this_arg_conv);
40919 }
40920
40921 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
40922         LDKNodeFeatures this_arg_conv;
40923         this_arg_conv.inner = untag_ptr(this_arg);
40924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40926         this_arg_conv.is_owned = false;
40927         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
40928         return ret_conv;
40929 }
40930
40931 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
40932         LDKInitFeatures this_arg_conv;
40933         this_arg_conv.inner = untag_ptr(this_arg);
40934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936         this_arg_conv.is_owned = false;
40937         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
40938         return ret_conv;
40939 }
40940
40941 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
40942         LDKNodeFeatures this_arg_conv;
40943         this_arg_conv.inner = untag_ptr(this_arg);
40944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40946         this_arg_conv.is_owned = false;
40947         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
40948         return ret_conv;
40949 }
40950
40951 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
40952         LDKInitFeatures this_arg_conv;
40953         this_arg_conv.inner = untag_ptr(this_arg);
40954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40956         this_arg_conv.is_owned = false;
40957         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
40958 }
40959
40960 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
40961         LDKInitFeatures this_arg_conv;
40962         this_arg_conv.inner = untag_ptr(this_arg);
40963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40965         this_arg_conv.is_owned = false;
40966         InitFeatures_set_scid_privacy_required(&this_arg_conv);
40967 }
40968
40969 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
40970         LDKInitFeatures this_arg_conv;
40971         this_arg_conv.inner = untag_ptr(this_arg);
40972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40974         this_arg_conv.is_owned = false;
40975         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
40976         return ret_conv;
40977 }
40978
40979 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
40980         LDKNodeFeatures this_arg_conv;
40981         this_arg_conv.inner = untag_ptr(this_arg);
40982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40984         this_arg_conv.is_owned = false;
40985         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
40986 }
40987
40988 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
40989         LDKNodeFeatures this_arg_conv;
40990         this_arg_conv.inner = untag_ptr(this_arg);
40991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40993         this_arg_conv.is_owned = false;
40994         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
40995 }
40996
40997 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
40998         LDKNodeFeatures this_arg_conv;
40999         this_arg_conv.inner = untag_ptr(this_arg);
41000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41002         this_arg_conv.is_owned = false;
41003         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
41004         return ret_conv;
41005 }
41006
41007 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
41008         LDKChannelTypeFeatures this_arg_conv;
41009         this_arg_conv.inner = untag_ptr(this_arg);
41010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41012         this_arg_conv.is_owned = false;
41013         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
41014 }
41015
41016 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
41017         LDKChannelTypeFeatures this_arg_conv;
41018         this_arg_conv.inner = untag_ptr(this_arg);
41019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41021         this_arg_conv.is_owned = false;
41022         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
41023 }
41024
41025 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
41026         LDKChannelTypeFeatures this_arg_conv;
41027         this_arg_conv.inner = untag_ptr(this_arg);
41028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41030         this_arg_conv.is_owned = false;
41031         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
41032         return ret_conv;
41033 }
41034
41035 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
41036         LDKInitFeatures this_arg_conv;
41037         this_arg_conv.inner = untag_ptr(this_arg);
41038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41040         this_arg_conv.is_owned = false;
41041         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
41042         return ret_conv;
41043 }
41044
41045 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
41046         LDKNodeFeatures this_arg_conv;
41047         this_arg_conv.inner = untag_ptr(this_arg);
41048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41050         this_arg_conv.is_owned = false;
41051         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
41052         return ret_conv;
41053 }
41054
41055 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
41056         LDKChannelTypeFeatures this_arg_conv;
41057         this_arg_conv.inner = untag_ptr(this_arg);
41058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41060         this_arg_conv.is_owned = false;
41061         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
41062         return ret_conv;
41063 }
41064
41065 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
41066         LDKInitFeatures this_arg_conv;
41067         this_arg_conv.inner = untag_ptr(this_arg);
41068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41070         this_arg_conv.is_owned = false;
41071         InitFeatures_set_zero_conf_optional(&this_arg_conv);
41072 }
41073
41074 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
41075         LDKInitFeatures this_arg_conv;
41076         this_arg_conv.inner = untag_ptr(this_arg);
41077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41079         this_arg_conv.is_owned = false;
41080         InitFeatures_set_zero_conf_required(&this_arg_conv);
41081 }
41082
41083 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
41084         LDKInitFeatures this_arg_conv;
41085         this_arg_conv.inner = untag_ptr(this_arg);
41086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41088         this_arg_conv.is_owned = false;
41089         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
41090         return ret_conv;
41091 }
41092
41093 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
41094         LDKNodeFeatures this_arg_conv;
41095         this_arg_conv.inner = untag_ptr(this_arg);
41096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41098         this_arg_conv.is_owned = false;
41099         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
41100 }
41101
41102 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
41103         LDKNodeFeatures this_arg_conv;
41104         this_arg_conv.inner = untag_ptr(this_arg);
41105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41107         this_arg_conv.is_owned = false;
41108         NodeFeatures_set_zero_conf_required(&this_arg_conv);
41109 }
41110
41111 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
41112         LDKNodeFeatures this_arg_conv;
41113         this_arg_conv.inner = untag_ptr(this_arg);
41114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41116         this_arg_conv.is_owned = false;
41117         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41118         return ret_conv;
41119 }
41120
41121 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
41122         LDKChannelTypeFeatures this_arg_conv;
41123         this_arg_conv.inner = untag_ptr(this_arg);
41124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41126         this_arg_conv.is_owned = false;
41127         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41128 }
41129
41130 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
41131         LDKChannelTypeFeatures this_arg_conv;
41132         this_arg_conv.inner = untag_ptr(this_arg);
41133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41135         this_arg_conv.is_owned = false;
41136         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41137 }
41138
41139 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
41140         LDKChannelTypeFeatures this_arg_conv;
41141         this_arg_conv.inner = untag_ptr(this_arg);
41142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41144         this_arg_conv.is_owned = false;
41145         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41146         return ret_conv;
41147 }
41148
41149 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
41150         LDKInitFeatures this_arg_conv;
41151         this_arg_conv.inner = untag_ptr(this_arg);
41152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41154         this_arg_conv.is_owned = false;
41155         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41156         return ret_conv;
41157 }
41158
41159 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
41160         LDKNodeFeatures this_arg_conv;
41161         this_arg_conv.inner = untag_ptr(this_arg);
41162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41164         this_arg_conv.is_owned = false;
41165         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41166         return ret_conv;
41167 }
41168
41169 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
41170         LDKChannelTypeFeatures this_arg_conv;
41171         this_arg_conv.inner = untag_ptr(this_arg);
41172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174         this_arg_conv.is_owned = false;
41175         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41176         return ret_conv;
41177 }
41178
41179 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
41180         LDKNodeFeatures this_arg_conv;
41181         this_arg_conv.inner = untag_ptr(this_arg);
41182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41184         this_arg_conv.is_owned = false;
41185         NodeFeatures_set_keysend_optional(&this_arg_conv);
41186 }
41187
41188 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
41189         LDKNodeFeatures this_arg_conv;
41190         this_arg_conv.inner = untag_ptr(this_arg);
41191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41193         this_arg_conv.is_owned = false;
41194         NodeFeatures_set_keysend_required(&this_arg_conv);
41195 }
41196
41197 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
41198         LDKNodeFeatures this_arg_conv;
41199         this_arg_conv.inner = untag_ptr(this_arg);
41200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41202         this_arg_conv.is_owned = false;
41203         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41204         return ret_conv;
41205 }
41206
41207 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
41208         LDKNodeFeatures this_arg_conv;
41209         this_arg_conv.inner = untag_ptr(this_arg);
41210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41212         this_arg_conv.is_owned = false;
41213         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41214         return ret_conv;
41215 }
41216
41217 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
41218         LDKShutdownScript this_obj_conv;
41219         this_obj_conv.inner = untag_ptr(this_obj);
41220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41222         ShutdownScript_free(this_obj_conv);
41223 }
41224
41225 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41226         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41227         uint64_t ret_ref = 0;
41228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41230         return ret_ref;
41231 }
41232 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
41233         LDKShutdownScript arg_conv;
41234         arg_conv.inner = untag_ptr(arg);
41235         arg_conv.is_owned = ptr_is_owned(arg);
41236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41237         arg_conv.is_owned = false;
41238         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41239         return ret_conv;
41240 }
41241
41242 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
41243         LDKShutdownScript orig_conv;
41244         orig_conv.inner = untag_ptr(orig);
41245         orig_conv.is_owned = ptr_is_owned(orig);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41247         orig_conv.is_owned = false;
41248         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41249         uint64_t ret_ref = 0;
41250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41252         return ret_ref;
41253 }
41254
41255 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
41256         LDKShutdownScript a_conv;
41257         a_conv.inner = untag_ptr(a);
41258         a_conv.is_owned = ptr_is_owned(a);
41259         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41260         a_conv.is_owned = false;
41261         LDKShutdownScript b_conv;
41262         b_conv.inner = untag_ptr(b);
41263         b_conv.is_owned = ptr_is_owned(b);
41264         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41265         b_conv.is_owned = false;
41266         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
41267         return ret_conv;
41268 }
41269
41270 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
41271         LDKInvalidShutdownScript this_obj_conv;
41272         this_obj_conv.inner = untag_ptr(this_obj);
41273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41275         InvalidShutdownScript_free(this_obj_conv);
41276 }
41277
41278 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
41279         LDKInvalidShutdownScript this_ptr_conv;
41280         this_ptr_conv.inner = untag_ptr(this_ptr);
41281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41283         this_ptr_conv.is_owned = false;
41284         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41285         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41286         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41287         return ret_arr;
41288 }
41289
41290 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
41291         LDKInvalidShutdownScript 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         LDKCVec_u8Z val_ref;
41297         val_ref.datalen = val->arr_len;
41298         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41299         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41300         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41301 }
41302
41303 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
41304         LDKCVec_u8Z script_arg_ref;
41305         script_arg_ref.datalen = script_arg->arr_len;
41306         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41307         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
41308         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41309         uint64_t ret_ref = 0;
41310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41312         return ret_ref;
41313 }
41314
41315 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41316         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41317         uint64_t ret_ref = 0;
41318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41320         return ret_ref;
41321 }
41322 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
41323         LDKInvalidShutdownScript arg_conv;
41324         arg_conv.inner = untag_ptr(arg);
41325         arg_conv.is_owned = ptr_is_owned(arg);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41327         arg_conv.is_owned = false;
41328         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41329         return ret_conv;
41330 }
41331
41332 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
41333         LDKInvalidShutdownScript orig_conv;
41334         orig_conv.inner = untag_ptr(orig);
41335         orig_conv.is_owned = ptr_is_owned(orig);
41336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41337         orig_conv.is_owned = false;
41338         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41339         uint64_t ret_ref = 0;
41340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41342         return ret_ref;
41343 }
41344
41345 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
41346         LDKShutdownScript obj_conv;
41347         obj_conv.inner = untag_ptr(obj);
41348         obj_conv.is_owned = ptr_is_owned(obj);
41349         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41350         obj_conv.is_owned = false;
41351         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41352         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41353         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41354         CVec_u8Z_free(ret_var);
41355         return ret_arr;
41356 }
41357
41358 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
41359         LDKu8slice ser_ref;
41360         ser_ref.datalen = ser->arr_len;
41361         ser_ref.data = ser->elems;
41362         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41363         *ret_conv = ShutdownScript_read(ser_ref);
41364         FREE(ser);
41365         return tag_ptr(ret_conv, true);
41366 }
41367
41368 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
41369         unsigned char pubkey_hash_arr[20];
41370         CHECK(pubkey_hash->arr_len == 20);
41371         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
41372         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41373         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41374         uint64_t ret_ref = 0;
41375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41377         return ret_ref;
41378 }
41379
41380 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
41381         unsigned char script_hash_arr[32];
41382         CHECK(script_hash->arr_len == 32);
41383         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
41384         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41385         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41386         uint64_t ret_ref = 0;
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41389         return ret_ref;
41390 }
41391
41392 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
41393         
41394         LDKu8slice program_ref;
41395         program_ref.datalen = program->arr_len;
41396         program_ref.data = program->elems;
41397         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41398         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41399         FREE(program);
41400         return tag_ptr(ret_conv, true);
41401 }
41402
41403 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
41404         LDKShutdownScript this_arg_conv;
41405         this_arg_conv.inner = untag_ptr(this_arg);
41406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41408         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41409         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41410         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41411         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41412         CVec_u8Z_free(ret_var);
41413         return ret_arr;
41414 }
41415
41416 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
41417         LDKShutdownScript this_arg_conv;
41418         this_arg_conv.inner = untag_ptr(this_arg);
41419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41421         this_arg_conv.is_owned = false;
41422         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41423         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
41424         return ret_arr;
41425 }
41426
41427 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
41428         LDKShutdownScript this_arg_conv;
41429         this_arg_conv.inner = untag_ptr(this_arg);
41430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41432         this_arg_conv.is_owned = false;
41433         LDKInitFeatures features_conv;
41434         features_conv.inner = untag_ptr(features);
41435         features_conv.is_owned = ptr_is_owned(features);
41436         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41437         features_conv.is_owned = false;
41438         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41439         return ret_conv;
41440 }
41441
41442 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
41443         if (!ptr_is_owned(this_ptr)) return;
41444         void* this_ptr_ptr = untag_ptr(this_ptr);
41445         CHECK_ACCESS(this_ptr_ptr);
41446         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41447         FREE(untag_ptr(this_ptr));
41448         CustomMessageReader_free(this_ptr_conv);
41449 }
41450
41451 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41452         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41453         *ret_ret = Type_clone(arg);
41454         return tag_ptr(ret_ret, true);
41455 }
41456 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
41457         void* arg_ptr = untag_ptr(arg);
41458         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41459         LDKType* arg_conv = (LDKType*)arg_ptr;
41460         int64_t ret_conv = Type_clone_ptr(arg_conv);
41461         return ret_conv;
41462 }
41463
41464 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
41465         void* orig_ptr = untag_ptr(orig);
41466         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41467         LDKType* orig_conv = (LDKType*)orig_ptr;
41468         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41469         *ret_ret = Type_clone(orig_conv);
41470         return tag_ptr(ret_ret, true);
41471 }
41472
41473 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
41474         if (!ptr_is_owned(this_ptr)) return;
41475         void* this_ptr_ptr = untag_ptr(this_ptr);
41476         CHECK_ACCESS(this_ptr_ptr);
41477         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41478         FREE(untag_ptr(this_ptr));
41479         Type_free(this_ptr_conv);
41480 }
41481
41482 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
41483         LDKNodeId this_obj_conv;
41484         this_obj_conv.inner = untag_ptr(this_obj);
41485         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41487         NodeId_free(this_obj_conv);
41488 }
41489
41490 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41491         LDKNodeId ret_var = NodeId_clone(arg);
41492         uint64_t ret_ref = 0;
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41495         return ret_ref;
41496 }
41497 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
41498         LDKNodeId arg_conv;
41499         arg_conv.inner = untag_ptr(arg);
41500         arg_conv.is_owned = ptr_is_owned(arg);
41501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41502         arg_conv.is_owned = false;
41503         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41504         return ret_conv;
41505 }
41506
41507 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
41508         LDKNodeId orig_conv;
41509         orig_conv.inner = untag_ptr(orig);
41510         orig_conv.is_owned = ptr_is_owned(orig);
41511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41512         orig_conv.is_owned = false;
41513         LDKNodeId ret_var = NodeId_clone(&orig_conv);
41514         uint64_t ret_ref = 0;
41515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41517         return ret_ref;
41518 }
41519
41520 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
41521         LDKPublicKey pubkey_ref;
41522         CHECK(pubkey->arr_len == 33);
41523         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41524         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41525         uint64_t ret_ref = 0;
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41528         return ret_ref;
41529 }
41530
41531 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
41532         LDKNodeId this_arg_conv;
41533         this_arg_conv.inner = untag_ptr(this_arg);
41534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41536         this_arg_conv.is_owned = false;
41537         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41538         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41539         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41540         return ret_arr;
41541 }
41542
41543 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
41544         LDKNodeId o_conv;
41545         o_conv.inner = untag_ptr(o);
41546         o_conv.is_owned = ptr_is_owned(o);
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41548         o_conv.is_owned = false;
41549         int64_t ret_conv = NodeId_hash(&o_conv);
41550         return ret_conv;
41551 }
41552
41553 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
41554         LDKNodeId obj_conv;
41555         obj_conv.inner = untag_ptr(obj);
41556         obj_conv.is_owned = ptr_is_owned(obj);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41558         obj_conv.is_owned = false;
41559         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41562         CVec_u8Z_free(ret_var);
41563         return ret_arr;
41564 }
41565
41566 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
41567         LDKu8slice ser_ref;
41568         ser_ref.datalen = ser->arr_len;
41569         ser_ref.data = ser->elems;
41570         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41571         *ret_conv = NodeId_read(ser_ref);
41572         FREE(ser);
41573         return tag_ptr(ret_conv, true);
41574 }
41575
41576 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
41577         LDKNetworkGraph this_obj_conv;
41578         this_obj_conv.inner = untag_ptr(this_obj);
41579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41581         NetworkGraph_free(this_obj_conv);
41582 }
41583
41584 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
41585         LDKReadOnlyNetworkGraph this_obj_conv;
41586         this_obj_conv.inner = untag_ptr(this_obj);
41587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41589         ReadOnlyNetworkGraph_free(this_obj_conv);
41590 }
41591
41592 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
41593         if (!ptr_is_owned(this_ptr)) return;
41594         void* this_ptr_ptr = untag_ptr(this_ptr);
41595         CHECK_ACCESS(this_ptr_ptr);
41596         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41597         FREE(untag_ptr(this_ptr));
41598         NetworkUpdate_free(this_ptr_conv);
41599 }
41600
41601 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41602         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41603         *ret_copy = NetworkUpdate_clone(arg);
41604         uint64_t ret_ref = tag_ptr(ret_copy, true);
41605         return ret_ref;
41606 }
41607 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
41608         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
41609         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41610         return ret_conv;
41611 }
41612
41613 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
41614         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
41615         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41616         *ret_copy = NetworkUpdate_clone(orig_conv);
41617         uint64_t ret_ref = tag_ptr(ret_copy, true);
41618         return ret_ref;
41619 }
41620
41621 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
41622         LDKChannelUpdate msg_conv;
41623         msg_conv.inner = untag_ptr(msg);
41624         msg_conv.is_owned = ptr_is_owned(msg);
41625         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41626         msg_conv = ChannelUpdate_clone(&msg_conv);
41627         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41628         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41629         uint64_t ret_ref = tag_ptr(ret_copy, true);
41630         return ret_ref;
41631 }
41632
41633 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
41634         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41635         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41636         uint64_t ret_ref = tag_ptr(ret_copy, true);
41637         return ret_ref;
41638 }
41639
41640 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
41641         LDKPublicKey node_id_ref;
41642         CHECK(node_id->arr_len == 33);
41643         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
41644         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41645         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41646         uint64_t ret_ref = tag_ptr(ret_copy, true);
41647         return ret_ref;
41648 }
41649
41650 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
41651         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
41652         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
41653         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
41654         return ret_conv;
41655 }
41656
41657 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
41658         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
41659         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41662         CVec_u8Z_free(ret_var);
41663         return ret_arr;
41664 }
41665
41666 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
41667         LDKu8slice ser_ref;
41668         ser_ref.datalen = ser->arr_len;
41669         ser_ref.data = ser->elems;
41670         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41671         *ret_conv = NetworkUpdate_read(ser_ref);
41672         FREE(ser);
41673         return tag_ptr(ret_conv, true);
41674 }
41675
41676 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
41677         LDKP2PGossipSync this_obj_conv;
41678         this_obj_conv.inner = untag_ptr(this_obj);
41679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41681         P2PGossipSync_free(this_obj_conv);
41682 }
41683
41684 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
41685         LDKNetworkGraph network_graph_conv;
41686         network_graph_conv.inner = untag_ptr(network_graph);
41687         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41688         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41689         network_graph_conv.is_owned = false;
41690         void* chain_access_ptr = untag_ptr(chain_access);
41691         CHECK_ACCESS(chain_access_ptr);
41692         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41693         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41694         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41695                 // Manually implement clone for Java trait instances
41696                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41697                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41698                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41699                 }
41700         }
41701         void* logger_ptr = untag_ptr(logger);
41702         CHECK_ACCESS(logger_ptr);
41703         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41704         if (logger_conv.free == LDKLogger_JCalls_free) {
41705                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41706                 LDKLogger_JCalls_cloned(&logger_conv);
41707         }
41708         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41709         uint64_t ret_ref = 0;
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41712         return ret_ref;
41713 }
41714
41715 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
41716         LDKP2PGossipSync this_arg_conv;
41717         this_arg_conv.inner = untag_ptr(this_arg);
41718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41720         this_arg_conv.is_owned = false;
41721         void* chain_access_ptr = untag_ptr(chain_access);
41722         CHECK_ACCESS(chain_access_ptr);
41723         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41724         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41725         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41726                 // Manually implement clone for Java trait instances
41727                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41728                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41729                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41730                 }
41731         }
41732         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41733 }
41734
41735 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
41736         LDKNetworkGraph this_arg_conv;
41737         this_arg_conv.inner = untag_ptr(this_arg);
41738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41740         this_arg_conv.is_owned = false;
41741         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
41742         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
41743 }
41744
41745 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
41746         LDKP2PGossipSync this_arg_conv;
41747         this_arg_conv.inner = untag_ptr(this_arg);
41748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41750         this_arg_conv.is_owned = false;
41751         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41752         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41753         return tag_ptr(ret_ret, true);
41754 }
41755
41756 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
41757         LDKP2PGossipSync this_arg_conv;
41758         this_arg_conv.inner = untag_ptr(this_arg);
41759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41761         this_arg_conv.is_owned = false;
41762         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41763         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41764         return tag_ptr(ret_ret, true);
41765 }
41766
41767 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
41768         LDKChannelUpdateInfo this_obj_conv;
41769         this_obj_conv.inner = untag_ptr(this_obj);
41770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41772         ChannelUpdateInfo_free(this_obj_conv);
41773 }
41774
41775 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
41776         LDKChannelUpdateInfo this_ptr_conv;
41777         this_ptr_conv.inner = untag_ptr(this_ptr);
41778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41780         this_ptr_conv.is_owned = false;
41781         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41782         return ret_conv;
41783 }
41784
41785 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
41786         LDKChannelUpdateInfo this_ptr_conv;
41787         this_ptr_conv.inner = untag_ptr(this_ptr);
41788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41790         this_ptr_conv.is_owned = false;
41791         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41792 }
41793
41794 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
41795         LDKChannelUpdateInfo this_ptr_conv;
41796         this_ptr_conv.inner = untag_ptr(this_ptr);
41797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41799         this_ptr_conv.is_owned = false;
41800         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41801         return ret_conv;
41802 }
41803
41804 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
41805         LDKChannelUpdateInfo this_ptr_conv;
41806         this_ptr_conv.inner = untag_ptr(this_ptr);
41807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41809         this_ptr_conv.is_owned = false;
41810         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41811 }
41812
41813 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
41814         LDKChannelUpdateInfo this_ptr_conv;
41815         this_ptr_conv.inner = untag_ptr(this_ptr);
41816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41818         this_ptr_conv.is_owned = false;
41819         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41820         return ret_conv;
41821 }
41822
41823 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
41824         LDKChannelUpdateInfo this_ptr_conv;
41825         this_ptr_conv.inner = untag_ptr(this_ptr);
41826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41828         this_ptr_conv.is_owned = false;
41829         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41830 }
41831
41832 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
41833         LDKChannelUpdateInfo this_ptr_conv;
41834         this_ptr_conv.inner = untag_ptr(this_ptr);
41835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41837         this_ptr_conv.is_owned = false;
41838         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41839         return ret_conv;
41840 }
41841
41842 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41843         LDKChannelUpdateInfo this_ptr_conv;
41844         this_ptr_conv.inner = untag_ptr(this_ptr);
41845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41847         this_ptr_conv.is_owned = false;
41848         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41849 }
41850
41851 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
41852         LDKChannelUpdateInfo this_ptr_conv;
41853         this_ptr_conv.inner = untag_ptr(this_ptr);
41854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41856         this_ptr_conv.is_owned = false;
41857         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41858         return ret_conv;
41859 }
41860
41861 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
41862         LDKChannelUpdateInfo this_ptr_conv;
41863         this_ptr_conv.inner = untag_ptr(this_ptr);
41864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41866         this_ptr_conv.is_owned = false;
41867         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
41868 }
41869
41870 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
41871         LDKChannelUpdateInfo this_ptr_conv;
41872         this_ptr_conv.inner = untag_ptr(this_ptr);
41873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41875         this_ptr_conv.is_owned = false;
41876         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
41877         uint64_t ret_ref = 0;
41878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41880         return ret_ref;
41881 }
41882
41883 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
41884         LDKChannelUpdateInfo this_ptr_conv;
41885         this_ptr_conv.inner = untag_ptr(this_ptr);
41886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41888         this_ptr_conv.is_owned = false;
41889         LDKRoutingFees val_conv;
41890         val_conv.inner = untag_ptr(val);
41891         val_conv.is_owned = ptr_is_owned(val);
41892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41893         val_conv = RoutingFees_clone(&val_conv);
41894         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
41895 }
41896
41897 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
41898         LDKChannelUpdateInfo this_ptr_conv;
41899         this_ptr_conv.inner = untag_ptr(this_ptr);
41900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41902         this_ptr_conv.is_owned = false;
41903         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
41904         uint64_t ret_ref = 0;
41905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41907         return ret_ref;
41908 }
41909
41910 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
41911         LDKChannelUpdateInfo this_ptr_conv;
41912         this_ptr_conv.inner = untag_ptr(this_ptr);
41913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41915         this_ptr_conv.is_owned = false;
41916         LDKChannelUpdate val_conv;
41917         val_conv.inner = untag_ptr(val);
41918         val_conv.is_owned = ptr_is_owned(val);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41920         val_conv = ChannelUpdate_clone(&val_conv);
41921         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
41922 }
41923
41924 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) {
41925         LDKRoutingFees fees_arg_conv;
41926         fees_arg_conv.inner = untag_ptr(fees_arg);
41927         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41928         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41929         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41930         LDKChannelUpdate last_update_message_arg_conv;
41931         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
41932         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
41933         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
41934         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
41935         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);
41936         uint64_t ret_ref = 0;
41937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41939         return ret_ref;
41940 }
41941
41942 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
41943         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
41944         uint64_t ret_ref = 0;
41945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41947         return ret_ref;
41948 }
41949 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
41950         LDKChannelUpdateInfo arg_conv;
41951         arg_conv.inner = untag_ptr(arg);
41952         arg_conv.is_owned = ptr_is_owned(arg);
41953         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41954         arg_conv.is_owned = false;
41955         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
41956         return ret_conv;
41957 }
41958
41959 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
41960         LDKChannelUpdateInfo orig_conv;
41961         orig_conv.inner = untag_ptr(orig);
41962         orig_conv.is_owned = ptr_is_owned(orig);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41964         orig_conv.is_owned = false;
41965         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
41966         uint64_t ret_ref = 0;
41967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41969         return ret_ref;
41970 }
41971
41972 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
41973         LDKChannelUpdateInfo a_conv;
41974         a_conv.inner = untag_ptr(a);
41975         a_conv.is_owned = ptr_is_owned(a);
41976         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41977         a_conv.is_owned = false;
41978         LDKChannelUpdateInfo b_conv;
41979         b_conv.inner = untag_ptr(b);
41980         b_conv.is_owned = ptr_is_owned(b);
41981         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41982         b_conv.is_owned = false;
41983         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
41984         return ret_conv;
41985 }
41986
41987 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
41988         LDKChannelUpdateInfo obj_conv;
41989         obj_conv.inner = untag_ptr(obj);
41990         obj_conv.is_owned = ptr_is_owned(obj);
41991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41992         obj_conv.is_owned = false;
41993         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
41994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41996         CVec_u8Z_free(ret_var);
41997         return ret_arr;
41998 }
41999
42000 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
42001         LDKu8slice ser_ref;
42002         ser_ref.datalen = ser->arr_len;
42003         ser_ref.data = ser->elems;
42004         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
42005         *ret_conv = ChannelUpdateInfo_read(ser_ref);
42006         FREE(ser);
42007         return tag_ptr(ret_conv, true);
42008 }
42009
42010 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
42011         LDKChannelInfo this_obj_conv;
42012         this_obj_conv.inner = untag_ptr(this_obj);
42013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42015         ChannelInfo_free(this_obj_conv);
42016 }
42017
42018 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
42019         LDKChannelInfo this_ptr_conv;
42020         this_ptr_conv.inner = untag_ptr(this_ptr);
42021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42023         this_ptr_conv.is_owned = false;
42024         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
42025         uint64_t ret_ref = 0;
42026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42028         return ret_ref;
42029 }
42030
42031 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
42032         LDKChannelInfo this_ptr_conv;
42033         this_ptr_conv.inner = untag_ptr(this_ptr);
42034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42036         this_ptr_conv.is_owned = false;
42037         LDKChannelFeatures val_conv;
42038         val_conv.inner = untag_ptr(val);
42039         val_conv.is_owned = ptr_is_owned(val);
42040         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42041         val_conv = ChannelFeatures_clone(&val_conv);
42042         ChannelInfo_set_features(&this_ptr_conv, val_conv);
42043 }
42044
42045 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
42046         LDKChannelInfo this_ptr_conv;
42047         this_ptr_conv.inner = untag_ptr(this_ptr);
42048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42050         this_ptr_conv.is_owned = false;
42051         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
42052         uint64_t ret_ref = 0;
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42055         return ret_ref;
42056 }
42057
42058 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
42059         LDKChannelInfo this_ptr_conv;
42060         this_ptr_conv.inner = untag_ptr(this_ptr);
42061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42063         this_ptr_conv.is_owned = false;
42064         LDKNodeId val_conv;
42065         val_conv.inner = untag_ptr(val);
42066         val_conv.is_owned = ptr_is_owned(val);
42067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42068         val_conv = NodeId_clone(&val_conv);
42069         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
42070 }
42071
42072 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
42073         LDKChannelInfo this_ptr_conv;
42074         this_ptr_conv.inner = untag_ptr(this_ptr);
42075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42077         this_ptr_conv.is_owned = false;
42078         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
42079         uint64_t ret_ref = 0;
42080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42082         return ret_ref;
42083 }
42084
42085 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
42086         LDKChannelInfo this_ptr_conv;
42087         this_ptr_conv.inner = untag_ptr(this_ptr);
42088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42090         this_ptr_conv.is_owned = false;
42091         LDKChannelUpdateInfo val_conv;
42092         val_conv.inner = untag_ptr(val);
42093         val_conv.is_owned = ptr_is_owned(val);
42094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42095         val_conv = ChannelUpdateInfo_clone(&val_conv);
42096         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
42097 }
42098
42099 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
42100         LDKChannelInfo this_ptr_conv;
42101         this_ptr_conv.inner = untag_ptr(this_ptr);
42102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42104         this_ptr_conv.is_owned = false;
42105         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
42106         uint64_t ret_ref = 0;
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42109         return ret_ref;
42110 }
42111
42112 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
42113         LDKChannelInfo this_ptr_conv;
42114         this_ptr_conv.inner = untag_ptr(this_ptr);
42115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42117         this_ptr_conv.is_owned = false;
42118         LDKNodeId val_conv;
42119         val_conv.inner = untag_ptr(val);
42120         val_conv.is_owned = ptr_is_owned(val);
42121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42122         val_conv = NodeId_clone(&val_conv);
42123         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
42124 }
42125
42126 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
42127         LDKChannelInfo this_ptr_conv;
42128         this_ptr_conv.inner = untag_ptr(this_ptr);
42129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42131         this_ptr_conv.is_owned = false;
42132         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
42133         uint64_t ret_ref = 0;
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42136         return ret_ref;
42137 }
42138
42139 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
42140         LDKChannelInfo this_ptr_conv;
42141         this_ptr_conv.inner = untag_ptr(this_ptr);
42142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42144         this_ptr_conv.is_owned = false;
42145         LDKChannelUpdateInfo val_conv;
42146         val_conv.inner = untag_ptr(val);
42147         val_conv.is_owned = ptr_is_owned(val);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42149         val_conv = ChannelUpdateInfo_clone(&val_conv);
42150         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42151 }
42152
42153 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
42154         LDKChannelInfo this_ptr_conv;
42155         this_ptr_conv.inner = untag_ptr(this_ptr);
42156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42158         this_ptr_conv.is_owned = false;
42159         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42160         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42161         uint64_t ret_ref = tag_ptr(ret_copy, true);
42162         return ret_ref;
42163 }
42164
42165 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
42166         LDKChannelInfo this_ptr_conv;
42167         this_ptr_conv.inner = untag_ptr(this_ptr);
42168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42170         this_ptr_conv.is_owned = false;
42171         void* val_ptr = untag_ptr(val);
42172         CHECK_ACCESS(val_ptr);
42173         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42174         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42175         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42176 }
42177
42178 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
42179         LDKChannelInfo this_ptr_conv;
42180         this_ptr_conv.inner = untag_ptr(this_ptr);
42181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42183         this_ptr_conv.is_owned = false;
42184         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42185         uint64_t ret_ref = 0;
42186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42188         return ret_ref;
42189 }
42190
42191 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
42192         LDKChannelInfo this_ptr_conv;
42193         this_ptr_conv.inner = untag_ptr(this_ptr);
42194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42196         this_ptr_conv.is_owned = false;
42197         LDKChannelAnnouncement val_conv;
42198         val_conv.inner = untag_ptr(val);
42199         val_conv.is_owned = ptr_is_owned(val);
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42201         val_conv = ChannelAnnouncement_clone(&val_conv);
42202         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42203 }
42204
42205 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42206         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42207         uint64_t ret_ref = 0;
42208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42210         return ret_ref;
42211 }
42212 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
42213         LDKChannelInfo arg_conv;
42214         arg_conv.inner = untag_ptr(arg);
42215         arg_conv.is_owned = ptr_is_owned(arg);
42216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42217         arg_conv.is_owned = false;
42218         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42219         return ret_conv;
42220 }
42221
42222 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
42223         LDKChannelInfo orig_conv;
42224         orig_conv.inner = untag_ptr(orig);
42225         orig_conv.is_owned = ptr_is_owned(orig);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42227         orig_conv.is_owned = false;
42228         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42229         uint64_t ret_ref = 0;
42230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42232         return ret_ref;
42233 }
42234
42235 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
42236         LDKChannelInfo a_conv;
42237         a_conv.inner = untag_ptr(a);
42238         a_conv.is_owned = ptr_is_owned(a);
42239         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42240         a_conv.is_owned = false;
42241         LDKChannelInfo b_conv;
42242         b_conv.inner = untag_ptr(b);
42243         b_conv.is_owned = ptr_is_owned(b);
42244         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42245         b_conv.is_owned = false;
42246         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
42247         return ret_conv;
42248 }
42249
42250 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
42251         LDKChannelInfo this_arg_conv;
42252         this_arg_conv.inner = untag_ptr(this_arg);
42253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42255         this_arg_conv.is_owned = false;
42256         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42257         uint64_t ret_ref = 0;
42258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42260         return ret_ref;
42261 }
42262
42263 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
42264         LDKChannelInfo obj_conv;
42265         obj_conv.inner = untag_ptr(obj);
42266         obj_conv.is_owned = ptr_is_owned(obj);
42267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42268         obj_conv.is_owned = false;
42269         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42270         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42271         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42272         CVec_u8Z_free(ret_var);
42273         return ret_arr;
42274 }
42275
42276 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
42277         LDKu8slice ser_ref;
42278         ser_ref.datalen = ser->arr_len;
42279         ser_ref.data = ser->elems;
42280         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42281         *ret_conv = ChannelInfo_read(ser_ref);
42282         FREE(ser);
42283         return tag_ptr(ret_conv, true);
42284 }
42285
42286 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
42287         LDKDirectedChannelInfo this_obj_conv;
42288         this_obj_conv.inner = untag_ptr(this_obj);
42289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42291         DirectedChannelInfo_free(this_obj_conv);
42292 }
42293
42294 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42295         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
42296         uint64_t ret_ref = 0;
42297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42299         return ret_ref;
42300 }
42301 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
42302         LDKDirectedChannelInfo arg_conv;
42303         arg_conv.inner = untag_ptr(arg);
42304         arg_conv.is_owned = ptr_is_owned(arg);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42306         arg_conv.is_owned = false;
42307         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
42308         return ret_conv;
42309 }
42310
42311 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
42312         LDKDirectedChannelInfo orig_conv;
42313         orig_conv.inner = untag_ptr(orig);
42314         orig_conv.is_owned = ptr_is_owned(orig);
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42316         orig_conv.is_owned = false;
42317         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
42318         uint64_t ret_ref = 0;
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42321         return ret_ref;
42322 }
42323
42324 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
42325         LDKDirectedChannelInfo this_arg_conv;
42326         this_arg_conv.inner = untag_ptr(this_arg);
42327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42329         this_arg_conv.is_owned = false;
42330         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42331         uint64_t ret_ref = 0;
42332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42334         return ret_ref;
42335 }
42336
42337 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
42338         LDKDirectedChannelInfo this_arg_conv;
42339         this_arg_conv.inner = untag_ptr(this_arg);
42340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42342         this_arg_conv.is_owned = false;
42343         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42344         return ret_conv;
42345 }
42346
42347 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
42348         LDKDirectedChannelInfo this_arg_conv;
42349         this_arg_conv.inner = untag_ptr(this_arg);
42350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42352         this_arg_conv.is_owned = false;
42353         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42354         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42355         uint64_t ret_ref = tag_ptr(ret_copy, true);
42356         return ret_ref;
42357 }
42358
42359 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
42360         if (!ptr_is_owned(this_ptr)) return;
42361         void* this_ptr_ptr = untag_ptr(this_ptr);
42362         CHECK_ACCESS(this_ptr_ptr);
42363         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42364         FREE(untag_ptr(this_ptr));
42365         EffectiveCapacity_free(this_ptr_conv);
42366 }
42367
42368 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42369         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42370         *ret_copy = EffectiveCapacity_clone(arg);
42371         uint64_t ret_ref = tag_ptr(ret_copy, true);
42372         return ret_ref;
42373 }
42374 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
42375         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
42376         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42377         return ret_conv;
42378 }
42379
42380 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
42381         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
42382         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42383         *ret_copy = EffectiveCapacity_clone(orig_conv);
42384         uint64_t ret_ref = tag_ptr(ret_copy, true);
42385         return ret_ref;
42386 }
42387
42388 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
42389         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42390         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42391         uint64_t ret_ref = tag_ptr(ret_copy, true);
42392         return ret_ref;
42393 }
42394
42395 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
42396         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42397         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42398         uint64_t ret_ref = tag_ptr(ret_copy, true);
42399         return ret_ref;
42400 }
42401
42402 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
42403         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42404         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
42405         uint64_t ret_ref = tag_ptr(ret_copy, true);
42406         return ret_ref;
42407 }
42408
42409 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
42410         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42411         *ret_copy = EffectiveCapacity_infinite();
42412         uint64_t ret_ref = tag_ptr(ret_copy, true);
42413         return ret_ref;
42414 }
42415
42416 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
42417         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42418         *ret_copy = EffectiveCapacity_unknown();
42419         uint64_t ret_ref = tag_ptr(ret_copy, true);
42420         return ret_ref;
42421 }
42422
42423 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
42424         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
42425         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42426         return ret_conv;
42427 }
42428
42429 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
42430         LDKRoutingFees this_obj_conv;
42431         this_obj_conv.inner = untag_ptr(this_obj);
42432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42434         RoutingFees_free(this_obj_conv);
42435 }
42436
42437 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
42438         LDKRoutingFees this_ptr_conv;
42439         this_ptr_conv.inner = untag_ptr(this_ptr);
42440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42442         this_ptr_conv.is_owned = false;
42443         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42444         return ret_conv;
42445 }
42446
42447 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
42448         LDKRoutingFees this_ptr_conv;
42449         this_ptr_conv.inner = untag_ptr(this_ptr);
42450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42452         this_ptr_conv.is_owned = false;
42453         RoutingFees_set_base_msat(&this_ptr_conv, val);
42454 }
42455
42456 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
42457         LDKRoutingFees this_ptr_conv;
42458         this_ptr_conv.inner = untag_ptr(this_ptr);
42459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42461         this_ptr_conv.is_owned = false;
42462         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42463         return ret_conv;
42464 }
42465
42466 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
42467         LDKRoutingFees this_ptr_conv;
42468         this_ptr_conv.inner = untag_ptr(this_ptr);
42469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42471         this_ptr_conv.is_owned = false;
42472         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42473 }
42474
42475 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
42476         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42477         uint64_t ret_ref = 0;
42478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42480         return ret_ref;
42481 }
42482
42483 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
42484         LDKRoutingFees a_conv;
42485         a_conv.inner = untag_ptr(a);
42486         a_conv.is_owned = ptr_is_owned(a);
42487         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42488         a_conv.is_owned = false;
42489         LDKRoutingFees b_conv;
42490         b_conv.inner = untag_ptr(b);
42491         b_conv.is_owned = ptr_is_owned(b);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42493         b_conv.is_owned = false;
42494         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42495         return ret_conv;
42496 }
42497
42498 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42499         LDKRoutingFees ret_var = RoutingFees_clone(arg);
42500         uint64_t ret_ref = 0;
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42503         return ret_ref;
42504 }
42505 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
42506         LDKRoutingFees arg_conv;
42507         arg_conv.inner = untag_ptr(arg);
42508         arg_conv.is_owned = ptr_is_owned(arg);
42509         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42510         arg_conv.is_owned = false;
42511         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42512         return ret_conv;
42513 }
42514
42515 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
42516         LDKRoutingFees orig_conv;
42517         orig_conv.inner = untag_ptr(orig);
42518         orig_conv.is_owned = ptr_is_owned(orig);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42520         orig_conv.is_owned = false;
42521         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42522         uint64_t ret_ref = 0;
42523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42525         return ret_ref;
42526 }
42527
42528 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
42529         LDKRoutingFees o_conv;
42530         o_conv.inner = untag_ptr(o);
42531         o_conv.is_owned = ptr_is_owned(o);
42532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42533         o_conv.is_owned = false;
42534         int64_t ret_conv = RoutingFees_hash(&o_conv);
42535         return ret_conv;
42536 }
42537
42538 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
42539         LDKRoutingFees obj_conv;
42540         obj_conv.inner = untag_ptr(obj);
42541         obj_conv.is_owned = ptr_is_owned(obj);
42542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42543         obj_conv.is_owned = false;
42544         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42547         CVec_u8Z_free(ret_var);
42548         return ret_arr;
42549 }
42550
42551 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
42552         LDKu8slice ser_ref;
42553         ser_ref.datalen = ser->arr_len;
42554         ser_ref.data = ser->elems;
42555         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42556         *ret_conv = RoutingFees_read(ser_ref);
42557         FREE(ser);
42558         return tag_ptr(ret_conv, true);
42559 }
42560
42561 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
42562         LDKNodeAnnouncementInfo this_obj_conv;
42563         this_obj_conv.inner = untag_ptr(this_obj);
42564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42566         NodeAnnouncementInfo_free(this_obj_conv);
42567 }
42568
42569 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
42570         LDKNodeAnnouncementInfo this_ptr_conv;
42571         this_ptr_conv.inner = untag_ptr(this_ptr);
42572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42574         this_ptr_conv.is_owned = false;
42575         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42576         uint64_t ret_ref = 0;
42577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42579         return ret_ref;
42580 }
42581
42582 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
42583         LDKNodeAnnouncementInfo this_ptr_conv;
42584         this_ptr_conv.inner = untag_ptr(this_ptr);
42585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42587         this_ptr_conv.is_owned = false;
42588         LDKNodeFeatures val_conv;
42589         val_conv.inner = untag_ptr(val);
42590         val_conv.is_owned = ptr_is_owned(val);
42591         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42592         val_conv = NodeFeatures_clone(&val_conv);
42593         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42594 }
42595
42596 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
42597         LDKNodeAnnouncementInfo this_ptr_conv;
42598         this_ptr_conv.inner = untag_ptr(this_ptr);
42599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42601         this_ptr_conv.is_owned = false;
42602         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42603         return ret_conv;
42604 }
42605
42606 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
42607         LDKNodeAnnouncementInfo this_ptr_conv;
42608         this_ptr_conv.inner = untag_ptr(this_ptr);
42609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42611         this_ptr_conv.is_owned = false;
42612         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42613 }
42614
42615 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
42616         LDKNodeAnnouncementInfo this_ptr_conv;
42617         this_ptr_conv.inner = untag_ptr(this_ptr);
42618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42620         this_ptr_conv.is_owned = false;
42621         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
42622         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
42623         return ret_arr;
42624 }
42625
42626 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
42627         LDKNodeAnnouncementInfo this_ptr_conv;
42628         this_ptr_conv.inner = untag_ptr(this_ptr);
42629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42631         this_ptr_conv.is_owned = false;
42632         LDKThreeBytes val_ref;
42633         CHECK(val->arr_len == 3);
42634         memcpy(val_ref.data, val->elems, 3); FREE(val);
42635         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42636 }
42637
42638 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
42639         LDKNodeAnnouncementInfo this_ptr_conv;
42640         this_ptr_conv.inner = untag_ptr(this_ptr);
42641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42643         this_ptr_conv.is_owned = false;
42644         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
42645         uint64_t ret_ref = 0;
42646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42648         return ret_ref;
42649 }
42650
42651 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
42652         LDKNodeAnnouncementInfo this_ptr_conv;
42653         this_ptr_conv.inner = untag_ptr(this_ptr);
42654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42656         this_ptr_conv.is_owned = false;
42657         LDKNodeAlias val_conv;
42658         val_conv.inner = untag_ptr(val);
42659         val_conv.is_owned = ptr_is_owned(val);
42660         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42661         val_conv = NodeAlias_clone(&val_conv);
42662         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
42663 }
42664
42665 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
42666         LDKNodeAnnouncementInfo this_ptr_conv;
42667         this_ptr_conv.inner = untag_ptr(this_ptr);
42668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42670         this_ptr_conv.is_owned = false;
42671         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
42672         uint64_tArray ret_arr = NULL;
42673         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42674         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42675         for (size_t m = 0; m < ret_var.datalen; m++) {
42676                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
42677                 *ret_conv_12_copy = ret_var.data[m];
42678                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
42679                 ret_arr_ptr[m] = ret_conv_12_ref;
42680         }
42681         
42682         FREE(ret_var.data);
42683         return ret_arr;
42684 }
42685
42686 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
42687         LDKNodeAnnouncementInfo 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         LDKCVec_NetAddressZ val_constr;
42693         val_constr.datalen = val->arr_len;
42694         if (val_constr.datalen > 0)
42695                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42696         else
42697                 val_constr.data = NULL;
42698         uint64_t* val_vals = val->elems;
42699         for (size_t m = 0; m < val_constr.datalen; m++) {
42700                 uint64_t val_conv_12 = val_vals[m];
42701                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
42702                 CHECK_ACCESS(val_conv_12_ptr);
42703                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42704                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
42705                 val_constr.data[m] = val_conv_12_conv;
42706         }
42707         FREE(val);
42708         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42709 }
42710
42711 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
42712         LDKNodeAnnouncementInfo this_ptr_conv;
42713         this_ptr_conv.inner = untag_ptr(this_ptr);
42714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42716         this_ptr_conv.is_owned = false;
42717         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42718         uint64_t ret_ref = 0;
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42721         return ret_ref;
42722 }
42723
42724 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
42725         LDKNodeAnnouncementInfo this_ptr_conv;
42726         this_ptr_conv.inner = untag_ptr(this_ptr);
42727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42729         this_ptr_conv.is_owned = false;
42730         LDKNodeAnnouncement val_conv;
42731         val_conv.inner = untag_ptr(val);
42732         val_conv.is_owned = ptr_is_owned(val);
42733         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42734         val_conv = NodeAnnouncement_clone(&val_conv);
42735         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42736 }
42737
42738 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) {
42739         LDKNodeFeatures features_arg_conv;
42740         features_arg_conv.inner = untag_ptr(features_arg);
42741         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42743         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42744         LDKThreeBytes rgb_arg_ref;
42745         CHECK(rgb_arg->arr_len == 3);
42746         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
42747         LDKNodeAlias alias_arg_conv;
42748         alias_arg_conv.inner = untag_ptr(alias_arg);
42749         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
42751         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
42752         LDKCVec_NetAddressZ addresses_arg_constr;
42753         addresses_arg_constr.datalen = addresses_arg->arr_len;
42754         if (addresses_arg_constr.datalen > 0)
42755                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42756         else
42757                 addresses_arg_constr.data = NULL;
42758         uint64_t* addresses_arg_vals = addresses_arg->elems;
42759         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42760                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42761                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
42762                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42763                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42764                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42765         }
42766         FREE(addresses_arg);
42767         LDKNodeAnnouncement announcement_message_arg_conv;
42768         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
42769         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42771         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42772         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
42773         uint64_t ret_ref = 0;
42774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42776         return ret_ref;
42777 }
42778
42779 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42780         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
42781         uint64_t ret_ref = 0;
42782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42784         return ret_ref;
42785 }
42786 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
42787         LDKNodeAnnouncementInfo arg_conv;
42788         arg_conv.inner = untag_ptr(arg);
42789         arg_conv.is_owned = ptr_is_owned(arg);
42790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42791         arg_conv.is_owned = false;
42792         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42793         return ret_conv;
42794 }
42795
42796 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
42797         LDKNodeAnnouncementInfo orig_conv;
42798         orig_conv.inner = untag_ptr(orig);
42799         orig_conv.is_owned = ptr_is_owned(orig);
42800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42801         orig_conv.is_owned = false;
42802         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42803         uint64_t ret_ref = 0;
42804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42806         return ret_ref;
42807 }
42808
42809 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
42810         LDKNodeAnnouncementInfo a_conv;
42811         a_conv.inner = untag_ptr(a);
42812         a_conv.is_owned = ptr_is_owned(a);
42813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42814         a_conv.is_owned = false;
42815         LDKNodeAnnouncementInfo b_conv;
42816         b_conv.inner = untag_ptr(b);
42817         b_conv.is_owned = ptr_is_owned(b);
42818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42819         b_conv.is_owned = false;
42820         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
42821         return ret_conv;
42822 }
42823
42824 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
42825         LDKNodeAnnouncementInfo obj_conv;
42826         obj_conv.inner = untag_ptr(obj);
42827         obj_conv.is_owned = ptr_is_owned(obj);
42828         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42829         obj_conv.is_owned = false;
42830         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42833         CVec_u8Z_free(ret_var);
42834         return ret_arr;
42835 }
42836
42837 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
42838         LDKu8slice ser_ref;
42839         ser_ref.datalen = ser->arr_len;
42840         ser_ref.data = ser->elems;
42841         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
42842         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
42843         FREE(ser);
42844         return tag_ptr(ret_conv, true);
42845 }
42846
42847 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
42848         LDKNodeAlias this_obj_conv;
42849         this_obj_conv.inner = untag_ptr(this_obj);
42850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42852         NodeAlias_free(this_obj_conv);
42853 }
42854
42855 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
42856         LDKNodeAlias this_ptr_conv;
42857         this_ptr_conv.inner = untag_ptr(this_ptr);
42858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42860         this_ptr_conv.is_owned = false;
42861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42862         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
42863         return ret_arr;
42864 }
42865
42866 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
42867         LDKNodeAlias this_ptr_conv;
42868         this_ptr_conv.inner = untag_ptr(this_ptr);
42869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42871         this_ptr_conv.is_owned = false;
42872         LDKThirtyTwoBytes val_ref;
42873         CHECK(val->arr_len == 32);
42874         memcpy(val_ref.data, val->elems, 32); FREE(val);
42875         NodeAlias_set_a(&this_ptr_conv, val_ref);
42876 }
42877
42878 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
42879         LDKThirtyTwoBytes a_arg_ref;
42880         CHECK(a_arg->arr_len == 32);
42881         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
42882         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
42883         uint64_t ret_ref = 0;
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42886         return ret_ref;
42887 }
42888
42889 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
42890         LDKNodeAlias ret_var = NodeAlias_clone(arg);
42891         uint64_t ret_ref = 0;
42892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42894         return ret_ref;
42895 }
42896 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
42897         LDKNodeAlias arg_conv;
42898         arg_conv.inner = untag_ptr(arg);
42899         arg_conv.is_owned = ptr_is_owned(arg);
42900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42901         arg_conv.is_owned = false;
42902         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
42903         return ret_conv;
42904 }
42905
42906 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
42907         LDKNodeAlias orig_conv;
42908         orig_conv.inner = untag_ptr(orig);
42909         orig_conv.is_owned = ptr_is_owned(orig);
42910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42911         orig_conv.is_owned = false;
42912         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
42913         uint64_t ret_ref = 0;
42914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42916         return ret_ref;
42917 }
42918
42919 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
42920         LDKNodeAlias a_conv;
42921         a_conv.inner = untag_ptr(a);
42922         a_conv.is_owned = ptr_is_owned(a);
42923         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42924         a_conv.is_owned = false;
42925         LDKNodeAlias b_conv;
42926         b_conv.inner = untag_ptr(b);
42927         b_conv.is_owned = ptr_is_owned(b);
42928         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42929         b_conv.is_owned = false;
42930         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
42931         return ret_conv;
42932 }
42933
42934 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
42935         LDKNodeAlias obj_conv;
42936         obj_conv.inner = untag_ptr(obj);
42937         obj_conv.is_owned = ptr_is_owned(obj);
42938         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42939         obj_conv.is_owned = false;
42940         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
42941         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42942         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42943         CVec_u8Z_free(ret_var);
42944         return ret_arr;
42945 }
42946
42947 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
42948         LDKu8slice ser_ref;
42949         ser_ref.datalen = ser->arr_len;
42950         ser_ref.data = ser->elems;
42951         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
42952         *ret_conv = NodeAlias_read(ser_ref);
42953         FREE(ser);
42954         return tag_ptr(ret_conv, true);
42955 }
42956
42957 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
42958         LDKNodeInfo this_obj_conv;
42959         this_obj_conv.inner = untag_ptr(this_obj);
42960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42962         NodeInfo_free(this_obj_conv);
42963 }
42964
42965 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
42966         LDKNodeInfo this_ptr_conv;
42967         this_ptr_conv.inner = untag_ptr(this_ptr);
42968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42970         this_ptr_conv.is_owned = false;
42971         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
42972         int64_tArray ret_arr = NULL;
42973         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42974         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42975         for (size_t i = 0; i < ret_var.datalen; i++) {
42976                 int64_t ret_conv_8_conv = ret_var.data[i];
42977                 ret_arr_ptr[i] = ret_conv_8_conv;
42978         }
42979         
42980         FREE(ret_var.data);
42981         return ret_arr;
42982 }
42983
42984 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
42985         LDKNodeInfo this_ptr_conv;
42986         this_ptr_conv.inner = untag_ptr(this_ptr);
42987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42989         this_ptr_conv.is_owned = false;
42990         LDKCVec_u64Z val_constr;
42991         val_constr.datalen = val->arr_len;
42992         if (val_constr.datalen > 0)
42993                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42994         else
42995                 val_constr.data = NULL;
42996         int64_t* val_vals = val->elems;
42997         for (size_t i = 0; i < val_constr.datalen; i++) {
42998                 int64_t val_conv_8 = val_vals[i];
42999                 val_constr.data[i] = val_conv_8;
43000         }
43001         FREE(val);
43002         NodeInfo_set_channels(&this_ptr_conv, val_constr);
43003 }
43004
43005 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
43006         LDKNodeInfo this_ptr_conv;
43007         this_ptr_conv.inner = untag_ptr(this_ptr);
43008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43010         this_ptr_conv.is_owned = false;
43011         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
43012         uint64_t ret_ref = 0;
43013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43015         return ret_ref;
43016 }
43017
43018 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) {
43019         LDKNodeInfo this_ptr_conv;
43020         this_ptr_conv.inner = untag_ptr(this_ptr);
43021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43023         this_ptr_conv.is_owned = false;
43024         LDKRoutingFees val_conv;
43025         val_conv.inner = untag_ptr(val);
43026         val_conv.is_owned = ptr_is_owned(val);
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43028         val_conv = RoutingFees_clone(&val_conv);
43029         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
43030 }
43031
43032 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
43033         LDKNodeInfo this_ptr_conv;
43034         this_ptr_conv.inner = untag_ptr(this_ptr);
43035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43037         this_ptr_conv.is_owned = false;
43038         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
43039         uint64_t ret_ref = 0;
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43042         return ret_ref;
43043 }
43044
43045 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
43046         LDKNodeInfo this_ptr_conv;
43047         this_ptr_conv.inner = untag_ptr(this_ptr);
43048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43050         this_ptr_conv.is_owned = false;
43051         LDKNodeAnnouncementInfo val_conv;
43052         val_conv.inner = untag_ptr(val);
43053         val_conv.is_owned = ptr_is_owned(val);
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43055         val_conv = NodeAnnouncementInfo_clone(&val_conv);
43056         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
43057 }
43058
43059 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) {
43060         LDKCVec_u64Z channels_arg_constr;
43061         channels_arg_constr.datalen = channels_arg->arr_len;
43062         if (channels_arg_constr.datalen > 0)
43063                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43064         else
43065                 channels_arg_constr.data = NULL;
43066         int64_t* channels_arg_vals = channels_arg->elems;
43067         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
43068                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
43069                 channels_arg_constr.data[i] = channels_arg_conv_8;
43070         }
43071         FREE(channels_arg);
43072         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
43073         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
43074         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
43076         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
43077         LDKNodeAnnouncementInfo announcement_info_arg_conv;
43078         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
43079         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
43081         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
43082         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
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
43089 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
43090         LDKNodeInfo ret_var = NodeInfo_clone(arg);
43091         uint64_t ret_ref = 0;
43092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43094         return ret_ref;
43095 }
43096 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
43097         LDKNodeInfo arg_conv;
43098         arg_conv.inner = untag_ptr(arg);
43099         arg_conv.is_owned = ptr_is_owned(arg);
43100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43101         arg_conv.is_owned = false;
43102         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
43103         return ret_conv;
43104 }
43105
43106 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
43107         LDKNodeInfo orig_conv;
43108         orig_conv.inner = untag_ptr(orig);
43109         orig_conv.is_owned = ptr_is_owned(orig);
43110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43111         orig_conv.is_owned = false;
43112         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
43113         uint64_t ret_ref = 0;
43114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43116         return ret_ref;
43117 }
43118
43119 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
43120         LDKNodeInfo a_conv;
43121         a_conv.inner = untag_ptr(a);
43122         a_conv.is_owned = ptr_is_owned(a);
43123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43124         a_conv.is_owned = false;
43125         LDKNodeInfo b_conv;
43126         b_conv.inner = untag_ptr(b);
43127         b_conv.is_owned = ptr_is_owned(b);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43129         b_conv.is_owned = false;
43130         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
43131         return ret_conv;
43132 }
43133
43134 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
43135         LDKNodeInfo obj_conv;
43136         obj_conv.inner = untag_ptr(obj);
43137         obj_conv.is_owned = ptr_is_owned(obj);
43138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43139         obj_conv.is_owned = false;
43140         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
43141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43143         CVec_u8Z_free(ret_var);
43144         return ret_arr;
43145 }
43146
43147 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
43148         LDKu8slice ser_ref;
43149         ser_ref.datalen = ser->arr_len;
43150         ser_ref.data = ser->elems;
43151         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
43152         *ret_conv = NodeInfo_read(ser_ref);
43153         FREE(ser);
43154         return tag_ptr(ret_conv, true);
43155 }
43156
43157 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
43158         LDKNetworkGraph obj_conv;
43159         obj_conv.inner = untag_ptr(obj);
43160         obj_conv.is_owned = ptr_is_owned(obj);
43161         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43162         obj_conv.is_owned = false;
43163         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
43164         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43165         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43166         CVec_u8Z_free(ret_var);
43167         return ret_arr;
43168 }
43169
43170 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
43171         LDKu8slice ser_ref;
43172         ser_ref.datalen = ser->arr_len;
43173         ser_ref.data = ser->elems;
43174         void* arg_ptr = untag_ptr(arg);
43175         CHECK_ACCESS(arg_ptr);
43176         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
43177         if (arg_conv.free == LDKLogger_JCalls_free) {
43178                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43179                 LDKLogger_JCalls_cloned(&arg_conv);
43180         }
43181         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
43182         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
43183         FREE(ser);
43184         return tag_ptr(ret_conv, true);
43185 }
43186
43187 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
43188         LDKThirtyTwoBytes genesis_hash_ref;
43189         CHECK(genesis_hash->arr_len == 32);
43190         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
43191         void* logger_ptr = untag_ptr(logger);
43192         CHECK_ACCESS(logger_ptr);
43193         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43194         if (logger_conv.free == LDKLogger_JCalls_free) {
43195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43196                 LDKLogger_JCalls_cloned(&logger_conv);
43197         }
43198         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43199         uint64_t ret_ref = 0;
43200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43202         return ret_ref;
43203 }
43204
43205 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
43206         LDKNetworkGraph this_arg_conv;
43207         this_arg_conv.inner = untag_ptr(this_arg);
43208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43210         this_arg_conv.is_owned = false;
43211         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43212         uint64_t ret_ref = 0;
43213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43215         return ret_ref;
43216 }
43217
43218 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) {
43219         LDKNetworkGraph this_arg_conv;
43220         this_arg_conv.inner = untag_ptr(this_arg);
43221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43223         this_arg_conv.is_owned = false;
43224         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43225         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43226         uint64_t ret_ref = tag_ptr(ret_copy, true);
43227         return ret_ref;
43228 }
43229
43230 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) {
43231         LDKNetworkGraph this_arg_conv;
43232         this_arg_conv.inner = untag_ptr(this_arg);
43233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43235         this_arg_conv.is_owned = false;
43236         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43237 }
43238
43239 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
43240         LDKNetworkGraph this_arg_conv;
43241         this_arg_conv.inner = untag_ptr(this_arg);
43242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43244         this_arg_conv.is_owned = false;
43245         LDKNodeAnnouncement msg_conv;
43246         msg_conv.inner = untag_ptr(msg);
43247         msg_conv.is_owned = ptr_is_owned(msg);
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43249         msg_conv.is_owned = false;
43250         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43251         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43252         return tag_ptr(ret_conv, true);
43253 }
43254
43255 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) {
43256         LDKNetworkGraph this_arg_conv;
43257         this_arg_conv.inner = untag_ptr(this_arg);
43258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43260         this_arg_conv.is_owned = false;
43261         LDKUnsignedNodeAnnouncement msg_conv;
43262         msg_conv.inner = untag_ptr(msg);
43263         msg_conv.is_owned = ptr_is_owned(msg);
43264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43265         msg_conv.is_owned = false;
43266         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43267         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43268         return tag_ptr(ret_conv, true);
43269 }
43270
43271 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) {
43272         LDKNetworkGraph this_arg_conv;
43273         this_arg_conv.inner = untag_ptr(this_arg);
43274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43276         this_arg_conv.is_owned = false;
43277         LDKChannelAnnouncement msg_conv;
43278         msg_conv.inner = untag_ptr(msg);
43279         msg_conv.is_owned = ptr_is_owned(msg);
43280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43281         msg_conv.is_owned = false;
43282         void* chain_access_ptr = untag_ptr(chain_access);
43283         CHECK_ACCESS(chain_access_ptr);
43284         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43285         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43286         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43287                 // Manually implement clone for Java trait instances
43288                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43289                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43290                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43291                 }
43292         }
43293         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43294         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43295         return tag_ptr(ret_conv, true);
43296 }
43297
43298 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) {
43299         LDKNetworkGraph this_arg_conv;
43300         this_arg_conv.inner = untag_ptr(this_arg);
43301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43303         this_arg_conv.is_owned = false;
43304         LDKUnsignedChannelAnnouncement msg_conv;
43305         msg_conv.inner = untag_ptr(msg);
43306         msg_conv.is_owned = ptr_is_owned(msg);
43307         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43308         msg_conv.is_owned = false;
43309         void* chain_access_ptr = untag_ptr(chain_access);
43310         CHECK_ACCESS(chain_access_ptr);
43311         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43312         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43313         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43314                 // Manually implement clone for Java trait instances
43315                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43316                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43317                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43318                 }
43319         }
43320         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43321         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43322         return tag_ptr(ret_conv, true);
43323 }
43324
43325 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) {
43326         LDKNetworkGraph this_arg_conv;
43327         this_arg_conv.inner = untag_ptr(this_arg);
43328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43330         this_arg_conv.is_owned = false;
43331         LDKChannelFeatures features_conv;
43332         features_conv.inner = untag_ptr(features);
43333         features_conv.is_owned = ptr_is_owned(features);
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43335         features_conv = ChannelFeatures_clone(&features_conv);
43336         LDKPublicKey node_id_1_ref;
43337         CHECK(node_id_1->arr_len == 33);
43338         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
43339         LDKPublicKey node_id_2_ref;
43340         CHECK(node_id_2->arr_len == 33);
43341         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
43342         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43343         *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);
43344         return tag_ptr(ret_conv, true);
43345 }
43346
43347 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
43348         LDKNetworkGraph this_arg_conv;
43349         this_arg_conv.inner = untag_ptr(this_arg);
43350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43352         this_arg_conv.is_owned = false;
43353         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43354 }
43355
43356 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
43357         LDKNetworkGraph this_arg_conv;
43358         this_arg_conv.inner = untag_ptr(this_arg);
43359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43361         this_arg_conv.is_owned = false;
43362         LDKPublicKey node_id_ref;
43363         CHECK(node_id->arr_len == 33);
43364         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
43365         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
43366 }
43367
43368 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) {
43369         LDKNetworkGraph this_arg_conv;
43370         this_arg_conv.inner = untag_ptr(this_arg);
43371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43373         this_arg_conv.is_owned = false;
43374         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
43375 }
43376
43377 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
43378         LDKNetworkGraph this_arg_conv;
43379         this_arg_conv.inner = untag_ptr(this_arg);
43380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43382         this_arg_conv.is_owned = false;
43383         LDKChannelUpdate msg_conv;
43384         msg_conv.inner = untag_ptr(msg);
43385         msg_conv.is_owned = ptr_is_owned(msg);
43386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43387         msg_conv.is_owned = false;
43388         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43389         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43390         return tag_ptr(ret_conv, true);
43391 }
43392
43393 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
43394         LDKNetworkGraph this_arg_conv;
43395         this_arg_conv.inner = untag_ptr(this_arg);
43396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43398         this_arg_conv.is_owned = false;
43399         LDKUnsignedChannelUpdate msg_conv;
43400         msg_conv.inner = untag_ptr(msg);
43401         msg_conv.is_owned = ptr_is_owned(msg);
43402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43403         msg_conv.is_owned = false;
43404         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43405         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43406         return tag_ptr(ret_conv, true);
43407 }
43408
43409 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
43410         LDKReadOnlyNetworkGraph this_arg_conv;
43411         this_arg_conv.inner = untag_ptr(this_arg);
43412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43414         this_arg_conv.is_owned = false;
43415         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
43416         uint64_t ret_ref = 0;
43417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43419         return ret_ref;
43420 }
43421
43422 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
43423         LDKReadOnlyNetworkGraph this_arg_conv;
43424         this_arg_conv.inner = untag_ptr(this_arg);
43425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43427         this_arg_conv.is_owned = false;
43428         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
43429         int64_tArray ret_arr = NULL;
43430         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
43431         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43432         for (size_t i = 0; i < ret_var.datalen; i++) {
43433                 int64_t ret_conv_8_conv = ret_var.data[i];
43434                 ret_arr_ptr[i] = ret_conv_8_conv;
43435         }
43436         
43437         FREE(ret_var.data);
43438         return ret_arr;
43439 }
43440
43441 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
43442         LDKReadOnlyNetworkGraph this_arg_conv;
43443         this_arg_conv.inner = untag_ptr(this_arg);
43444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43446         this_arg_conv.is_owned = false;
43447         LDKNodeId node_id_conv;
43448         node_id_conv.inner = untag_ptr(node_id);
43449         node_id_conv.is_owned = ptr_is_owned(node_id);
43450         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43451         node_id_conv.is_owned = false;
43452         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
43453         uint64_t ret_ref = 0;
43454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43456         return ret_ref;
43457 }
43458
43459 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
43460         LDKReadOnlyNetworkGraph this_arg_conv;
43461         this_arg_conv.inner = untag_ptr(this_arg);
43462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43464         this_arg_conv.is_owned = false;
43465         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
43466         uint64_tArray ret_arr = NULL;
43467         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43468         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43469         for (size_t i = 0; i < ret_var.datalen; i++) {
43470                 LDKNodeId ret_conv_8_var = ret_var.data[i];
43471                 uint64_t ret_conv_8_ref = 0;
43472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
43473                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
43474                 ret_arr_ptr[i] = ret_conv_8_ref;
43475         }
43476         
43477         FREE(ret_var.data);
43478         return ret_arr;
43479 }
43480
43481 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
43482         LDKReadOnlyNetworkGraph this_arg_conv;
43483         this_arg_conv.inner = untag_ptr(this_arg);
43484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43486         this_arg_conv.is_owned = false;
43487         LDKPublicKey pubkey_ref;
43488         CHECK(pubkey->arr_len == 33);
43489         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43490         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43491         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43492         uint64_t ret_ref = tag_ptr(ret_copy, true);
43493         return ret_ref;
43494 }
43495
43496 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
43497         LDKDefaultRouter this_obj_conv;
43498         this_obj_conv.inner = untag_ptr(this_obj);
43499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43501         DefaultRouter_free(this_obj_conv);
43502 }
43503
43504 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) {
43505         LDKNetworkGraph network_graph_conv;
43506         network_graph_conv.inner = untag_ptr(network_graph);
43507         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43508         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43509         network_graph_conv.is_owned = false;
43510         void* logger_ptr = untag_ptr(logger);
43511         CHECK_ACCESS(logger_ptr);
43512         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43513         if (logger_conv.free == LDKLogger_JCalls_free) {
43514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43515                 LDKLogger_JCalls_cloned(&logger_conv);
43516         }
43517         LDKThirtyTwoBytes random_seed_bytes_ref;
43518         CHECK(random_seed_bytes->arr_len == 32);
43519         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43520         void* scorer_ptr = untag_ptr(scorer);
43521         CHECK_ACCESS(scorer_ptr);
43522         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
43523         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
43524                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43525                 LDKLockableScore_JCalls_cloned(&scorer_conv);
43526         }
43527         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
43528         uint64_t ret_ref = 0;
43529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43531         return ret_ref;
43532 }
43533
43534 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
43535         LDKDefaultRouter this_arg_conv;
43536         this_arg_conv.inner = untag_ptr(this_arg);
43537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43539         this_arg_conv.is_owned = false;
43540         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
43541         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
43542         return tag_ptr(ret_ret, true);
43543 }
43544
43545 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
43546         if (!ptr_is_owned(this_ptr)) return;
43547         void* this_ptr_ptr = untag_ptr(this_ptr);
43548         CHECK_ACCESS(this_ptr_ptr);
43549         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43550         FREE(untag_ptr(this_ptr));
43551         Router_free(this_ptr_conv);
43552 }
43553
43554 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
43555         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
43556         this_obj_conv.inner = untag_ptr(this_obj);
43557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43559         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
43560 }
43561
43562 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
43563         void* scorer_ptr = untag_ptr(scorer);
43564         CHECK_ACCESS(scorer_ptr);
43565         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
43566         if (scorer_conv.free == LDKScore_JCalls_free) {
43567                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43568                 LDKScore_JCalls_cloned(&scorer_conv);
43569         }
43570         LDKInFlightHtlcs inflight_htlcs_conv;
43571         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
43572         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
43574         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
43575         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, inflight_htlcs_conv);
43576         uint64_t ret_ref = 0;
43577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43579         return ret_ref;
43580 }
43581
43582 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
43583         LDKScorerAccountingForInFlightHtlcs obj_conv;
43584         obj_conv.inner = untag_ptr(obj);
43585         obj_conv.is_owned = ptr_is_owned(obj);
43586         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43587         obj_conv.is_owned = false;
43588         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
43589         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43590         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43591         CVec_u8Z_free(ret_var);
43592         return ret_arr;
43593 }
43594
43595 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
43596         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
43597         this_arg_conv.inner = untag_ptr(this_arg);
43598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43600         this_arg_conv.is_owned = false;
43601         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43602         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
43603         return tag_ptr(ret_ret, true);
43604 }
43605
43606 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
43607         LDKInFlightHtlcs this_obj_conv;
43608         this_obj_conv.inner = untag_ptr(this_obj);
43609         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43611         InFlightHtlcs_free(this_obj_conv);
43612 }
43613
43614 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
43615         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
43616         uint64_t ret_ref = 0;
43617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43619         return ret_ref;
43620 }
43621 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
43622         LDKInFlightHtlcs arg_conv;
43623         arg_conv.inner = untag_ptr(arg);
43624         arg_conv.is_owned = ptr_is_owned(arg);
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43626         arg_conv.is_owned = false;
43627         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
43628         return ret_conv;
43629 }
43630
43631 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
43632         LDKInFlightHtlcs orig_conv;
43633         orig_conv.inner = untag_ptr(orig);
43634         orig_conv.is_owned = ptr_is_owned(orig);
43635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43636         orig_conv.is_owned = false;
43637         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
43638         uint64_t ret_ref = 0;
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43641         return ret_ref;
43642 }
43643
43644 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
43645         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
43646         uint64_t ret_ref = 0;
43647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43649         return ret_ref;
43650 }
43651
43652 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) {
43653         LDKInFlightHtlcs this_arg_conv;
43654         this_arg_conv.inner = untag_ptr(this_arg);
43655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43657         this_arg_conv.is_owned = false;
43658         LDKNodeId source_conv;
43659         source_conv.inner = untag_ptr(source);
43660         source_conv.is_owned = ptr_is_owned(source);
43661         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
43662         source_conv.is_owned = false;
43663         LDKNodeId target_conv;
43664         target_conv.inner = untag_ptr(target);
43665         target_conv.is_owned = ptr_is_owned(target);
43666         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
43667         target_conv.is_owned = false;
43668         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43669         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
43670         uint64_t ret_ref = tag_ptr(ret_copy, true);
43671         return ret_ref;
43672 }
43673
43674 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
43675         LDKInFlightHtlcs obj_conv;
43676         obj_conv.inner = untag_ptr(obj);
43677         obj_conv.is_owned = ptr_is_owned(obj);
43678         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43679         obj_conv.is_owned = false;
43680         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
43681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43683         CVec_u8Z_free(ret_var);
43684         return ret_arr;
43685 }
43686
43687 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
43688         LDKu8slice ser_ref;
43689         ser_ref.datalen = ser->arr_len;
43690         ser_ref.data = ser->elems;
43691         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
43692         *ret_conv = InFlightHtlcs_read(ser_ref);
43693         FREE(ser);
43694         return tag_ptr(ret_conv, true);
43695 }
43696
43697 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
43698         LDKRouteHop this_obj_conv;
43699         this_obj_conv.inner = untag_ptr(this_obj);
43700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43702         RouteHop_free(this_obj_conv);
43703 }
43704
43705 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
43706         LDKRouteHop this_ptr_conv;
43707         this_ptr_conv.inner = untag_ptr(this_ptr);
43708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43710         this_ptr_conv.is_owned = false;
43711         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43712         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
43713         return ret_arr;
43714 }
43715
43716 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
43717         LDKRouteHop this_ptr_conv;
43718         this_ptr_conv.inner = untag_ptr(this_ptr);
43719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43721         this_ptr_conv.is_owned = false;
43722         LDKPublicKey val_ref;
43723         CHECK(val->arr_len == 33);
43724         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43725         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43726 }
43727
43728 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
43729         LDKRouteHop this_ptr_conv;
43730         this_ptr_conv.inner = untag_ptr(this_ptr);
43731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43733         this_ptr_conv.is_owned = false;
43734         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43735         uint64_t ret_ref = 0;
43736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43738         return ret_ref;
43739 }
43740
43741 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
43742         LDKRouteHop this_ptr_conv;
43743         this_ptr_conv.inner = untag_ptr(this_ptr);
43744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43746         this_ptr_conv.is_owned = false;
43747         LDKNodeFeatures val_conv;
43748         val_conv.inner = untag_ptr(val);
43749         val_conv.is_owned = ptr_is_owned(val);
43750         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43751         val_conv = NodeFeatures_clone(&val_conv);
43752         RouteHop_set_node_features(&this_ptr_conv, val_conv);
43753 }
43754
43755 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
43756         LDKRouteHop this_ptr_conv;
43757         this_ptr_conv.inner = untag_ptr(this_ptr);
43758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43760         this_ptr_conv.is_owned = false;
43761         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43762         return ret_conv;
43763 }
43764
43765 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43766         LDKRouteHop this_ptr_conv;
43767         this_ptr_conv.inner = untag_ptr(this_ptr);
43768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43770         this_ptr_conv.is_owned = false;
43771         RouteHop_set_short_channel_id(&this_ptr_conv, val);
43772 }
43773
43774 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
43775         LDKRouteHop this_ptr_conv;
43776         this_ptr_conv.inner = untag_ptr(this_ptr);
43777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43779         this_ptr_conv.is_owned = false;
43780         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43781         uint64_t ret_ref = 0;
43782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43784         return ret_ref;
43785 }
43786
43787 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
43788         LDKRouteHop this_ptr_conv;
43789         this_ptr_conv.inner = untag_ptr(this_ptr);
43790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43792         this_ptr_conv.is_owned = false;
43793         LDKChannelFeatures val_conv;
43794         val_conv.inner = untag_ptr(val);
43795         val_conv.is_owned = ptr_is_owned(val);
43796         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43797         val_conv = ChannelFeatures_clone(&val_conv);
43798         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43799 }
43800
43801 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
43802         LDKRouteHop this_ptr_conv;
43803         this_ptr_conv.inner = untag_ptr(this_ptr);
43804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43806         this_ptr_conv.is_owned = false;
43807         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43808         return ret_conv;
43809 }
43810
43811 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
43812         LDKRouteHop this_ptr_conv;
43813         this_ptr_conv.inner = untag_ptr(this_ptr);
43814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43816         this_ptr_conv.is_owned = false;
43817         RouteHop_set_fee_msat(&this_ptr_conv, val);
43818 }
43819
43820 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
43821         LDKRouteHop this_ptr_conv;
43822         this_ptr_conv.inner = untag_ptr(this_ptr);
43823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43825         this_ptr_conv.is_owned = false;
43826         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43827         return ret_conv;
43828 }
43829
43830 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
43831         LDKRouteHop this_ptr_conv;
43832         this_ptr_conv.inner = untag_ptr(this_ptr);
43833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43835         this_ptr_conv.is_owned = false;
43836         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43837 }
43838
43839 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) {
43840         LDKPublicKey pubkey_arg_ref;
43841         CHECK(pubkey_arg->arr_len == 33);
43842         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
43843         LDKNodeFeatures node_features_arg_conv;
43844         node_features_arg_conv.inner = untag_ptr(node_features_arg);
43845         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43847         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43848         LDKChannelFeatures channel_features_arg_conv;
43849         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
43850         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
43851         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43852         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43853         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);
43854         uint64_t ret_ref = 0;
43855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43857         return ret_ref;
43858 }
43859
43860 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43861         LDKRouteHop ret_var = RouteHop_clone(arg);
43862         uint64_t ret_ref = 0;
43863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43865         return ret_ref;
43866 }
43867 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
43868         LDKRouteHop arg_conv;
43869         arg_conv.inner = untag_ptr(arg);
43870         arg_conv.is_owned = ptr_is_owned(arg);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43872         arg_conv.is_owned = false;
43873         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43874         return ret_conv;
43875 }
43876
43877 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
43878         LDKRouteHop orig_conv;
43879         orig_conv.inner = untag_ptr(orig);
43880         orig_conv.is_owned = ptr_is_owned(orig);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43882         orig_conv.is_owned = false;
43883         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43884         uint64_t ret_ref = 0;
43885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43887         return ret_ref;
43888 }
43889
43890 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
43891         LDKRouteHop o_conv;
43892         o_conv.inner = untag_ptr(o);
43893         o_conv.is_owned = ptr_is_owned(o);
43894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43895         o_conv.is_owned = false;
43896         int64_t ret_conv = RouteHop_hash(&o_conv);
43897         return ret_conv;
43898 }
43899
43900 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
43901         LDKRouteHop a_conv;
43902         a_conv.inner = untag_ptr(a);
43903         a_conv.is_owned = ptr_is_owned(a);
43904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43905         a_conv.is_owned = false;
43906         LDKRouteHop b_conv;
43907         b_conv.inner = untag_ptr(b);
43908         b_conv.is_owned = ptr_is_owned(b);
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43910         b_conv.is_owned = false;
43911         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43912         return ret_conv;
43913 }
43914
43915 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
43916         LDKRouteHop obj_conv;
43917         obj_conv.inner = untag_ptr(obj);
43918         obj_conv.is_owned = ptr_is_owned(obj);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43920         obj_conv.is_owned = false;
43921         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43922         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43923         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43924         CVec_u8Z_free(ret_var);
43925         return ret_arr;
43926 }
43927
43928 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
43929         LDKu8slice ser_ref;
43930         ser_ref.datalen = ser->arr_len;
43931         ser_ref.data = ser->elems;
43932         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43933         *ret_conv = RouteHop_read(ser_ref);
43934         FREE(ser);
43935         return tag_ptr(ret_conv, true);
43936 }
43937
43938 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
43939         LDKRoute this_obj_conv;
43940         this_obj_conv.inner = untag_ptr(this_obj);
43941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43943         Route_free(this_obj_conv);
43944 }
43945
43946 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
43947         LDKRoute this_ptr_conv;
43948         this_ptr_conv.inner = untag_ptr(this_ptr);
43949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43951         this_ptr_conv.is_owned = false;
43952         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43953         ptrArray ret_arr = NULL;
43954         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43955         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
43956         for (size_t m = 0; m < ret_var.datalen; m++) {
43957                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43958                 uint64_tArray ret_conv_12_arr = NULL;
43959                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
43960                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
43961                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43962                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43963                         uint64_t ret_conv_12_conv_10_ref = 0;
43964                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43965                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
43966                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43967                 }
43968                 
43969                 FREE(ret_conv_12_var.data);
43970                 ret_arr_ptr[m] = ret_conv_12_arr;
43971         }
43972         
43973         FREE(ret_var.data);
43974         return ret_arr;
43975 }
43976
43977 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
43978         LDKRoute this_ptr_conv;
43979         this_ptr_conv.inner = untag_ptr(this_ptr);
43980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43982         this_ptr_conv.is_owned = false;
43983         LDKCVec_CVec_RouteHopZZ val_constr;
43984         val_constr.datalen = val->arr_len;
43985         if (val_constr.datalen > 0)
43986                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43987         else
43988                 val_constr.data = NULL;
43989         uint64_tArray* val_vals = (void*) val->elems;
43990         for (size_t m = 0; m < val_constr.datalen; m++) {
43991                 uint64_tArray val_conv_12 = val_vals[m];
43992                 LDKCVec_RouteHopZ val_conv_12_constr;
43993                 val_conv_12_constr.datalen = val_conv_12->arr_len;
43994                 if (val_conv_12_constr.datalen > 0)
43995                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43996                 else
43997                         val_conv_12_constr.data = NULL;
43998                 uint64_t* val_conv_12_vals = val_conv_12->elems;
43999                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
44000                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
44001                         LDKRouteHop val_conv_12_conv_10_conv;
44002                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
44003                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
44004                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
44005                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
44006                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
44007                 }
44008                 FREE(val_conv_12);
44009                 val_constr.data[m] = val_conv_12_constr;
44010         }
44011         FREE(val);
44012         Route_set_paths(&this_ptr_conv, val_constr);
44013 }
44014
44015 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
44016         LDKRoute this_ptr_conv;
44017         this_ptr_conv.inner = untag_ptr(this_ptr);
44018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44020         this_ptr_conv.is_owned = false;
44021         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
44022         uint64_t ret_ref = 0;
44023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44025         return ret_ref;
44026 }
44027
44028 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
44029         LDKRoute this_ptr_conv;
44030         this_ptr_conv.inner = untag_ptr(this_ptr);
44031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44033         this_ptr_conv.is_owned = false;
44034         LDKPaymentParameters val_conv;
44035         val_conv.inner = untag_ptr(val);
44036         val_conv.is_owned = ptr_is_owned(val);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44038         val_conv = PaymentParameters_clone(&val_conv);
44039         Route_set_payment_params(&this_ptr_conv, val_conv);
44040 }
44041
44042 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
44043         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
44044         paths_arg_constr.datalen = paths_arg->arr_len;
44045         if (paths_arg_constr.datalen > 0)
44046                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
44047         else
44048                 paths_arg_constr.data = NULL;
44049         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
44050         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
44051                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
44052                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
44053                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
44054                 if (paths_arg_conv_12_constr.datalen > 0)
44055                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
44056                 else
44057                         paths_arg_conv_12_constr.data = NULL;
44058                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
44059                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
44060                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
44061                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
44062                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
44063                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
44064                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
44065                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
44066                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
44067                 }
44068                 FREE(paths_arg_conv_12);
44069                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
44070         }
44071         FREE(paths_arg);
44072         LDKPaymentParameters payment_params_arg_conv;
44073         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
44074         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44076         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44077         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
44078         uint64_t ret_ref = 0;
44079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44081         return ret_ref;
44082 }
44083
44084 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
44085         LDKRoute ret_var = Route_clone(arg);
44086         uint64_t ret_ref = 0;
44087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44089         return ret_ref;
44090 }
44091 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
44092         LDKRoute arg_conv;
44093         arg_conv.inner = untag_ptr(arg);
44094         arg_conv.is_owned = ptr_is_owned(arg);
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44096         arg_conv.is_owned = false;
44097         int64_t ret_conv = Route_clone_ptr(&arg_conv);
44098         return ret_conv;
44099 }
44100
44101 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
44102         LDKRoute orig_conv;
44103         orig_conv.inner = untag_ptr(orig);
44104         orig_conv.is_owned = ptr_is_owned(orig);
44105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44106         orig_conv.is_owned = false;
44107         LDKRoute ret_var = Route_clone(&orig_conv);
44108         uint64_t ret_ref = 0;
44109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44111         return ret_ref;
44112 }
44113
44114 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
44115         LDKRoute o_conv;
44116         o_conv.inner = untag_ptr(o);
44117         o_conv.is_owned = ptr_is_owned(o);
44118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44119         o_conv.is_owned = false;
44120         int64_t ret_conv = Route_hash(&o_conv);
44121         return ret_conv;
44122 }
44123
44124 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
44125         LDKRoute a_conv;
44126         a_conv.inner = untag_ptr(a);
44127         a_conv.is_owned = ptr_is_owned(a);
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44129         a_conv.is_owned = false;
44130         LDKRoute b_conv;
44131         b_conv.inner = untag_ptr(b);
44132         b_conv.is_owned = ptr_is_owned(b);
44133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44134         b_conv.is_owned = false;
44135         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
44136         return ret_conv;
44137 }
44138
44139 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
44140         LDKRoute this_arg_conv;
44141         this_arg_conv.inner = untag_ptr(this_arg);
44142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44144         this_arg_conv.is_owned = false;
44145         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
44146         return ret_conv;
44147 }
44148
44149 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
44150         LDKRoute this_arg_conv;
44151         this_arg_conv.inner = untag_ptr(this_arg);
44152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44154         this_arg_conv.is_owned = false;
44155         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
44156         return ret_conv;
44157 }
44158
44159 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
44160         LDKRoute obj_conv;
44161         obj_conv.inner = untag_ptr(obj);
44162         obj_conv.is_owned = ptr_is_owned(obj);
44163         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44164         obj_conv.is_owned = false;
44165         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
44166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44168         CVec_u8Z_free(ret_var);
44169         return ret_arr;
44170 }
44171
44172 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
44173         LDKu8slice ser_ref;
44174         ser_ref.datalen = ser->arr_len;
44175         ser_ref.data = ser->elems;
44176         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
44177         *ret_conv = Route_read(ser_ref);
44178         FREE(ser);
44179         return tag_ptr(ret_conv, true);
44180 }
44181
44182 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
44183         LDKRouteParameters this_obj_conv;
44184         this_obj_conv.inner = untag_ptr(this_obj);
44185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44187         RouteParameters_free(this_obj_conv);
44188 }
44189
44190 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
44191         LDKRouteParameters this_ptr_conv;
44192         this_ptr_conv.inner = untag_ptr(this_ptr);
44193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44195         this_ptr_conv.is_owned = false;
44196         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
44197         uint64_t ret_ref = 0;
44198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44200         return ret_ref;
44201 }
44202
44203 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
44204         LDKRouteParameters this_ptr_conv;
44205         this_ptr_conv.inner = untag_ptr(this_ptr);
44206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44208         this_ptr_conv.is_owned = false;
44209         LDKPaymentParameters val_conv;
44210         val_conv.inner = untag_ptr(val);
44211         val_conv.is_owned = ptr_is_owned(val);
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44213         val_conv = PaymentParameters_clone(&val_conv);
44214         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
44215 }
44216
44217 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
44218         LDKRouteParameters this_ptr_conv;
44219         this_ptr_conv.inner = untag_ptr(this_ptr);
44220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44222         this_ptr_conv.is_owned = false;
44223         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
44224         return ret_conv;
44225 }
44226
44227 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
44228         LDKRouteParameters this_ptr_conv;
44229         this_ptr_conv.inner = untag_ptr(this_ptr);
44230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44232         this_ptr_conv.is_owned = false;
44233         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
44234 }
44235
44236 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
44237         LDKRouteParameters this_ptr_conv;
44238         this_ptr_conv.inner = untag_ptr(this_ptr);
44239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44241         this_ptr_conv.is_owned = false;
44242         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
44243         return ret_conv;
44244 }
44245
44246 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) {
44247         LDKRouteParameters this_ptr_conv;
44248         this_ptr_conv.inner = untag_ptr(this_ptr);
44249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44251         this_ptr_conv.is_owned = false;
44252         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
44253 }
44254
44255 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) {
44256         LDKPaymentParameters payment_params_arg_conv;
44257         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
44258         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
44259         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44260         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44261         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
44262         uint64_t ret_ref = 0;
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44265         return ret_ref;
44266 }
44267
44268 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
44269         LDKRouteParameters ret_var = RouteParameters_clone(arg);
44270         uint64_t ret_ref = 0;
44271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44273         return ret_ref;
44274 }
44275 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
44276         LDKRouteParameters arg_conv;
44277         arg_conv.inner = untag_ptr(arg);
44278         arg_conv.is_owned = ptr_is_owned(arg);
44279         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44280         arg_conv.is_owned = false;
44281         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
44282         return ret_conv;
44283 }
44284
44285 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
44286         LDKRouteParameters orig_conv;
44287         orig_conv.inner = untag_ptr(orig);
44288         orig_conv.is_owned = ptr_is_owned(orig);
44289         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44290         orig_conv.is_owned = false;
44291         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
44292         uint64_t ret_ref = 0;
44293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44295         return ret_ref;
44296 }
44297
44298 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
44299         LDKRouteParameters obj_conv;
44300         obj_conv.inner = untag_ptr(obj);
44301         obj_conv.is_owned = ptr_is_owned(obj);
44302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44303         obj_conv.is_owned = false;
44304         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
44305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44307         CVec_u8Z_free(ret_var);
44308         return ret_arr;
44309 }
44310
44311 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
44312         LDKu8slice ser_ref;
44313         ser_ref.datalen = ser->arr_len;
44314         ser_ref.data = ser->elems;
44315         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
44316         *ret_conv = RouteParameters_read(ser_ref);
44317         FREE(ser);
44318         return tag_ptr(ret_conv, true);
44319 }
44320
44321 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
44322         LDKPaymentParameters this_obj_conv;
44323         this_obj_conv.inner = untag_ptr(this_obj);
44324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44326         PaymentParameters_free(this_obj_conv);
44327 }
44328
44329 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
44330         LDKPaymentParameters this_ptr_conv;
44331         this_ptr_conv.inner = untag_ptr(this_ptr);
44332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44334         this_ptr_conv.is_owned = false;
44335         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44336         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
44337         return ret_arr;
44338 }
44339
44340 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
44341         LDKPaymentParameters this_ptr_conv;
44342         this_ptr_conv.inner = untag_ptr(this_ptr);
44343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44345         this_ptr_conv.is_owned = false;
44346         LDKPublicKey val_ref;
44347         CHECK(val->arr_len == 33);
44348         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44349         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
44350 }
44351
44352 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
44353         LDKPaymentParameters this_ptr_conv;
44354         this_ptr_conv.inner = untag_ptr(this_ptr);
44355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44357         this_ptr_conv.is_owned = false;
44358         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
44359         uint64_t ret_ref = 0;
44360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44362         return ret_ref;
44363 }
44364
44365 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
44366         LDKPaymentParameters this_ptr_conv;
44367         this_ptr_conv.inner = untag_ptr(this_ptr);
44368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44370         this_ptr_conv.is_owned = false;
44371         LDKInvoiceFeatures val_conv;
44372         val_conv.inner = untag_ptr(val);
44373         val_conv.is_owned = ptr_is_owned(val);
44374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44375         val_conv = InvoiceFeatures_clone(&val_conv);
44376         PaymentParameters_set_features(&this_ptr_conv, val_conv);
44377 }
44378
44379 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
44380         LDKPaymentParameters this_ptr_conv;
44381         this_ptr_conv.inner = untag_ptr(this_ptr);
44382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44384         this_ptr_conv.is_owned = false;
44385         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44386         uint64_tArray ret_arr = NULL;
44387         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44388         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44389         for (size_t l = 0; l < ret_var.datalen; l++) {
44390                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44391                 uint64_t ret_conv_11_ref = 0;
44392                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44393                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
44394                 ret_arr_ptr[l] = ret_conv_11_ref;
44395         }
44396         
44397         FREE(ret_var.data);
44398         return ret_arr;
44399 }
44400
44401 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
44402         LDKPaymentParameters this_ptr_conv;
44403         this_ptr_conv.inner = untag_ptr(this_ptr);
44404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44406         this_ptr_conv.is_owned = false;
44407         LDKCVec_RouteHintZ val_constr;
44408         val_constr.datalen = val->arr_len;
44409         if (val_constr.datalen > 0)
44410                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44411         else
44412                 val_constr.data = NULL;
44413         uint64_t* val_vals = val->elems;
44414         for (size_t l = 0; l < val_constr.datalen; l++) {
44415                 uint64_t val_conv_11 = val_vals[l];
44416                 LDKRouteHint val_conv_11_conv;
44417                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
44418                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
44419                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44420                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44421                 val_constr.data[l] = val_conv_11_conv;
44422         }
44423         FREE(val);
44424         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44425 }
44426
44427 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
44428         LDKPaymentParameters this_ptr_conv;
44429         this_ptr_conv.inner = untag_ptr(this_ptr);
44430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44432         this_ptr_conv.is_owned = false;
44433         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44434         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44435         uint64_t ret_ref = tag_ptr(ret_copy, true);
44436         return ret_ref;
44437 }
44438
44439 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
44440         LDKPaymentParameters this_ptr_conv;
44441         this_ptr_conv.inner = untag_ptr(this_ptr);
44442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44444         this_ptr_conv.is_owned = false;
44445         void* val_ptr = untag_ptr(val);
44446         CHECK_ACCESS(val_ptr);
44447         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44448         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44449         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44450 }
44451
44452 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) {
44453         LDKPaymentParameters this_ptr_conv;
44454         this_ptr_conv.inner = untag_ptr(this_ptr);
44455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44457         this_ptr_conv.is_owned = false;
44458         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44459         return ret_conv;
44460 }
44461
44462 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) {
44463         LDKPaymentParameters this_ptr_conv;
44464         this_ptr_conv.inner = untag_ptr(this_ptr);
44465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44467         this_ptr_conv.is_owned = false;
44468         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44469 }
44470
44471 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
44472         LDKPaymentParameters this_ptr_conv;
44473         this_ptr_conv.inner = untag_ptr(this_ptr);
44474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44476         this_ptr_conv.is_owned = false;
44477         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
44478         return ret_conv;
44479 }
44480
44481 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
44482         LDKPaymentParameters this_ptr_conv;
44483         this_ptr_conv.inner = untag_ptr(this_ptr);
44484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44486         this_ptr_conv.is_owned = false;
44487         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
44488 }
44489
44490 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) {
44491         LDKPaymentParameters this_ptr_conv;
44492         this_ptr_conv.inner = untag_ptr(this_ptr);
44493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44495         this_ptr_conv.is_owned = false;
44496         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
44497         return ret_conv;
44498 }
44499
44500 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) {
44501         LDKPaymentParameters this_ptr_conv;
44502         this_ptr_conv.inner = untag_ptr(this_ptr);
44503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44505         this_ptr_conv.is_owned = false;
44506         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
44507 }
44508
44509 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
44510         LDKPaymentParameters this_ptr_conv;
44511         this_ptr_conv.inner = untag_ptr(this_ptr);
44512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44514         this_ptr_conv.is_owned = false;
44515         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
44516         int64_tArray ret_arr = NULL;
44517         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44518         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44519         for (size_t i = 0; i < ret_var.datalen; i++) {
44520                 int64_t ret_conv_8_conv = ret_var.data[i];
44521                 ret_arr_ptr[i] = ret_conv_8_conv;
44522         }
44523         
44524         FREE(ret_var.data);
44525         return ret_arr;
44526 }
44527
44528 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
44529         LDKPaymentParameters this_ptr_conv;
44530         this_ptr_conv.inner = untag_ptr(this_ptr);
44531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44533         this_ptr_conv.is_owned = false;
44534         LDKCVec_u64Z val_constr;
44535         val_constr.datalen = val->arr_len;
44536         if (val_constr.datalen > 0)
44537                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44538         else
44539                 val_constr.data = NULL;
44540         int64_t* val_vals = val->elems;
44541         for (size_t i = 0; i < val_constr.datalen; i++) {
44542                 int64_t val_conv_8 = val_vals[i];
44543                 val_constr.data[i] = val_conv_8;
44544         }
44545         FREE(val);
44546         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
44547 }
44548
44549 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) {
44550         LDKPublicKey payee_pubkey_arg_ref;
44551         CHECK(payee_pubkey_arg->arr_len == 33);
44552         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
44553         LDKInvoiceFeatures features_arg_conv;
44554         features_arg_conv.inner = untag_ptr(features_arg);
44555         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44556         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44557         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44558         LDKCVec_RouteHintZ route_hints_arg_constr;
44559         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
44560         if (route_hints_arg_constr.datalen > 0)
44561                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44562         else
44563                 route_hints_arg_constr.data = NULL;
44564         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
44565         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44566                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44567                 LDKRouteHint route_hints_arg_conv_11_conv;
44568                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
44569                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
44570                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44571                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44572                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44573         }
44574         FREE(route_hints_arg);
44575         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
44576         CHECK_ACCESS(expiry_time_arg_ptr);
44577         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44578         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
44579         LDKCVec_u64Z previously_failed_channels_arg_constr;
44580         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
44581         if (previously_failed_channels_arg_constr.datalen > 0)
44582                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44583         else
44584                 previously_failed_channels_arg_constr.data = NULL;
44585         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
44586         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
44587                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
44588                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
44589         }
44590         FREE(previously_failed_channels_arg);
44591         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);
44592         uint64_t ret_ref = 0;
44593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44595         return ret_ref;
44596 }
44597
44598 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44599         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44600         uint64_t ret_ref = 0;
44601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44603         return ret_ref;
44604 }
44605 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
44606         LDKPaymentParameters arg_conv;
44607         arg_conv.inner = untag_ptr(arg);
44608         arg_conv.is_owned = ptr_is_owned(arg);
44609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44610         arg_conv.is_owned = false;
44611         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44612         return ret_conv;
44613 }
44614
44615 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
44616         LDKPaymentParameters orig_conv;
44617         orig_conv.inner = untag_ptr(orig);
44618         orig_conv.is_owned = ptr_is_owned(orig);
44619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44620         orig_conv.is_owned = false;
44621         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44622         uint64_t ret_ref = 0;
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44625         return ret_ref;
44626 }
44627
44628 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
44629         LDKPaymentParameters o_conv;
44630         o_conv.inner = untag_ptr(o);
44631         o_conv.is_owned = ptr_is_owned(o);
44632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44633         o_conv.is_owned = false;
44634         int64_t ret_conv = PaymentParameters_hash(&o_conv);
44635         return ret_conv;
44636 }
44637
44638 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
44639         LDKPaymentParameters a_conv;
44640         a_conv.inner = untag_ptr(a);
44641         a_conv.is_owned = ptr_is_owned(a);
44642         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44643         a_conv.is_owned = false;
44644         LDKPaymentParameters b_conv;
44645         b_conv.inner = untag_ptr(b);
44646         b_conv.is_owned = ptr_is_owned(b);
44647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44648         b_conv.is_owned = false;
44649         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44650         return ret_conv;
44651 }
44652
44653 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
44654         LDKPaymentParameters obj_conv;
44655         obj_conv.inner = untag_ptr(obj);
44656         obj_conv.is_owned = ptr_is_owned(obj);
44657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44658         obj_conv.is_owned = false;
44659         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44662         CVec_u8Z_free(ret_var);
44663         return ret_arr;
44664 }
44665
44666 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
44667         LDKu8slice ser_ref;
44668         ser_ref.datalen = ser->arr_len;
44669         ser_ref.data = ser->elems;
44670         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44671         *ret_conv = PaymentParameters_read(ser_ref);
44672         FREE(ser);
44673         return tag_ptr(ret_conv, true);
44674 }
44675
44676 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
44677         LDKPublicKey payee_pubkey_ref;
44678         CHECK(payee_pubkey->arr_len == 33);
44679         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
44680         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44681         uint64_t ret_ref = 0;
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44684         return ret_ref;
44685 }
44686
44687 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
44688         LDKPublicKey payee_pubkey_ref;
44689         CHECK(payee_pubkey->arr_len == 33);
44690         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
44691         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44692         uint64_t ret_ref = 0;
44693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44695         return ret_ref;
44696 }
44697
44698 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
44699         LDKRouteHint this_obj_conv;
44700         this_obj_conv.inner = untag_ptr(this_obj);
44701         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44703         RouteHint_free(this_obj_conv);
44704 }
44705
44706 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
44707         LDKRouteHint this_ptr_conv;
44708         this_ptr_conv.inner = untag_ptr(this_ptr);
44709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44711         this_ptr_conv.is_owned = false;
44712         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44713         uint64_tArray ret_arr = NULL;
44714         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44715         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44716         for (size_t o = 0; o < ret_var.datalen; o++) {
44717                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44718                 uint64_t ret_conv_14_ref = 0;
44719                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44720                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
44721                 ret_arr_ptr[o] = ret_conv_14_ref;
44722         }
44723         
44724         FREE(ret_var.data);
44725         return ret_arr;
44726 }
44727
44728 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
44729         LDKRouteHint this_ptr_conv;
44730         this_ptr_conv.inner = untag_ptr(this_ptr);
44731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44733         this_ptr_conv.is_owned = false;
44734         LDKCVec_RouteHintHopZ val_constr;
44735         val_constr.datalen = val->arr_len;
44736         if (val_constr.datalen > 0)
44737                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44738         else
44739                 val_constr.data = NULL;
44740         uint64_t* val_vals = val->elems;
44741         for (size_t o = 0; o < val_constr.datalen; o++) {
44742                 uint64_t val_conv_14 = val_vals[o];
44743                 LDKRouteHintHop val_conv_14_conv;
44744                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
44745                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
44746                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44747                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44748                 val_constr.data[o] = val_conv_14_conv;
44749         }
44750         FREE(val);
44751         RouteHint_set_a(&this_ptr_conv, val_constr);
44752 }
44753
44754 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
44755         LDKCVec_RouteHintHopZ a_arg_constr;
44756         a_arg_constr.datalen = a_arg->arr_len;
44757         if (a_arg_constr.datalen > 0)
44758                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44759         else
44760                 a_arg_constr.data = NULL;
44761         uint64_t* a_arg_vals = a_arg->elems;
44762         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44763                 uint64_t a_arg_conv_14 = a_arg_vals[o];
44764                 LDKRouteHintHop a_arg_conv_14_conv;
44765                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
44766                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
44767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44768                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44769                 a_arg_constr.data[o] = a_arg_conv_14_conv;
44770         }
44771         FREE(a_arg);
44772         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44773         uint64_t ret_ref = 0;
44774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44776         return ret_ref;
44777 }
44778
44779 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44780         LDKRouteHint ret_var = RouteHint_clone(arg);
44781         uint64_t ret_ref = 0;
44782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44784         return ret_ref;
44785 }
44786 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
44787         LDKRouteHint arg_conv;
44788         arg_conv.inner = untag_ptr(arg);
44789         arg_conv.is_owned = ptr_is_owned(arg);
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44791         arg_conv.is_owned = false;
44792         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44793         return ret_conv;
44794 }
44795
44796 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
44797         LDKRouteHint orig_conv;
44798         orig_conv.inner = untag_ptr(orig);
44799         orig_conv.is_owned = ptr_is_owned(orig);
44800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44801         orig_conv.is_owned = false;
44802         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44803         uint64_t ret_ref = 0;
44804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44806         return ret_ref;
44807 }
44808
44809 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
44810         LDKRouteHint o_conv;
44811         o_conv.inner = untag_ptr(o);
44812         o_conv.is_owned = ptr_is_owned(o);
44813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44814         o_conv.is_owned = false;
44815         int64_t ret_conv = RouteHint_hash(&o_conv);
44816         return ret_conv;
44817 }
44818
44819 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
44820         LDKRouteHint a_conv;
44821         a_conv.inner = untag_ptr(a);
44822         a_conv.is_owned = ptr_is_owned(a);
44823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44824         a_conv.is_owned = false;
44825         LDKRouteHint b_conv;
44826         b_conv.inner = untag_ptr(b);
44827         b_conv.is_owned = ptr_is_owned(b);
44828         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44829         b_conv.is_owned = false;
44830         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44831         return ret_conv;
44832 }
44833
44834 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
44835         LDKRouteHint obj_conv;
44836         obj_conv.inner = untag_ptr(obj);
44837         obj_conv.is_owned = ptr_is_owned(obj);
44838         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44839         obj_conv.is_owned = false;
44840         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44841         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44842         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44843         CVec_u8Z_free(ret_var);
44844         return ret_arr;
44845 }
44846
44847 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
44848         LDKu8slice ser_ref;
44849         ser_ref.datalen = ser->arr_len;
44850         ser_ref.data = ser->elems;
44851         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44852         *ret_conv = RouteHint_read(ser_ref);
44853         FREE(ser);
44854         return tag_ptr(ret_conv, true);
44855 }
44856
44857 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
44858         LDKRouteHintHop this_obj_conv;
44859         this_obj_conv.inner = untag_ptr(this_obj);
44860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44862         RouteHintHop_free(this_obj_conv);
44863 }
44864
44865 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
44866         LDKRouteHintHop this_ptr_conv;
44867         this_ptr_conv.inner = untag_ptr(this_ptr);
44868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44870         this_ptr_conv.is_owned = false;
44871         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44872         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
44873         return ret_arr;
44874 }
44875
44876 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
44877         LDKRouteHintHop this_ptr_conv;
44878         this_ptr_conv.inner = untag_ptr(this_ptr);
44879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44881         this_ptr_conv.is_owned = false;
44882         LDKPublicKey val_ref;
44883         CHECK(val->arr_len == 33);
44884         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44885         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44886 }
44887
44888 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
44889         LDKRouteHintHop this_ptr_conv;
44890         this_ptr_conv.inner = untag_ptr(this_ptr);
44891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44893         this_ptr_conv.is_owned = false;
44894         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44895         return ret_conv;
44896 }
44897
44898 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
44899         LDKRouteHintHop this_ptr_conv;
44900         this_ptr_conv.inner = untag_ptr(this_ptr);
44901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44903         this_ptr_conv.is_owned = false;
44904         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44905 }
44906
44907 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
44908         LDKRouteHintHop this_ptr_conv;
44909         this_ptr_conv.inner = untag_ptr(this_ptr);
44910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44912         this_ptr_conv.is_owned = false;
44913         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44914         uint64_t ret_ref = 0;
44915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44917         return ret_ref;
44918 }
44919
44920 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
44921         LDKRouteHintHop this_ptr_conv;
44922         this_ptr_conv.inner = untag_ptr(this_ptr);
44923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44925         this_ptr_conv.is_owned = false;
44926         LDKRoutingFees val_conv;
44927         val_conv.inner = untag_ptr(val);
44928         val_conv.is_owned = ptr_is_owned(val);
44929         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44930         val_conv = RoutingFees_clone(&val_conv);
44931         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44932 }
44933
44934 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
44935         LDKRouteHintHop this_ptr_conv;
44936         this_ptr_conv.inner = untag_ptr(this_ptr);
44937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44939         this_ptr_conv.is_owned = false;
44940         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44941         return ret_conv;
44942 }
44943
44944 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44945         LDKRouteHintHop this_ptr_conv;
44946         this_ptr_conv.inner = untag_ptr(this_ptr);
44947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44949         this_ptr_conv.is_owned = false;
44950         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44951 }
44952
44953 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
44954         LDKRouteHintHop this_ptr_conv;
44955         this_ptr_conv.inner = untag_ptr(this_ptr);
44956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44958         this_ptr_conv.is_owned = false;
44959         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44960         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44961         uint64_t ret_ref = tag_ptr(ret_copy, true);
44962         return ret_ref;
44963 }
44964
44965 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
44966         LDKRouteHintHop this_ptr_conv;
44967         this_ptr_conv.inner = untag_ptr(this_ptr);
44968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44970         this_ptr_conv.is_owned = false;
44971         void* val_ptr = untag_ptr(val);
44972         CHECK_ACCESS(val_ptr);
44973         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44974         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44975         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44976 }
44977
44978 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
44979         LDKRouteHintHop this_ptr_conv;
44980         this_ptr_conv.inner = untag_ptr(this_ptr);
44981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44983         this_ptr_conv.is_owned = false;
44984         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44985         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44986         uint64_t ret_ref = tag_ptr(ret_copy, true);
44987         return ret_ref;
44988 }
44989
44990 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
44991         LDKRouteHintHop this_ptr_conv;
44992         this_ptr_conv.inner = untag_ptr(this_ptr);
44993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44995         this_ptr_conv.is_owned = false;
44996         void* val_ptr = untag_ptr(val);
44997         CHECK_ACCESS(val_ptr);
44998         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44999         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45000         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
45001 }
45002
45003 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) {
45004         LDKPublicKey src_node_id_arg_ref;
45005         CHECK(src_node_id_arg->arr_len == 33);
45006         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
45007         LDKRoutingFees fees_arg_conv;
45008         fees_arg_conv.inner = untag_ptr(fees_arg);
45009         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
45011         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
45012         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
45013         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
45014         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
45015         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
45016         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
45017         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
45018         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
45019         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
45020         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);
45021         uint64_t ret_ref = 0;
45022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45024         return ret_ref;
45025 }
45026
45027 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
45028         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
45029         uint64_t ret_ref = 0;
45030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45032         return ret_ref;
45033 }
45034 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
45035         LDKRouteHintHop arg_conv;
45036         arg_conv.inner = untag_ptr(arg);
45037         arg_conv.is_owned = ptr_is_owned(arg);
45038         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45039         arg_conv.is_owned = false;
45040         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
45041         return ret_conv;
45042 }
45043
45044 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
45045         LDKRouteHintHop orig_conv;
45046         orig_conv.inner = untag_ptr(orig);
45047         orig_conv.is_owned = ptr_is_owned(orig);
45048         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45049         orig_conv.is_owned = false;
45050         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
45051         uint64_t ret_ref = 0;
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45054         return ret_ref;
45055 }
45056
45057 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
45058         LDKRouteHintHop o_conv;
45059         o_conv.inner = untag_ptr(o);
45060         o_conv.is_owned = ptr_is_owned(o);
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45062         o_conv.is_owned = false;
45063         int64_t ret_conv = RouteHintHop_hash(&o_conv);
45064         return ret_conv;
45065 }
45066
45067 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
45068         LDKRouteHintHop a_conv;
45069         a_conv.inner = untag_ptr(a);
45070         a_conv.is_owned = ptr_is_owned(a);
45071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45072         a_conv.is_owned = false;
45073         LDKRouteHintHop b_conv;
45074         b_conv.inner = untag_ptr(b);
45075         b_conv.is_owned = ptr_is_owned(b);
45076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45077         b_conv.is_owned = false;
45078         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
45079         return ret_conv;
45080 }
45081
45082 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
45083         LDKRouteHintHop obj_conv;
45084         obj_conv.inner = untag_ptr(obj);
45085         obj_conv.is_owned = ptr_is_owned(obj);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45087         obj_conv.is_owned = false;
45088         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
45089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45091         CVec_u8Z_free(ret_var);
45092         return ret_arr;
45093 }
45094
45095 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
45096         LDKu8slice ser_ref;
45097         ser_ref.datalen = ser->arr_len;
45098         ser_ref.data = ser->elems;
45099         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
45100         *ret_conv = RouteHintHop_read(ser_ref);
45101         FREE(ser);
45102         return tag_ptr(ret_conv, true);
45103 }
45104
45105 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) {
45106         LDKPublicKey our_node_pubkey_ref;
45107         CHECK(our_node_pubkey->arr_len == 33);
45108         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
45109         LDKRouteParameters route_params_conv;
45110         route_params_conv.inner = untag_ptr(route_params);
45111         route_params_conv.is_owned = ptr_is_owned(route_params);
45112         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45113         route_params_conv.is_owned = false;
45114         LDKNetworkGraph network_graph_conv;
45115         network_graph_conv.inner = untag_ptr(network_graph);
45116         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45117         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45118         network_graph_conv.is_owned = false;
45119         LDKCVec_ChannelDetailsZ first_hops_constr;
45120         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
45121         if (first_hops != 0) {
45122                 first_hops_constr.datalen = first_hops->arr_len;
45123                 if (first_hops_constr.datalen > 0)
45124                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
45125                 else
45126                         first_hops_constr.data = NULL;
45127                 uint64_t* first_hops_vals = first_hops->elems;
45128                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
45129                         uint64_t first_hops_conv_16 = first_hops_vals[q];
45130                         LDKChannelDetails first_hops_conv_16_conv;
45131                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
45132                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
45133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
45134                         first_hops_conv_16_conv.is_owned = false;
45135                         first_hops_constr.data[q] = first_hops_conv_16_conv;
45136                 }
45137                 FREE(first_hops);
45138                 first_hops_ptr = &first_hops_constr;
45139         }
45140         void* logger_ptr = untag_ptr(logger);
45141         CHECK_ACCESS(logger_ptr);
45142         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45143         if (logger_conv.free == LDKLogger_JCalls_free) {
45144                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45145                 LDKLogger_JCalls_cloned(&logger_conv);
45146         }
45147         void* scorer_ptr = untag_ptr(scorer);
45148         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
45149         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
45150         unsigned char random_seed_bytes_arr[32];
45151         CHECK(random_seed_bytes->arr_len == 32);
45152         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45153         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45154         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45155         *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);
45156         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
45157         return tag_ptr(ret_conv, true);
45158 }
45159
45160 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) {
45161         LDKPublicKey our_node_pubkey_ref;
45162         CHECK(our_node_pubkey->arr_len == 33);
45163         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
45164         LDKCVec_PublicKeyZ hops_constr;
45165         hops_constr.datalen = hops->arr_len;
45166         if (hops_constr.datalen > 0)
45167                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
45168         else
45169                 hops_constr.data = NULL;
45170         int8_tArray* hops_vals = (void*) hops->elems;
45171         for (size_t m = 0; m < hops_constr.datalen; m++) {
45172                 int8_tArray hops_conv_12 = hops_vals[m];
45173                 LDKPublicKey hops_conv_12_ref;
45174                 CHECK(hops_conv_12->arr_len == 33);
45175                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
45176                 hops_constr.data[m] = hops_conv_12_ref;
45177         }
45178         FREE(hops);
45179         LDKRouteParameters route_params_conv;
45180         route_params_conv.inner = untag_ptr(route_params);
45181         route_params_conv.is_owned = ptr_is_owned(route_params);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45183         route_params_conv.is_owned = false;
45184         LDKNetworkGraph network_graph_conv;
45185         network_graph_conv.inner = untag_ptr(network_graph);
45186         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45187         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45188         network_graph_conv.is_owned = false;
45189         void* logger_ptr = untag_ptr(logger);
45190         CHECK_ACCESS(logger_ptr);
45191         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45192         if (logger_conv.free == LDKLogger_JCalls_free) {
45193                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45194                 LDKLogger_JCalls_cloned(&logger_conv);
45195         }
45196         unsigned char random_seed_bytes_arr[32];
45197         CHECK(random_seed_bytes->arr_len == 32);
45198         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45199         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45200         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45201         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
45202         return tag_ptr(ret_conv, true);
45203 }
45204
45205 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
45206         if (!ptr_is_owned(this_ptr)) return;
45207         void* this_ptr_ptr = untag_ptr(this_ptr);
45208         CHECK_ACCESS(this_ptr_ptr);
45209         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
45210         FREE(untag_ptr(this_ptr));
45211         Score_free(this_ptr_conv);
45212 }
45213
45214 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
45215         if (!ptr_is_owned(this_ptr)) return;
45216         void* this_ptr_ptr = untag_ptr(this_ptr);
45217         CHECK_ACCESS(this_ptr_ptr);
45218         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
45219         FREE(untag_ptr(this_ptr));
45220         LockableScore_free(this_ptr_conv);
45221 }
45222
45223 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
45224         if (!ptr_is_owned(this_ptr)) return;
45225         void* this_ptr_ptr = untag_ptr(this_ptr);
45226         CHECK_ACCESS(this_ptr_ptr);
45227         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
45228         FREE(untag_ptr(this_ptr));
45229         WriteableScore_free(this_ptr_conv);
45230 }
45231
45232 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
45233         LDKMultiThreadedLockableScore this_obj_conv;
45234         this_obj_conv.inner = untag_ptr(this_obj);
45235         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45237         MultiThreadedLockableScore_free(this_obj_conv);
45238 }
45239
45240 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
45241         LDKMultiThreadedScoreLock this_obj_conv;
45242         this_obj_conv.inner = untag_ptr(this_obj);
45243         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45245         MultiThreadedScoreLock_free(this_obj_conv);
45246 }
45247
45248 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
45249         LDKMultiThreadedScoreLock this_arg_conv;
45250         this_arg_conv.inner = untag_ptr(this_arg);
45251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45253         this_arg_conv.is_owned = false;
45254         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45255         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
45256         return tag_ptr(ret_ret, true);
45257 }
45258
45259 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
45260         LDKMultiThreadedScoreLock obj_conv;
45261         obj_conv.inner = untag_ptr(obj);
45262         obj_conv.is_owned = ptr_is_owned(obj);
45263         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45264         obj_conv.is_owned = false;
45265         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
45266         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45267         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45268         CVec_u8Z_free(ret_var);
45269         return ret_arr;
45270 }
45271
45272 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
45273         LDKMultiThreadedLockableScore this_arg_conv;
45274         this_arg_conv.inner = untag_ptr(this_arg);
45275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45277         this_arg_conv.is_owned = false;
45278         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
45279         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
45280         return tag_ptr(ret_ret, true);
45281 }
45282
45283 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
45284         LDKMultiThreadedLockableScore obj_conv;
45285         obj_conv.inner = untag_ptr(obj);
45286         obj_conv.is_owned = ptr_is_owned(obj);
45287         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45288         obj_conv.is_owned = false;
45289         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
45290         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45291         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45292         CVec_u8Z_free(ret_var);
45293         return ret_arr;
45294 }
45295
45296 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
45297         LDKMultiThreadedLockableScore this_arg_conv;
45298         this_arg_conv.inner = untag_ptr(this_arg);
45299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45301         this_arg_conv.is_owned = false;
45302         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
45303         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
45304         return tag_ptr(ret_ret, true);
45305 }
45306
45307 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
45308         void* score_ptr = untag_ptr(score);
45309         CHECK_ACCESS(score_ptr);
45310         LDKScore score_conv = *(LDKScore*)(score_ptr);
45311         if (score_conv.free == LDKScore_JCalls_free) {
45312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45313                 LDKScore_JCalls_cloned(&score_conv);
45314         }
45315         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
45316         uint64_t ret_ref = 0;
45317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45319         return ret_ref;
45320 }
45321
45322 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
45323         LDKChannelUsage this_obj_conv;
45324         this_obj_conv.inner = untag_ptr(this_obj);
45325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45327         ChannelUsage_free(this_obj_conv);
45328 }
45329
45330 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
45331         LDKChannelUsage this_ptr_conv;
45332         this_ptr_conv.inner = untag_ptr(this_ptr);
45333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45335         this_ptr_conv.is_owned = false;
45336         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
45337         return ret_conv;
45338 }
45339
45340 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
45341         LDKChannelUsage this_ptr_conv;
45342         this_ptr_conv.inner = untag_ptr(this_ptr);
45343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45345         this_ptr_conv.is_owned = false;
45346         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
45347 }
45348
45349 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
45350         LDKChannelUsage this_ptr_conv;
45351         this_ptr_conv.inner = untag_ptr(this_ptr);
45352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45354         this_ptr_conv.is_owned = false;
45355         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
45356         return ret_conv;
45357 }
45358
45359 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
45360         LDKChannelUsage this_ptr_conv;
45361         this_ptr_conv.inner = untag_ptr(this_ptr);
45362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45364         this_ptr_conv.is_owned = false;
45365         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
45366 }
45367
45368 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
45369         LDKChannelUsage this_ptr_conv;
45370         this_ptr_conv.inner = untag_ptr(this_ptr);
45371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45373         this_ptr_conv.is_owned = false;
45374         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
45375         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
45376         uint64_t ret_ref = tag_ptr(ret_copy, true);
45377         return ret_ref;
45378 }
45379
45380 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
45381         LDKChannelUsage this_ptr_conv;
45382         this_ptr_conv.inner = untag_ptr(this_ptr);
45383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45385         this_ptr_conv.is_owned = false;
45386         void* val_ptr = untag_ptr(val);
45387         CHECK_ACCESS(val_ptr);
45388         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
45389         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
45390         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
45391 }
45392
45393 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) {
45394         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
45395         CHECK_ACCESS(effective_capacity_arg_ptr);
45396         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
45397         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
45398         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
45399         uint64_t ret_ref = 0;
45400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45402         return ret_ref;
45403 }
45404
45405 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
45406         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
45407         uint64_t ret_ref = 0;
45408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45410         return ret_ref;
45411 }
45412 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
45413         LDKChannelUsage arg_conv;
45414         arg_conv.inner = untag_ptr(arg);
45415         arg_conv.is_owned = ptr_is_owned(arg);
45416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45417         arg_conv.is_owned = false;
45418         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
45419         return ret_conv;
45420 }
45421
45422 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
45423         LDKChannelUsage orig_conv;
45424         orig_conv.inner = untag_ptr(orig);
45425         orig_conv.is_owned = ptr_is_owned(orig);
45426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45427         orig_conv.is_owned = false;
45428         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
45429         uint64_t ret_ref = 0;
45430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45432         return ret_ref;
45433 }
45434
45435 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
45436         LDKFixedPenaltyScorer this_obj_conv;
45437         this_obj_conv.inner = untag_ptr(this_obj);
45438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45440         FixedPenaltyScorer_free(this_obj_conv);
45441 }
45442
45443 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
45444         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
45445         uint64_t ret_ref = 0;
45446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45448         return ret_ref;
45449 }
45450 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
45451         LDKFixedPenaltyScorer arg_conv;
45452         arg_conv.inner = untag_ptr(arg);
45453         arg_conv.is_owned = ptr_is_owned(arg);
45454         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45455         arg_conv.is_owned = false;
45456         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45457         return ret_conv;
45458 }
45459
45460 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
45461         LDKFixedPenaltyScorer orig_conv;
45462         orig_conv.inner = untag_ptr(orig);
45463         orig_conv.is_owned = ptr_is_owned(orig);
45464         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45465         orig_conv.is_owned = false;
45466         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45467         uint64_t ret_ref = 0;
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45470         return ret_ref;
45471 }
45472
45473 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
45474         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45475         uint64_t ret_ref = 0;
45476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45478         return ret_ref;
45479 }
45480
45481 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
45482         LDKFixedPenaltyScorer this_arg_conv;
45483         this_arg_conv.inner = untag_ptr(this_arg);
45484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45486         this_arg_conv.is_owned = false;
45487         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45488         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45489         return tag_ptr(ret_ret, true);
45490 }
45491
45492 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
45493         LDKFixedPenaltyScorer obj_conv;
45494         obj_conv.inner = untag_ptr(obj);
45495         obj_conv.is_owned = ptr_is_owned(obj);
45496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45497         obj_conv.is_owned = false;
45498         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45499         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45500         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45501         CVec_u8Z_free(ret_var);
45502         return ret_arr;
45503 }
45504
45505 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
45506         LDKu8slice ser_ref;
45507         ser_ref.datalen = ser->arr_len;
45508         ser_ref.data = ser->elems;
45509         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45510         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45511         FREE(ser);
45512         return tag_ptr(ret_conv, true);
45513 }
45514
45515 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
45516         LDKProbabilisticScorer this_obj_conv;
45517         this_obj_conv.inner = untag_ptr(this_obj);
45518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45520         ProbabilisticScorer_free(this_obj_conv);
45521 }
45522
45523 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
45524         LDKProbabilisticScoringParameters this_obj_conv;
45525         this_obj_conv.inner = untag_ptr(this_obj);
45526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45528         ProbabilisticScoringParameters_free(this_obj_conv);
45529 }
45530
45531 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
45532         LDKProbabilisticScoringParameters this_ptr_conv;
45533         this_ptr_conv.inner = untag_ptr(this_ptr);
45534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45536         this_ptr_conv.is_owned = false;
45537         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45538         return ret_conv;
45539 }
45540
45541 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
45542         LDKProbabilisticScoringParameters this_ptr_conv;
45543         this_ptr_conv.inner = untag_ptr(this_ptr);
45544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45546         this_ptr_conv.is_owned = false;
45547         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45548 }
45549
45550 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) {
45551         LDKProbabilisticScoringParameters this_ptr_conv;
45552         this_ptr_conv.inner = untag_ptr(this_ptr);
45553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45555         this_ptr_conv.is_owned = false;
45556         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
45557         return ret_conv;
45558 }
45559
45560 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) {
45561         LDKProbabilisticScoringParameters this_ptr_conv;
45562         this_ptr_conv.inner = untag_ptr(this_ptr);
45563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45565         this_ptr_conv.is_owned = false;
45566         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45567 }
45568
45569 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
45570         LDKProbabilisticScoringParameters this_ptr_conv;
45571         this_ptr_conv.inner = untag_ptr(this_ptr);
45572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45574         this_ptr_conv.is_owned = false;
45575         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45576         return ret_conv;
45577 }
45578
45579 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) {
45580         LDKProbabilisticScoringParameters this_ptr_conv;
45581         this_ptr_conv.inner = untag_ptr(this_ptr);
45582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45584         this_ptr_conv.is_owned = false;
45585         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45586 }
45587
45588 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
45589         LDKProbabilisticScoringParameters this_ptr_conv;
45590         this_ptr_conv.inner = untag_ptr(this_ptr);
45591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45593         this_ptr_conv.is_owned = false;
45594         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45595         return ret_conv;
45596 }
45597
45598 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) {
45599         LDKProbabilisticScoringParameters this_ptr_conv;
45600         this_ptr_conv.inner = untag_ptr(this_ptr);
45601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45603         this_ptr_conv.is_owned = false;
45604         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45605 }
45606
45607 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) {
45608         LDKProbabilisticScoringParameters this_ptr_conv;
45609         this_ptr_conv.inner = untag_ptr(this_ptr);
45610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45612         this_ptr_conv.is_owned = false;
45613         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45614         return ret_conv;
45615 }
45616
45617 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) {
45618         LDKProbabilisticScoringParameters this_ptr_conv;
45619         this_ptr_conv.inner = untag_ptr(this_ptr);
45620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45622         this_ptr_conv.is_owned = false;
45623         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45624 }
45625
45626 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) {
45627         LDKProbabilisticScoringParameters this_ptr_conv;
45628         this_ptr_conv.inner = untag_ptr(this_ptr);
45629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45631         this_ptr_conv.is_owned = false;
45632         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45633         return ret_conv;
45634 }
45635
45636 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) {
45637         LDKProbabilisticScoringParameters this_ptr_conv;
45638         this_ptr_conv.inner = untag_ptr(this_ptr);
45639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45641         this_ptr_conv.is_owned = false;
45642         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45643 }
45644
45645 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) {
45646         LDKProbabilisticScoringParameters this_ptr_conv;
45647         this_ptr_conv.inner = untag_ptr(this_ptr);
45648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45650         this_ptr_conv.is_owned = false;
45651         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45652         return ret_conv;
45653 }
45654
45655 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) {
45656         LDKProbabilisticScoringParameters this_ptr_conv;
45657         this_ptr_conv.inner = untag_ptr(this_ptr);
45658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45660         this_ptr_conv.is_owned = false;
45661         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45662 }
45663
45664 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) {
45665         LDKProbabilisticScoringParameters this_ptr_conv;
45666         this_ptr_conv.inner = untag_ptr(this_ptr);
45667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45669         this_ptr_conv.is_owned = false;
45670         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
45671         return ret_conv;
45672 }
45673
45674 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) {
45675         LDKProbabilisticScoringParameters this_ptr_conv;
45676         this_ptr_conv.inner = untag_ptr(this_ptr);
45677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45679         this_ptr_conv.is_owned = false;
45680         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
45681 }
45682
45683 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
45684         LDKProbabilisticScoringParameters this_ptr_conv;
45685         this_ptr_conv.inner = untag_ptr(this_ptr);
45686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45688         this_ptr_conv.is_owned = false;
45689         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
45690         return ret_conv;
45691 }
45692
45693 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) {
45694         LDKProbabilisticScoringParameters this_ptr_conv;
45695         this_ptr_conv.inner = untag_ptr(this_ptr);
45696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45698         this_ptr_conv.is_owned = false;
45699         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
45700 }
45701
45702 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
45703         LDKProbabilisticScoringParameters this_ptr_conv;
45704         this_ptr_conv.inner = untag_ptr(this_ptr);
45705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45707         this_ptr_conv.is_owned = false;
45708         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
45709         return ret_conv;
45710 }
45711
45712 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) {
45713         LDKProbabilisticScoringParameters this_ptr_conv;
45714         this_ptr_conv.inner = untag_ptr(this_ptr);
45715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45717         this_ptr_conv.is_owned = false;
45718         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
45719 }
45720
45721 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45722         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45723         uint64_t ret_ref = 0;
45724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45726         return ret_ref;
45727 }
45728 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
45729         LDKProbabilisticScoringParameters arg_conv;
45730         arg_conv.inner = untag_ptr(arg);
45731         arg_conv.is_owned = ptr_is_owned(arg);
45732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45733         arg_conv.is_owned = false;
45734         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45735         return ret_conv;
45736 }
45737
45738 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
45739         LDKProbabilisticScoringParameters orig_conv;
45740         orig_conv.inner = untag_ptr(orig);
45741         orig_conv.is_owned = ptr_is_owned(orig);
45742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45743         orig_conv.is_owned = false;
45744         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45745         uint64_t ret_ref = 0;
45746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45748         return ret_ref;
45749 }
45750
45751 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
45752         LDKProbabilisticScoringParameters params_conv;
45753         params_conv.inner = untag_ptr(params);
45754         params_conv.is_owned = ptr_is_owned(params);
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45756         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
45757         LDKNetworkGraph network_graph_conv;
45758         network_graph_conv.inner = untag_ptr(network_graph);
45759         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45760         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45761         network_graph_conv.is_owned = false;
45762         void* logger_ptr = untag_ptr(logger);
45763         CHECK_ACCESS(logger_ptr);
45764         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45765         if (logger_conv.free == LDKLogger_JCalls_free) {
45766                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45767                 LDKLogger_JCalls_cloned(&logger_conv);
45768         }
45769         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45770         uint64_t ret_ref = 0;
45771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45773         return ret_ref;
45774 }
45775
45776 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
45777         LDKProbabilisticScorer this_arg_conv;
45778         this_arg_conv.inner = untag_ptr(this_arg);
45779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45781         this_arg_conv.is_owned = false;
45782         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45783 }
45784
45785 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) {
45786         LDKProbabilisticScorer this_arg_conv;
45787         this_arg_conv.inner = untag_ptr(this_arg);
45788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45790         this_arg_conv.is_owned = false;
45791         LDKNodeId target_conv;
45792         target_conv.inner = untag_ptr(target);
45793         target_conv.is_owned = ptr_is_owned(target);
45794         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45795         target_conv.is_owned = false;
45796         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45797         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45798         uint64_t ret_ref = tag_ptr(ret_copy, true);
45799         return ret_ref;
45800 }
45801
45802 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
45803         LDKProbabilisticScorer this_arg_conv;
45804         this_arg_conv.inner = untag_ptr(this_arg);
45805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45807         this_arg_conv.is_owned = false;
45808         LDKNodeId node_id_conv;
45809         node_id_conv.inner = untag_ptr(node_id);
45810         node_id_conv.is_owned = ptr_is_owned(node_id);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45812         node_id_conv.is_owned = false;
45813         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45814 }
45815
45816 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
45817         LDKProbabilisticScorer this_arg_conv;
45818         this_arg_conv.inner = untag_ptr(this_arg);
45819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45821         this_arg_conv.is_owned = false;
45822         LDKNodeId node_id_conv;
45823         node_id_conv.inner = untag_ptr(node_id);
45824         node_id_conv.is_owned = ptr_is_owned(node_id);
45825         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45826         node_id_conv.is_owned = false;
45827         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45828 }
45829
45830 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) {
45831         LDKProbabilisticScorer this_arg_conv;
45832         this_arg_conv.inner = untag_ptr(this_arg);
45833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45835         this_arg_conv.is_owned = false;
45836         LDKNodeId node_id_conv;
45837         node_id_conv.inner = untag_ptr(node_id);
45838         node_id_conv.is_owned = ptr_is_owned(node_id);
45839         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45840         node_id_conv.is_owned = false;
45841         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
45842 }
45843
45844 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
45845         LDKProbabilisticScorer this_arg_conv;
45846         this_arg_conv.inner = untag_ptr(this_arg);
45847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45849         this_arg_conv.is_owned = false;
45850         LDKNodeId node_id_conv;
45851         node_id_conv.inner = untag_ptr(node_id);
45852         node_id_conv.is_owned = ptr_is_owned(node_id);
45853         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45854         node_id_conv.is_owned = false;
45855         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
45856 }
45857
45858 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
45859         LDKProbabilisticScorer this_arg_conv;
45860         this_arg_conv.inner = untag_ptr(this_arg);
45861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45863         this_arg_conv.is_owned = false;
45864         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
45865 }
45866
45867 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
45868         LDKProbabilisticScoringParameters this_arg_conv;
45869         this_arg_conv.inner = untag_ptr(this_arg);
45870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45872         this_arg_conv.is_owned = false;
45873         LDKCVec_NodeIdZ node_ids_constr;
45874         node_ids_constr.datalen = node_ids->arr_len;
45875         if (node_ids_constr.datalen > 0)
45876                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45877         else
45878                 node_ids_constr.data = NULL;
45879         uint64_t* node_ids_vals = node_ids->elems;
45880         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45881                 uint64_t node_ids_conv_8 = node_ids_vals[i];
45882                 LDKNodeId node_ids_conv_8_conv;
45883                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
45884                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
45885                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45886                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45887                 node_ids_constr.data[i] = node_ids_conv_8_conv;
45888         }
45889         FREE(node_ids);
45890         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45891 }
45892
45893 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
45894         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45895         uint64_t ret_ref = 0;
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45898         return ret_ref;
45899 }
45900
45901 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
45902         LDKProbabilisticScorer this_arg_conv;
45903         this_arg_conv.inner = untag_ptr(this_arg);
45904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45906         this_arg_conv.is_owned = false;
45907         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45908         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45909         return tag_ptr(ret_ret, true);
45910 }
45911
45912 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
45913         LDKProbabilisticScorer obj_conv;
45914         obj_conv.inner = untag_ptr(obj);
45915         obj_conv.is_owned = ptr_is_owned(obj);
45916         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45917         obj_conv.is_owned = false;
45918         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45921         CVec_u8Z_free(ret_var);
45922         return ret_arr;
45923 }
45924
45925 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) {
45926         LDKu8slice ser_ref;
45927         ser_ref.datalen = ser->arr_len;
45928         ser_ref.data = ser->elems;
45929         LDKProbabilisticScoringParameters arg_a_conv;
45930         arg_a_conv.inner = untag_ptr(arg_a);
45931         arg_a_conv.is_owned = ptr_is_owned(arg_a);
45932         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45933         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45934         LDKNetworkGraph arg_b_conv;
45935         arg_b_conv.inner = untag_ptr(arg_b);
45936         arg_b_conv.is_owned = ptr_is_owned(arg_b);
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45938         arg_b_conv.is_owned = false;
45939         void* arg_c_ptr = untag_ptr(arg_c);
45940         CHECK_ACCESS(arg_c_ptr);
45941         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45942         if (arg_c_conv.free == LDKLogger_JCalls_free) {
45943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45944                 LDKLogger_JCalls_cloned(&arg_c_conv);
45945         }
45946         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45947         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45948         FREE(ser);
45949         return tag_ptr(ret_conv, true);
45950 }
45951
45952 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
45953         LDKBlindedPath this_obj_conv;
45954         this_obj_conv.inner = untag_ptr(this_obj);
45955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45957         BlindedPath_free(this_obj_conv);
45958 }
45959
45960 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
45961         LDKBlindedPath ret_var = BlindedPath_clone(arg);
45962         uint64_t ret_ref = 0;
45963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45965         return ret_ref;
45966 }
45967 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
45968         LDKBlindedPath arg_conv;
45969         arg_conv.inner = untag_ptr(arg);
45970         arg_conv.is_owned = ptr_is_owned(arg);
45971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45972         arg_conv.is_owned = false;
45973         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
45974         return ret_conv;
45975 }
45976
45977 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
45978         LDKBlindedPath orig_conv;
45979         orig_conv.inner = untag_ptr(orig);
45980         orig_conv.is_owned = ptr_is_owned(orig);
45981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45982         orig_conv.is_owned = false;
45983         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
45984         uint64_t ret_ref = 0;
45985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45987         return ret_ref;
45988 }
45989
45990 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
45991         LDKBlindedHop this_obj_conv;
45992         this_obj_conv.inner = untag_ptr(this_obj);
45993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45995         BlindedHop_free(this_obj_conv);
45996 }
45997
45998 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
45999         LDKBlindedHop ret_var = BlindedHop_clone(arg);
46000         uint64_t ret_ref = 0;
46001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46003         return ret_ref;
46004 }
46005 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
46006         LDKBlindedHop arg_conv;
46007         arg_conv.inner = untag_ptr(arg);
46008         arg_conv.is_owned = ptr_is_owned(arg);
46009         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46010         arg_conv.is_owned = false;
46011         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
46012         return ret_conv;
46013 }
46014
46015 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
46016         LDKBlindedHop orig_conv;
46017         orig_conv.inner = untag_ptr(orig);
46018         orig_conv.is_owned = ptr_is_owned(orig);
46019         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46020         orig_conv.is_owned = false;
46021         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
46022         uint64_t ret_ref = 0;
46023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46025         return ret_ref;
46026 }
46027
46028 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t keys_manager) {
46029         LDKCVec_PublicKeyZ node_pks_constr;
46030         node_pks_constr.datalen = node_pks->arr_len;
46031         if (node_pks_constr.datalen > 0)
46032                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46033         else
46034                 node_pks_constr.data = NULL;
46035         int8_tArray* node_pks_vals = (void*) node_pks->elems;
46036         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
46037                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
46038                 LDKPublicKey node_pks_conv_12_ref;
46039                 CHECK(node_pks_conv_12->arr_len == 33);
46040                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
46041                 node_pks_constr.data[m] = node_pks_conv_12_ref;
46042         }
46043         FREE(node_pks);
46044         void* keys_manager_ptr = untag_ptr(keys_manager);
46045         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
46046         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
46047         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
46048         *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv);
46049         return tag_ptr(ret_conv, true);
46050 }
46051
46052 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
46053         LDKBlindedPath obj_conv;
46054         obj_conv.inner = untag_ptr(obj);
46055         obj_conv.is_owned = ptr_is_owned(obj);
46056         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46057         obj_conv.is_owned = false;
46058         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
46059         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46060         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46061         CVec_u8Z_free(ret_var);
46062         return ret_arr;
46063 }
46064
46065 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
46066         LDKu8slice ser_ref;
46067         ser_ref.datalen = ser->arr_len;
46068         ser_ref.data = ser->elems;
46069         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
46070         *ret_conv = BlindedPath_read(ser_ref);
46071         FREE(ser);
46072         return tag_ptr(ret_conv, true);
46073 }
46074
46075 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
46076         LDKBlindedHop obj_conv;
46077         obj_conv.inner = untag_ptr(obj);
46078         obj_conv.is_owned = ptr_is_owned(obj);
46079         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46080         obj_conv.is_owned = false;
46081         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
46082         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46083         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46084         CVec_u8Z_free(ret_var);
46085         return ret_arr;
46086 }
46087
46088 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
46089         LDKu8slice ser_ref;
46090         ser_ref.datalen = ser->arr_len;
46091         ser_ref.data = ser->elems;
46092         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
46093         *ret_conv = BlindedHop_read(ser_ref);
46094         FREE(ser);
46095         return tag_ptr(ret_conv, true);
46096 }
46097
46098 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
46099         LDKOnionMessenger this_obj_conv;
46100         this_obj_conv.inner = untag_ptr(this_obj);
46101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46103         OnionMessenger_free(this_obj_conv);
46104 }
46105
46106 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
46107         if (!ptr_is_owned(this_ptr)) return;
46108         void* this_ptr_ptr = untag_ptr(this_ptr);
46109         CHECK_ACCESS(this_ptr_ptr);
46110         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
46111         FREE(untag_ptr(this_ptr));
46112         Destination_free(this_ptr_conv);
46113 }
46114
46115 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
46116         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46117         *ret_copy = Destination_clone(arg);
46118         uint64_t ret_ref = tag_ptr(ret_copy, true);
46119         return ret_ref;
46120 }
46121 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
46122         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
46123         int64_t ret_conv = Destination_clone_ptr(arg_conv);
46124         return ret_conv;
46125 }
46126
46127 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
46128         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
46129         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46130         *ret_copy = Destination_clone(orig_conv);
46131         uint64_t ret_ref = tag_ptr(ret_copy, true);
46132         return ret_ref;
46133 }
46134
46135 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
46136         LDKPublicKey a_ref;
46137         CHECK(a->arr_len == 33);
46138         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
46139         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46140         *ret_copy = Destination_node(a_ref);
46141         uint64_t ret_ref = tag_ptr(ret_copy, true);
46142         return ret_ref;
46143 }
46144
46145 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
46146         LDKBlindedPath a_conv;
46147         a_conv.inner = untag_ptr(a);
46148         a_conv.is_owned = ptr_is_owned(a);
46149         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46150         a_conv = BlindedPath_clone(&a_conv);
46151         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46152         *ret_copy = Destination_blinded_path(a_conv);
46153         uint64_t ret_ref = tag_ptr(ret_copy, true);
46154         return ret_ref;
46155 }
46156
46157 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
46158         if (!ptr_is_owned(this_ptr)) return;
46159         void* this_ptr_ptr = untag_ptr(this_ptr);
46160         CHECK_ACCESS(this_ptr_ptr);
46161         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
46162         FREE(untag_ptr(this_ptr));
46163         SendError_free(this_ptr_conv);
46164 }
46165
46166 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
46167         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46168         *ret_copy = SendError_clone(arg);
46169         uint64_t ret_ref = tag_ptr(ret_copy, true);
46170         return ret_ref;
46171 }
46172 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
46173         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
46174         int64_t ret_conv = SendError_clone_ptr(arg_conv);
46175         return ret_conv;
46176 }
46177
46178 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
46179         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
46180         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46181         *ret_copy = SendError_clone(orig_conv);
46182         uint64_t ret_ref = tag_ptr(ret_copy, true);
46183         return ret_ref;
46184 }
46185
46186 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
46187         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
46188         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46189         *ret_copy = SendError_secp256k1(a_conv);
46190         uint64_t ret_ref = tag_ptr(ret_copy, true);
46191         return ret_ref;
46192 }
46193
46194 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
46195         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46196         *ret_copy = SendError_too_big_packet();
46197         uint64_t ret_ref = tag_ptr(ret_copy, true);
46198         return ret_ref;
46199 }
46200
46201 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
46202         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46203         *ret_copy = SendError_too_few_blinded_hops();
46204         uint64_t ret_ref = tag_ptr(ret_copy, true);
46205         return ret_ref;
46206 }
46207
46208 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
46209         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46210         *ret_copy = SendError_invalid_first_hop();
46211         uint64_t ret_ref = tag_ptr(ret_copy, true);
46212         return ret_ref;
46213 }
46214
46215 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
46216         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46217         *ret_copy = SendError_invalid_message();
46218         uint64_t ret_ref = tag_ptr(ret_copy, true);
46219         return ret_ref;
46220 }
46221
46222 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
46223         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46224         *ret_copy = SendError_buffer_full();
46225         uint64_t ret_ref = tag_ptr(ret_copy, true);
46226         return ret_ref;
46227 }
46228
46229 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
46230         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46231         *ret_copy = SendError_get_node_id_failed();
46232         uint64_t ret_ref = tag_ptr(ret_copy, true);
46233         return ret_ref;
46234 }
46235
46236 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
46237         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46238         *ret_copy = SendError_blinded_path_advance_failed();
46239         uint64_t ret_ref = tag_ptr(ret_copy, true);
46240         return ret_ref;
46241 }
46242
46243 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
46244         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
46245         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
46246         jboolean ret_conv = SendError_eq(a_conv, b_conv);
46247         return ret_conv;
46248 }
46249
46250 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
46251         if (!ptr_is_owned(this_ptr)) return;
46252         void* this_ptr_ptr = untag_ptr(this_ptr);
46253         CHECK_ACCESS(this_ptr_ptr);
46254         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
46255         FREE(untag_ptr(this_ptr));
46256         CustomOnionMessageHandler_free(this_ptr_conv);
46257 }
46258
46259 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger, uint64_t custom_handler) {
46260         void* keys_manager_ptr = untag_ptr(keys_manager);
46261         CHECK_ACCESS(keys_manager_ptr);
46262         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46263         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46264                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46265                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46266         }
46267         void* logger_ptr = untag_ptr(logger);
46268         CHECK_ACCESS(logger_ptr);
46269         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46270         if (logger_conv.free == LDKLogger_JCalls_free) {
46271                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46272                 LDKLogger_JCalls_cloned(&logger_conv);
46273         }
46274         void* custom_handler_ptr = untag_ptr(custom_handler);
46275         CHECK_ACCESS(custom_handler_ptr);
46276         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
46277         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
46278                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46279                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
46280         }
46281         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_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 uint64_t  __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t message, uint64_t reply_path) {
46289         LDKOnionMessenger 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         LDKCVec_PublicKeyZ intermediate_nodes_constr;
46295         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
46296         if (intermediate_nodes_constr.datalen > 0)
46297                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46298         else
46299                 intermediate_nodes_constr.data = NULL;
46300         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
46301         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
46302                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
46303                 LDKPublicKey intermediate_nodes_conv_12_ref;
46304                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
46305                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
46306                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
46307         }
46308         FREE(intermediate_nodes);
46309         void* destination_ptr = untag_ptr(destination);
46310         CHECK_ACCESS(destination_ptr);
46311         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
46312         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
46313         void* message_ptr = untag_ptr(message);
46314         CHECK_ACCESS(message_ptr);
46315         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
46316         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
46317         LDKBlindedPath reply_path_conv;
46318         reply_path_conv.inner = untag_ptr(reply_path);
46319         reply_path_conv.is_owned = ptr_is_owned(reply_path);
46320         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
46321         reply_path_conv = BlindedPath_clone(&reply_path_conv);
46322         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
46323         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
46324         return tag_ptr(ret_conv, true);
46325 }
46326
46327 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
46328         LDKOnionMessenger this_arg_conv;
46329         this_arg_conv.inner = untag_ptr(this_arg);
46330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46332         this_arg_conv.is_owned = false;
46333         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46334         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
46335         return tag_ptr(ret_ret, true);
46336 }
46337
46338 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
46339         LDKOnionMessenger this_arg_conv;
46340         this_arg_conv.inner = untag_ptr(this_arg);
46341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46343         this_arg_conv.is_owned = false;
46344         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
46345         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
46346         return tag_ptr(ret_ret, true);
46347 }
46348
46349 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
46350         if (!ptr_is_owned(this_ptr)) return;
46351         void* this_ptr_ptr = untag_ptr(this_ptr);
46352         CHECK_ACCESS(this_ptr_ptr);
46353         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
46354         FREE(untag_ptr(this_ptr));
46355         OnionMessageContents_free(this_ptr_conv);
46356 }
46357
46358 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
46359         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46360         *ret_copy = OnionMessageContents_clone(arg);
46361         uint64_t ret_ref = tag_ptr(ret_copy, true);
46362         return ret_ref;
46363 }
46364 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
46365         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
46366         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
46367         return ret_conv;
46368 }
46369
46370 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
46371         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
46372         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46373         *ret_copy = OnionMessageContents_clone(orig_conv);
46374         uint64_t ret_ref = tag_ptr(ret_copy, true);
46375         return ret_ref;
46376 }
46377
46378 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
46379         void* a_ptr = untag_ptr(a);
46380         CHECK_ACCESS(a_ptr);
46381         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
46382         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
46383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46384                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
46385         }
46386         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46387         *ret_copy = OnionMessageContents_custom(a_conv);
46388         uint64_t ret_ref = tag_ptr(ret_copy, true);
46389         return ret_ref;
46390 }
46391
46392 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
46393         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
46394         *ret_ret = CustomOnionMessageContents_clone(arg);
46395         return tag_ptr(ret_ret, true);
46396 }
46397 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
46398         void* arg_ptr = untag_ptr(arg);
46399         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46400         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
46401         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
46402         return ret_conv;
46403 }
46404
46405 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
46406         void* orig_ptr = untag_ptr(orig);
46407         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46408         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
46409         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
46410         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
46411         return tag_ptr(ret_ret, true);
46412 }
46413
46414 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
46415         if (!ptr_is_owned(this_ptr)) return;
46416         void* this_ptr_ptr = untag_ptr(this_ptr);
46417         CHECK_ACCESS(this_ptr_ptr);
46418         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
46419         FREE(untag_ptr(this_ptr));
46420         CustomOnionMessageContents_free(this_ptr_conv);
46421 }
46422
46423 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
46424         LDKRapidGossipSync this_obj_conv;
46425         this_obj_conv.inner = untag_ptr(this_obj);
46426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46428         RapidGossipSync_free(this_obj_conv);
46429 }
46430
46431 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
46432         LDKNetworkGraph network_graph_conv;
46433         network_graph_conv.inner = untag_ptr(network_graph);
46434         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46435         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46436         network_graph_conv.is_owned = false;
46437         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
46438         uint64_t ret_ref = 0;
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46441         return ret_ref;
46442 }
46443
46444 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
46445         LDKRapidGossipSync 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         LDKu8slice update_data_ref;
46451         update_data_ref.datalen = update_data->arr_len;
46452         update_data_ref.data = update_data->elems;
46453         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
46454         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
46455         FREE(update_data);
46456         return tag_ptr(ret_conv, true);
46457 }
46458
46459 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
46460         LDKRapidGossipSync this_arg_conv;
46461         this_arg_conv.inner = untag_ptr(this_arg);
46462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46464         this_arg_conv.is_owned = false;
46465         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
46466         return ret_conv;
46467 }
46468
46469 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
46470         if (!ptr_is_owned(this_ptr)) return;
46471         void* this_ptr_ptr = untag_ptr(this_ptr);
46472         CHECK_ACCESS(this_ptr_ptr);
46473         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
46474         FREE(untag_ptr(this_ptr));
46475         GraphSyncError_free(this_ptr_conv);
46476 }
46477
46478 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
46479         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46480         *ret_copy = GraphSyncError_clone(arg);
46481         uint64_t ret_ref = tag_ptr(ret_copy, true);
46482         return ret_ref;
46483 }
46484 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
46485         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
46486         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
46487         return ret_conv;
46488 }
46489
46490 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
46491         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
46492         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46493         *ret_copy = GraphSyncError_clone(orig_conv);
46494         uint64_t ret_ref = tag_ptr(ret_copy, true);
46495         return ret_ref;
46496 }
46497
46498 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
46499         void* a_ptr = untag_ptr(a);
46500         CHECK_ACCESS(a_ptr);
46501         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
46502         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
46503         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46504         *ret_copy = GraphSyncError_decode_error(a_conv);
46505         uint64_t ret_ref = tag_ptr(ret_copy, true);
46506         return ret_ref;
46507 }
46508
46509 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
46510         LDKLightningError a_conv;
46511         a_conv.inner = untag_ptr(a);
46512         a_conv.is_owned = ptr_is_owned(a);
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46514         a_conv = LightningError_clone(&a_conv);
46515         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46516         *ret_copy = GraphSyncError_lightning_error(a_conv);
46517         uint64_t ret_ref = tag_ptr(ret_copy, true);
46518         return ret_ref;
46519 }
46520
46521 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
46522         if (!ptr_is_owned(this_ptr)) return;
46523         void* this_ptr_ptr = untag_ptr(this_ptr);
46524         CHECK_ACCESS(this_ptr_ptr);
46525         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
46526         FREE(untag_ptr(this_ptr));
46527         ParseError_free(this_ptr_conv);
46528 }
46529
46530 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
46531         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46532         *ret_copy = ParseError_clone(arg);
46533         uint64_t ret_ref = tag_ptr(ret_copy, true);
46534         return ret_ref;
46535 }
46536 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
46537         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
46538         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
46539         return ret_conv;
46540 }
46541
46542 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
46543         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
46544         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46545         *ret_copy = ParseError_clone(orig_conv);
46546         uint64_t ret_ref = tag_ptr(ret_copy, true);
46547         return ret_ref;
46548 }
46549
46550 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
46551         void* a_ptr = untag_ptr(a);
46552         CHECK_ACCESS(a_ptr);
46553         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
46554         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
46555         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46556         *ret_copy = ParseError_bech32_error(a_conv);
46557         uint64_t ret_ref = tag_ptr(ret_copy, true);
46558         return ret_ref;
46559 }
46560
46561 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
46562         
46563         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46564         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
46565         uint64_t ret_ref = tag_ptr(ret_copy, true);
46566         return ret_ref;
46567 }
46568
46569 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
46570         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
46571         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46572         *ret_copy = ParseError_malformed_signature(a_conv);
46573         uint64_t ret_ref = tag_ptr(ret_copy, true);
46574         return ret_ref;
46575 }
46576
46577 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
46578         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46579         *ret_copy = ParseError_bad_prefix();
46580         uint64_t ret_ref = tag_ptr(ret_copy, true);
46581         return ret_ref;
46582 }
46583
46584 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
46585         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46586         *ret_copy = ParseError_unknown_currency();
46587         uint64_t ret_ref = tag_ptr(ret_copy, true);
46588         return ret_ref;
46589 }
46590
46591 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
46592         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46593         *ret_copy = ParseError_unknown_si_prefix();
46594         uint64_t ret_ref = tag_ptr(ret_copy, true);
46595         return ret_ref;
46596 }
46597
46598 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
46599         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46600         *ret_copy = ParseError_malformed_hrp();
46601         uint64_t ret_ref = tag_ptr(ret_copy, true);
46602         return ret_ref;
46603 }
46604
46605 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
46606         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46607         *ret_copy = ParseError_too_short_data_part();
46608         uint64_t ret_ref = tag_ptr(ret_copy, true);
46609         return ret_ref;
46610 }
46611
46612 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
46613         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46614         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
46615         uint64_t ret_ref = tag_ptr(ret_copy, true);
46616         return ret_ref;
46617 }
46618
46619 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
46620         
46621         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46622         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
46623         uint64_t ret_ref = tag_ptr(ret_copy, true);
46624         return ret_ref;
46625 }
46626
46627 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
46628         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46629         *ret_copy = ParseError_padding_error();
46630         uint64_t ret_ref = tag_ptr(ret_copy, true);
46631         return ret_ref;
46632 }
46633
46634 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
46635         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46636         *ret_copy = ParseError_integer_overflow_error();
46637         uint64_t ret_ref = tag_ptr(ret_copy, true);
46638         return ret_ref;
46639 }
46640
46641 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
46642         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46643         *ret_copy = ParseError_invalid_seg_wit_program_length();
46644         uint64_t ret_ref = tag_ptr(ret_copy, true);
46645         return ret_ref;
46646 }
46647
46648 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
46649         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46650         *ret_copy = ParseError_invalid_pub_key_hash_length();
46651         uint64_t ret_ref = tag_ptr(ret_copy, true);
46652         return ret_ref;
46653 }
46654
46655 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
46656         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46657         *ret_copy = ParseError_invalid_script_hash_length();
46658         uint64_t ret_ref = tag_ptr(ret_copy, true);
46659         return ret_ref;
46660 }
46661
46662 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
46663         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46664         *ret_copy = ParseError_invalid_recovery_id();
46665         uint64_t ret_ref = tag_ptr(ret_copy, true);
46666         return ret_ref;
46667 }
46668
46669 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
46670         LDKStr a_conv = str_ref_to_owned_c(a);
46671         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46672         *ret_copy = ParseError_invalid_slice_length(a_conv);
46673         uint64_t ret_ref = tag_ptr(ret_copy, true);
46674         return ret_ref;
46675 }
46676
46677 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
46678         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46679         *ret_copy = ParseError_skip();
46680         uint64_t ret_ref = tag_ptr(ret_copy, true);
46681         return ret_ref;
46682 }
46683
46684 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
46685         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
46686         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
46687         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
46688         return ret_conv;
46689 }
46690
46691 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
46692         if (!ptr_is_owned(this_ptr)) return;
46693         void* this_ptr_ptr = untag_ptr(this_ptr);
46694         CHECK_ACCESS(this_ptr_ptr);
46695         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
46696         FREE(untag_ptr(this_ptr));
46697         ParseOrSemanticError_free(this_ptr_conv);
46698 }
46699
46700 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
46701         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46702         *ret_copy = ParseOrSemanticError_clone(arg);
46703         uint64_t ret_ref = tag_ptr(ret_copy, true);
46704         return ret_ref;
46705 }
46706 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
46707         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
46708         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
46709         return ret_conv;
46710 }
46711
46712 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
46713         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
46714         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46715         *ret_copy = ParseOrSemanticError_clone(orig_conv);
46716         uint64_t ret_ref = tag_ptr(ret_copy, true);
46717         return ret_ref;
46718 }
46719
46720 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
46721         void* a_ptr = untag_ptr(a);
46722         CHECK_ACCESS(a_ptr);
46723         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
46724         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
46725         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46726         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
46727         uint64_t ret_ref = tag_ptr(ret_copy, true);
46728         return ret_ref;
46729 }
46730
46731 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
46732         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
46733         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46734         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
46735         uint64_t ret_ref = tag_ptr(ret_copy, true);
46736         return ret_ref;
46737 }
46738
46739 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
46740         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
46741         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
46742         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
46743         return ret_conv;
46744 }
46745
46746 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
46747         LDKInvoice this_obj_conv;
46748         this_obj_conv.inner = untag_ptr(this_obj);
46749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46751         Invoice_free(this_obj_conv);
46752 }
46753
46754 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
46755         LDKInvoice a_conv;
46756         a_conv.inner = untag_ptr(a);
46757         a_conv.is_owned = ptr_is_owned(a);
46758         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46759         a_conv.is_owned = false;
46760         LDKInvoice b_conv;
46761         b_conv.inner = untag_ptr(b);
46762         b_conv.is_owned = ptr_is_owned(b);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46764         b_conv.is_owned = false;
46765         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
46766         return ret_conv;
46767 }
46768
46769 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
46770         LDKInvoice ret_var = Invoice_clone(arg);
46771         uint64_t ret_ref = 0;
46772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46774         return ret_ref;
46775 }
46776 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
46777         LDKInvoice arg_conv;
46778         arg_conv.inner = untag_ptr(arg);
46779         arg_conv.is_owned = ptr_is_owned(arg);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46781         arg_conv.is_owned = false;
46782         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
46783         return ret_conv;
46784 }
46785
46786 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
46787         LDKInvoice orig_conv;
46788         orig_conv.inner = untag_ptr(orig);
46789         orig_conv.is_owned = ptr_is_owned(orig);
46790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46791         orig_conv.is_owned = false;
46792         LDKInvoice ret_var = Invoice_clone(&orig_conv);
46793         uint64_t ret_ref = 0;
46794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46796         return ret_ref;
46797 }
46798
46799 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
46800         LDKInvoice o_conv;
46801         o_conv.inner = untag_ptr(o);
46802         o_conv.is_owned = ptr_is_owned(o);
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46804         o_conv.is_owned = false;
46805         int64_t ret_conv = Invoice_hash(&o_conv);
46806         return ret_conv;
46807 }
46808
46809 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
46810         LDKSignedRawInvoice this_obj_conv;
46811         this_obj_conv.inner = untag_ptr(this_obj);
46812         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46814         SignedRawInvoice_free(this_obj_conv);
46815 }
46816
46817 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
46818         LDKSignedRawInvoice a_conv;
46819         a_conv.inner = untag_ptr(a);
46820         a_conv.is_owned = ptr_is_owned(a);
46821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46822         a_conv.is_owned = false;
46823         LDKSignedRawInvoice b_conv;
46824         b_conv.inner = untag_ptr(b);
46825         b_conv.is_owned = ptr_is_owned(b);
46826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46827         b_conv.is_owned = false;
46828         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
46829         return ret_conv;
46830 }
46831
46832 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
46833         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
46834         uint64_t ret_ref = 0;
46835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46837         return ret_ref;
46838 }
46839 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
46840         LDKSignedRawInvoice arg_conv;
46841         arg_conv.inner = untag_ptr(arg);
46842         arg_conv.is_owned = ptr_is_owned(arg);
46843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46844         arg_conv.is_owned = false;
46845         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
46846         return ret_conv;
46847 }
46848
46849 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
46850         LDKSignedRawInvoice orig_conv;
46851         orig_conv.inner = untag_ptr(orig);
46852         orig_conv.is_owned = ptr_is_owned(orig);
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46854         orig_conv.is_owned = false;
46855         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
46856         uint64_t ret_ref = 0;
46857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46859         return ret_ref;
46860 }
46861
46862 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
46863         LDKSignedRawInvoice o_conv;
46864         o_conv.inner = untag_ptr(o);
46865         o_conv.is_owned = ptr_is_owned(o);
46866         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46867         o_conv.is_owned = false;
46868         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
46869         return ret_conv;
46870 }
46871
46872 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
46873         LDKRawInvoice this_obj_conv;
46874         this_obj_conv.inner = untag_ptr(this_obj);
46875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46877         RawInvoice_free(this_obj_conv);
46878 }
46879
46880 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
46881         LDKRawInvoice this_ptr_conv;
46882         this_ptr_conv.inner = untag_ptr(this_ptr);
46883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46885         this_ptr_conv.is_owned = false;
46886         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
46887         uint64_t ret_ref = 0;
46888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46890         return ret_ref;
46891 }
46892
46893 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
46894         LDKRawInvoice this_ptr_conv;
46895         this_ptr_conv.inner = untag_ptr(this_ptr);
46896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46898         this_ptr_conv.is_owned = false;
46899         LDKRawDataPart val_conv;
46900         val_conv.inner = untag_ptr(val);
46901         val_conv.is_owned = ptr_is_owned(val);
46902         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46903         val_conv = RawDataPart_clone(&val_conv);
46904         RawInvoice_set_data(&this_ptr_conv, val_conv);
46905 }
46906
46907 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
46908         LDKRawInvoice a_conv;
46909         a_conv.inner = untag_ptr(a);
46910         a_conv.is_owned = ptr_is_owned(a);
46911         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46912         a_conv.is_owned = false;
46913         LDKRawInvoice b_conv;
46914         b_conv.inner = untag_ptr(b);
46915         b_conv.is_owned = ptr_is_owned(b);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46917         b_conv.is_owned = false;
46918         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
46919         return ret_conv;
46920 }
46921
46922 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
46923         LDKRawInvoice ret_var = RawInvoice_clone(arg);
46924         uint64_t ret_ref = 0;
46925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46927         return ret_ref;
46928 }
46929 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
46930         LDKRawInvoice arg_conv;
46931         arg_conv.inner = untag_ptr(arg);
46932         arg_conv.is_owned = ptr_is_owned(arg);
46933         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46934         arg_conv.is_owned = false;
46935         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
46936         return ret_conv;
46937 }
46938
46939 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
46940         LDKRawInvoice orig_conv;
46941         orig_conv.inner = untag_ptr(orig);
46942         orig_conv.is_owned = ptr_is_owned(orig);
46943         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46944         orig_conv.is_owned = false;
46945         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46946         uint64_t ret_ref = 0;
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46949         return ret_ref;
46950 }
46951
46952 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
46953         LDKRawInvoice o_conv;
46954         o_conv.inner = untag_ptr(o);
46955         o_conv.is_owned = ptr_is_owned(o);
46956         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46957         o_conv.is_owned = false;
46958         int64_t ret_conv = RawInvoice_hash(&o_conv);
46959         return ret_conv;
46960 }
46961
46962 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
46963         LDKRawDataPart this_obj_conv;
46964         this_obj_conv.inner = untag_ptr(this_obj);
46965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46967         RawDataPart_free(this_obj_conv);
46968 }
46969
46970 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
46971         LDKRawDataPart this_ptr_conv;
46972         this_ptr_conv.inner = untag_ptr(this_ptr);
46973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46975         this_ptr_conv.is_owned = false;
46976         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46977         uint64_t ret_ref = 0;
46978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46980         return ret_ref;
46981 }
46982
46983 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
46984         LDKRawDataPart this_ptr_conv;
46985         this_ptr_conv.inner = untag_ptr(this_ptr);
46986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46988         this_ptr_conv.is_owned = false;
46989         LDKPositiveTimestamp val_conv;
46990         val_conv.inner = untag_ptr(val);
46991         val_conv.is_owned = ptr_is_owned(val);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46993         val_conv = PositiveTimestamp_clone(&val_conv);
46994         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46995 }
46996
46997 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
46998         LDKRawDataPart a_conv;
46999         a_conv.inner = untag_ptr(a);
47000         a_conv.is_owned = ptr_is_owned(a);
47001         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47002         a_conv.is_owned = false;
47003         LDKRawDataPart b_conv;
47004         b_conv.inner = untag_ptr(b);
47005         b_conv.is_owned = ptr_is_owned(b);
47006         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47007         b_conv.is_owned = false;
47008         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
47009         return ret_conv;
47010 }
47011
47012 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
47013         LDKRawDataPart ret_var = RawDataPart_clone(arg);
47014         uint64_t ret_ref = 0;
47015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47017         return ret_ref;
47018 }
47019 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
47020         LDKRawDataPart arg_conv;
47021         arg_conv.inner = untag_ptr(arg);
47022         arg_conv.is_owned = ptr_is_owned(arg);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47024         arg_conv.is_owned = false;
47025         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
47026         return ret_conv;
47027 }
47028
47029 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
47030         LDKRawDataPart orig_conv;
47031         orig_conv.inner = untag_ptr(orig);
47032         orig_conv.is_owned = ptr_is_owned(orig);
47033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47034         orig_conv.is_owned = false;
47035         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
47036         uint64_t ret_ref = 0;
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47039         return ret_ref;
47040 }
47041
47042 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
47043         LDKRawDataPart o_conv;
47044         o_conv.inner = untag_ptr(o);
47045         o_conv.is_owned = ptr_is_owned(o);
47046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47047         o_conv.is_owned = false;
47048         int64_t ret_conv = RawDataPart_hash(&o_conv);
47049         return ret_conv;
47050 }
47051
47052 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
47053         LDKPositiveTimestamp this_obj_conv;
47054         this_obj_conv.inner = untag_ptr(this_obj);
47055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47057         PositiveTimestamp_free(this_obj_conv);
47058 }
47059
47060 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
47061         LDKPositiveTimestamp a_conv;
47062         a_conv.inner = untag_ptr(a);
47063         a_conv.is_owned = ptr_is_owned(a);
47064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47065         a_conv.is_owned = false;
47066         LDKPositiveTimestamp b_conv;
47067         b_conv.inner = untag_ptr(b);
47068         b_conv.is_owned = ptr_is_owned(b);
47069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47070         b_conv.is_owned = false;
47071         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
47072         return ret_conv;
47073 }
47074
47075 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
47076         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
47077         uint64_t ret_ref = 0;
47078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47080         return ret_ref;
47081 }
47082 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
47083         LDKPositiveTimestamp arg_conv;
47084         arg_conv.inner = untag_ptr(arg);
47085         arg_conv.is_owned = ptr_is_owned(arg);
47086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47087         arg_conv.is_owned = false;
47088         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
47089         return ret_conv;
47090 }
47091
47092 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
47093         LDKPositiveTimestamp orig_conv;
47094         orig_conv.inner = untag_ptr(orig);
47095         orig_conv.is_owned = ptr_is_owned(orig);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47097         orig_conv.is_owned = false;
47098         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
47099         uint64_t ret_ref = 0;
47100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47102         return ret_ref;
47103 }
47104
47105 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
47106         LDKPositiveTimestamp o_conv;
47107         o_conv.inner = untag_ptr(o);
47108         o_conv.is_owned = ptr_is_owned(o);
47109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47110         o_conv.is_owned = false;
47111         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
47112         return ret_conv;
47113 }
47114
47115 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
47116         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
47117         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
47118         return ret_conv;
47119 }
47120
47121 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
47122         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
47123         return ret_conv;
47124 }
47125
47126 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
47127         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
47128         return ret_conv;
47129 }
47130
47131 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
47132         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
47133         return ret_conv;
47134 }
47135
47136 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
47137         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
47138         return ret_conv;
47139 }
47140
47141 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
47142         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
47143         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
47144         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
47145         return ret_conv;
47146 }
47147
47148 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
47149         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
47150         int64_t ret_conv = SiPrefix_hash(o_conv);
47151         return ret_conv;
47152 }
47153
47154 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
47155         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
47156         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
47157         return ret_conv;
47158 }
47159
47160 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
47161         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
47162         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
47163         return ret_conv;
47164 }
47165
47166 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
47167         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
47168         return ret_conv;
47169 }
47170
47171 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
47172         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
47173         return ret_conv;
47174 }
47175
47176 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
47177         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
47178         return ret_conv;
47179 }
47180
47181 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
47182         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
47183         return ret_conv;
47184 }
47185
47186 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
47187         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
47188         return ret_conv;
47189 }
47190
47191 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
47192         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
47193         int64_t ret_conv = Currency_hash(o_conv);
47194         return ret_conv;
47195 }
47196
47197 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
47198         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
47199         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
47200         jboolean ret_conv = Currency_eq(a_conv, b_conv);
47201         return ret_conv;
47202 }
47203
47204 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
47205         LDKSha256 this_obj_conv;
47206         this_obj_conv.inner = untag_ptr(this_obj);
47207         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47209         Sha256_free(this_obj_conv);
47210 }
47211
47212 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
47213         LDKSha256 ret_var = Sha256_clone(arg);
47214         uint64_t ret_ref = 0;
47215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47217         return ret_ref;
47218 }
47219 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
47220         LDKSha256 arg_conv;
47221         arg_conv.inner = untag_ptr(arg);
47222         arg_conv.is_owned = ptr_is_owned(arg);
47223         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47224         arg_conv.is_owned = false;
47225         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
47226         return ret_conv;
47227 }
47228
47229 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
47230         LDKSha256 orig_conv;
47231         orig_conv.inner = untag_ptr(orig);
47232         orig_conv.is_owned = ptr_is_owned(orig);
47233         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47234         orig_conv.is_owned = false;
47235         LDKSha256 ret_var = Sha256_clone(&orig_conv);
47236         uint64_t ret_ref = 0;
47237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47239         return ret_ref;
47240 }
47241
47242 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
47243         LDKSha256 o_conv;
47244         o_conv.inner = untag_ptr(o);
47245         o_conv.is_owned = ptr_is_owned(o);
47246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47247         o_conv.is_owned = false;
47248         int64_t ret_conv = Sha256_hash(&o_conv);
47249         return ret_conv;
47250 }
47251
47252 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
47253         LDKSha256 a_conv;
47254         a_conv.inner = untag_ptr(a);
47255         a_conv.is_owned = ptr_is_owned(a);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47257         a_conv.is_owned = false;
47258         LDKSha256 b_conv;
47259         b_conv.inner = untag_ptr(b);
47260         b_conv.is_owned = ptr_is_owned(b);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47262         b_conv.is_owned = false;
47263         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
47264         return ret_conv;
47265 }
47266
47267 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
47268         LDKDescription this_obj_conv;
47269         this_obj_conv.inner = untag_ptr(this_obj);
47270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47272         Description_free(this_obj_conv);
47273 }
47274
47275 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
47276         LDKDescription ret_var = Description_clone(arg);
47277         uint64_t ret_ref = 0;
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47280         return ret_ref;
47281 }
47282 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
47283         LDKDescription arg_conv;
47284         arg_conv.inner = untag_ptr(arg);
47285         arg_conv.is_owned = ptr_is_owned(arg);
47286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47287         arg_conv.is_owned = false;
47288         int64_t ret_conv = Description_clone_ptr(&arg_conv);
47289         return ret_conv;
47290 }
47291
47292 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
47293         LDKDescription orig_conv;
47294         orig_conv.inner = untag_ptr(orig);
47295         orig_conv.is_owned = ptr_is_owned(orig);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47297         orig_conv.is_owned = false;
47298         LDKDescription ret_var = Description_clone(&orig_conv);
47299         uint64_t ret_ref = 0;
47300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47302         return ret_ref;
47303 }
47304
47305 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
47306         LDKDescription 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         int64_t ret_conv = Description_hash(&o_conv);
47312         return ret_conv;
47313 }
47314
47315 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
47316         LDKDescription a_conv;
47317         a_conv.inner = untag_ptr(a);
47318         a_conv.is_owned = ptr_is_owned(a);
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47320         a_conv.is_owned = false;
47321         LDKDescription b_conv;
47322         b_conv.inner = untag_ptr(b);
47323         b_conv.is_owned = ptr_is_owned(b);
47324         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47325         b_conv.is_owned = false;
47326         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
47327         return ret_conv;
47328 }
47329
47330 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
47331         LDKPayeePubKey this_obj_conv;
47332         this_obj_conv.inner = untag_ptr(this_obj);
47333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47335         PayeePubKey_free(this_obj_conv);
47336 }
47337
47338 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
47339         LDKPayeePubKey this_ptr_conv;
47340         this_ptr_conv.inner = untag_ptr(this_ptr);
47341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47343         this_ptr_conv.is_owned = false;
47344         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47345         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
47346         return ret_arr;
47347 }
47348
47349 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
47350         LDKPayeePubKey this_ptr_conv;
47351         this_ptr_conv.inner = untag_ptr(this_ptr);
47352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47354         this_ptr_conv.is_owned = false;
47355         LDKPublicKey val_ref;
47356         CHECK(val->arr_len == 33);
47357         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47358         PayeePubKey_set_a(&this_ptr_conv, val_ref);
47359 }
47360
47361 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
47362         LDKPublicKey a_arg_ref;
47363         CHECK(a_arg->arr_len == 33);
47364         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
47365         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
47366         uint64_t ret_ref = 0;
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47369         return ret_ref;
47370 }
47371
47372 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
47373         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
47374         uint64_t ret_ref = 0;
47375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47377         return ret_ref;
47378 }
47379 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
47380         LDKPayeePubKey arg_conv;
47381         arg_conv.inner = untag_ptr(arg);
47382         arg_conv.is_owned = ptr_is_owned(arg);
47383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47384         arg_conv.is_owned = false;
47385         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
47386         return ret_conv;
47387 }
47388
47389 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
47390         LDKPayeePubKey orig_conv;
47391         orig_conv.inner = untag_ptr(orig);
47392         orig_conv.is_owned = ptr_is_owned(orig);
47393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47394         orig_conv.is_owned = false;
47395         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
47396         uint64_t ret_ref = 0;
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47399         return ret_ref;
47400 }
47401
47402 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
47403         LDKPayeePubKey o_conv;
47404         o_conv.inner = untag_ptr(o);
47405         o_conv.is_owned = ptr_is_owned(o);
47406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47407         o_conv.is_owned = false;
47408         int64_t ret_conv = PayeePubKey_hash(&o_conv);
47409         return ret_conv;
47410 }
47411
47412 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
47413         LDKPayeePubKey a_conv;
47414         a_conv.inner = untag_ptr(a);
47415         a_conv.is_owned = ptr_is_owned(a);
47416         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47417         a_conv.is_owned = false;
47418         LDKPayeePubKey b_conv;
47419         b_conv.inner = untag_ptr(b);
47420         b_conv.is_owned = ptr_is_owned(b);
47421         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47422         b_conv.is_owned = false;
47423         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
47424         return ret_conv;
47425 }
47426
47427 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
47428         LDKExpiryTime this_obj_conv;
47429         this_obj_conv.inner = untag_ptr(this_obj);
47430         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47432         ExpiryTime_free(this_obj_conv);
47433 }
47434
47435 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
47436         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
47437         uint64_t ret_ref = 0;
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47440         return ret_ref;
47441 }
47442 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
47443         LDKExpiryTime arg_conv;
47444         arg_conv.inner = untag_ptr(arg);
47445         arg_conv.is_owned = ptr_is_owned(arg);
47446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47447         arg_conv.is_owned = false;
47448         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
47449         return ret_conv;
47450 }
47451
47452 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
47453         LDKExpiryTime orig_conv;
47454         orig_conv.inner = untag_ptr(orig);
47455         orig_conv.is_owned = ptr_is_owned(orig);
47456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47457         orig_conv.is_owned = false;
47458         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
47459         uint64_t ret_ref = 0;
47460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47462         return ret_ref;
47463 }
47464
47465 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
47466         LDKExpiryTime o_conv;
47467         o_conv.inner = untag_ptr(o);
47468         o_conv.is_owned = ptr_is_owned(o);
47469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47470         o_conv.is_owned = false;
47471         int64_t ret_conv = ExpiryTime_hash(&o_conv);
47472         return ret_conv;
47473 }
47474
47475 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
47476         LDKExpiryTime a_conv;
47477         a_conv.inner = untag_ptr(a);
47478         a_conv.is_owned = ptr_is_owned(a);
47479         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47480         a_conv.is_owned = false;
47481         LDKExpiryTime b_conv;
47482         b_conv.inner = untag_ptr(b);
47483         b_conv.is_owned = ptr_is_owned(b);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47485         b_conv.is_owned = false;
47486         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
47487         return ret_conv;
47488 }
47489
47490 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
47491         LDKMinFinalCltvExpiry this_obj_conv;
47492         this_obj_conv.inner = untag_ptr(this_obj);
47493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47495         MinFinalCltvExpiry_free(this_obj_conv);
47496 }
47497
47498 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
47499         LDKMinFinalCltvExpiry this_ptr_conv;
47500         this_ptr_conv.inner = untag_ptr(this_ptr);
47501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47503         this_ptr_conv.is_owned = false;
47504         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
47505         return ret_conv;
47506 }
47507
47508 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
47509         LDKMinFinalCltvExpiry this_ptr_conv;
47510         this_ptr_conv.inner = untag_ptr(this_ptr);
47511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47513         this_ptr_conv.is_owned = false;
47514         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
47515 }
47516
47517 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
47518         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
47519         uint64_t ret_ref = 0;
47520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47522         return ret_ref;
47523 }
47524
47525 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
47526         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
47527         uint64_t ret_ref = 0;
47528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47530         return ret_ref;
47531 }
47532 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
47533         LDKMinFinalCltvExpiry arg_conv;
47534         arg_conv.inner = untag_ptr(arg);
47535         arg_conv.is_owned = ptr_is_owned(arg);
47536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47537         arg_conv.is_owned = false;
47538         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
47539         return ret_conv;
47540 }
47541
47542 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
47543         LDKMinFinalCltvExpiry orig_conv;
47544         orig_conv.inner = untag_ptr(orig);
47545         orig_conv.is_owned = ptr_is_owned(orig);
47546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47547         orig_conv.is_owned = false;
47548         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
47549         uint64_t ret_ref = 0;
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47552         return ret_ref;
47553 }
47554
47555 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
47556         LDKMinFinalCltvExpiry o_conv;
47557         o_conv.inner = untag_ptr(o);
47558         o_conv.is_owned = ptr_is_owned(o);
47559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47560         o_conv.is_owned = false;
47561         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
47562         return ret_conv;
47563 }
47564
47565 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
47566         LDKMinFinalCltvExpiry a_conv;
47567         a_conv.inner = untag_ptr(a);
47568         a_conv.is_owned = ptr_is_owned(a);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47570         a_conv.is_owned = false;
47571         LDKMinFinalCltvExpiry b_conv;
47572         b_conv.inner = untag_ptr(b);
47573         b_conv.is_owned = ptr_is_owned(b);
47574         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47575         b_conv.is_owned = false;
47576         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
47577         return ret_conv;
47578 }
47579
47580 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
47581         if (!ptr_is_owned(this_ptr)) return;
47582         void* this_ptr_ptr = untag_ptr(this_ptr);
47583         CHECK_ACCESS(this_ptr_ptr);
47584         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
47585         FREE(untag_ptr(this_ptr));
47586         Fallback_free(this_ptr_conv);
47587 }
47588
47589 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
47590         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47591         *ret_copy = Fallback_clone(arg);
47592         uint64_t ret_ref = tag_ptr(ret_copy, true);
47593         return ret_ref;
47594 }
47595 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
47596         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
47597         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
47598         return ret_conv;
47599 }
47600
47601 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
47602         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
47603         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47604         *ret_copy = Fallback_clone(orig_conv);
47605         uint64_t ret_ref = tag_ptr(ret_copy, true);
47606         return ret_ref;
47607 }
47608
47609 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
47610         
47611         LDKCVec_u8Z program_ref;
47612         program_ref.datalen = program->arr_len;
47613         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
47614         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
47615         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47616         *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref);
47617         uint64_t ret_ref = tag_ptr(ret_copy, true);
47618         return ret_ref;
47619 }
47620
47621 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
47622         LDKTwentyBytes a_ref;
47623         CHECK(a->arr_len == 20);
47624         memcpy(a_ref.data, a->elems, 20); FREE(a);
47625         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47626         *ret_copy = Fallback_pub_key_hash(a_ref);
47627         uint64_t ret_ref = tag_ptr(ret_copy, true);
47628         return ret_ref;
47629 }
47630
47631 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
47632         LDKTwentyBytes a_ref;
47633         CHECK(a->arr_len == 20);
47634         memcpy(a_ref.data, a->elems, 20); FREE(a);
47635         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47636         *ret_copy = Fallback_script_hash(a_ref);
47637         uint64_t ret_ref = tag_ptr(ret_copy, true);
47638         return ret_ref;
47639 }
47640
47641 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
47642         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
47643         int64_t ret_conv = Fallback_hash(o_conv);
47644         return ret_conv;
47645 }
47646
47647 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
47648         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
47649         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
47650         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
47651         return ret_conv;
47652 }
47653
47654 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
47655         LDKInvoiceSignature this_obj_conv;
47656         this_obj_conv.inner = untag_ptr(this_obj);
47657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47659         InvoiceSignature_free(this_obj_conv);
47660 }
47661
47662 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
47663         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
47664         uint64_t ret_ref = 0;
47665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47667         return ret_ref;
47668 }
47669 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
47670         LDKInvoiceSignature arg_conv;
47671         arg_conv.inner = untag_ptr(arg);
47672         arg_conv.is_owned = ptr_is_owned(arg);
47673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47674         arg_conv.is_owned = false;
47675         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
47676         return ret_conv;
47677 }
47678
47679 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
47680         LDKInvoiceSignature orig_conv;
47681         orig_conv.inner = untag_ptr(orig);
47682         orig_conv.is_owned = ptr_is_owned(orig);
47683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47684         orig_conv.is_owned = false;
47685         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
47686         uint64_t ret_ref = 0;
47687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47689         return ret_ref;
47690 }
47691
47692 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
47693         LDKInvoiceSignature o_conv;
47694         o_conv.inner = untag_ptr(o);
47695         o_conv.is_owned = ptr_is_owned(o);
47696         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47697         o_conv.is_owned = false;
47698         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
47699         return ret_conv;
47700 }
47701
47702 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
47703         LDKInvoiceSignature a_conv;
47704         a_conv.inner = untag_ptr(a);
47705         a_conv.is_owned = ptr_is_owned(a);
47706         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47707         a_conv.is_owned = false;
47708         LDKInvoiceSignature b_conv;
47709         b_conv.inner = untag_ptr(b);
47710         b_conv.is_owned = ptr_is_owned(b);
47711         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47712         b_conv.is_owned = false;
47713         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
47714         return ret_conv;
47715 }
47716
47717 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
47718         LDKPrivateRoute this_obj_conv;
47719         this_obj_conv.inner = untag_ptr(this_obj);
47720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47722         PrivateRoute_free(this_obj_conv);
47723 }
47724
47725 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
47726         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
47727         uint64_t ret_ref = 0;
47728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47730         return ret_ref;
47731 }
47732 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
47733         LDKPrivateRoute arg_conv;
47734         arg_conv.inner = untag_ptr(arg);
47735         arg_conv.is_owned = ptr_is_owned(arg);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47737         arg_conv.is_owned = false;
47738         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
47739         return ret_conv;
47740 }
47741
47742 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
47743         LDKPrivateRoute orig_conv;
47744         orig_conv.inner = untag_ptr(orig);
47745         orig_conv.is_owned = ptr_is_owned(orig);
47746         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47747         orig_conv.is_owned = false;
47748         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
47749         uint64_t ret_ref = 0;
47750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47752         return ret_ref;
47753 }
47754
47755 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
47756         LDKPrivateRoute o_conv;
47757         o_conv.inner = untag_ptr(o);
47758         o_conv.is_owned = ptr_is_owned(o);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47760         o_conv.is_owned = false;
47761         int64_t ret_conv = PrivateRoute_hash(&o_conv);
47762         return ret_conv;
47763 }
47764
47765 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
47766         LDKPrivateRoute a_conv;
47767         a_conv.inner = untag_ptr(a);
47768         a_conv.is_owned = ptr_is_owned(a);
47769         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47770         a_conv.is_owned = false;
47771         LDKPrivateRoute b_conv;
47772         b_conv.inner = untag_ptr(b);
47773         b_conv.is_owned = ptr_is_owned(b);
47774         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47775         b_conv.is_owned = false;
47776         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
47777         return ret_conv;
47778 }
47779
47780 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
47781         LDKSignedRawInvoice this_arg_conv;
47782         this_arg_conv.inner = untag_ptr(this_arg);
47783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47785         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
47786         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
47787         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
47788         return tag_ptr(ret_conv, true);
47789 }
47790
47791 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
47792         LDKSignedRawInvoice this_arg_conv;
47793         this_arg_conv.inner = untag_ptr(this_arg);
47794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47796         this_arg_conv.is_owned = false;
47797         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
47798         uint64_t ret_ref = 0;
47799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47801         return ret_ref;
47802 }
47803
47804 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
47805         LDKSignedRawInvoice this_arg_conv;
47806         this_arg_conv.inner = untag_ptr(this_arg);
47807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47809         this_arg_conv.is_owned = false;
47810         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47811         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
47812         return ret_arr;
47813 }
47814
47815 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
47816         LDKSignedRawInvoice this_arg_conv;
47817         this_arg_conv.inner = untag_ptr(this_arg);
47818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47820         this_arg_conv.is_owned = false;
47821         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
47822         uint64_t ret_ref = 0;
47823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47825         return ret_ref;
47826 }
47827
47828 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
47829         LDKSignedRawInvoice this_arg_conv;
47830         this_arg_conv.inner = untag_ptr(this_arg);
47831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47833         this_arg_conv.is_owned = false;
47834         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
47835         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
47836         return tag_ptr(ret_conv, true);
47837 }
47838
47839 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
47840         LDKSignedRawInvoice this_arg_conv;
47841         this_arg_conv.inner = untag_ptr(this_arg);
47842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47844         this_arg_conv.is_owned = false;
47845         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
47846         return ret_conv;
47847 }
47848
47849 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
47850         LDKRawInvoice this_arg_conv;
47851         this_arg_conv.inner = untag_ptr(this_arg);
47852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47854         this_arg_conv.is_owned = false;
47855         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47856         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
47857         return ret_arr;
47858 }
47859
47860 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
47861         LDKRawInvoice this_arg_conv;
47862         this_arg_conv.inner = untag_ptr(this_arg);
47863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47865         this_arg_conv.is_owned = false;
47866         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
47867         uint64_t ret_ref = 0;
47868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47870         return ret_ref;
47871 }
47872
47873 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
47874         LDKRawInvoice this_arg_conv;
47875         this_arg_conv.inner = untag_ptr(this_arg);
47876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47878         this_arg_conv.is_owned = false;
47879         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
47880         uint64_t ret_ref = 0;
47881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47883         return ret_ref;
47884 }
47885
47886 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
47887         LDKRawInvoice this_arg_conv;
47888         this_arg_conv.inner = untag_ptr(this_arg);
47889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47891         this_arg_conv.is_owned = false;
47892         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
47893         uint64_t ret_ref = 0;
47894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47896         return ret_ref;
47897 }
47898
47899 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
47900         LDKRawInvoice this_arg_conv;
47901         this_arg_conv.inner = untag_ptr(this_arg);
47902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47904         this_arg_conv.is_owned = false;
47905         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
47906         uint64_t ret_ref = 0;
47907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47909         return ret_ref;
47910 }
47911
47912 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
47913         LDKRawInvoice this_arg_conv;
47914         this_arg_conv.inner = untag_ptr(this_arg);
47915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47917         this_arg_conv.is_owned = false;
47918         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
47919         uint64_t ret_ref = 0;
47920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47922         return ret_ref;
47923 }
47924
47925 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
47926         LDKRawInvoice this_arg_conv;
47927         this_arg_conv.inner = untag_ptr(this_arg);
47928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47930         this_arg_conv.is_owned = false;
47931         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
47932         uint64_t ret_ref = 0;
47933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47935         return ret_ref;
47936 }
47937
47938 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
47939         LDKRawInvoice this_arg_conv;
47940         this_arg_conv.inner = untag_ptr(this_arg);
47941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47943         this_arg_conv.is_owned = false;
47944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47945         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
47946         return ret_arr;
47947 }
47948
47949 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
47950         LDKRawInvoice this_arg_conv;
47951         this_arg_conv.inner = untag_ptr(this_arg);
47952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47954         this_arg_conv.is_owned = false;
47955         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
47956         uint64_t ret_ref = 0;
47957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47959         return ret_ref;
47960 }
47961
47962 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
47963         LDKRawInvoice this_arg_conv;
47964         this_arg_conv.inner = untag_ptr(this_arg);
47965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47967         this_arg_conv.is_owned = false;
47968         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
47969         uint64_tArray ret_arr = NULL;
47970         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47971         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47972         for (size_t o = 0; o < ret_var.datalen; o++) {
47973                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47974                 uint64_t ret_conv_14_ref = 0;
47975                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47976                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47977                 ret_arr_ptr[o] = ret_conv_14_ref;
47978         }
47979         
47980         FREE(ret_var.data);
47981         return ret_arr;
47982 }
47983
47984 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
47985         LDKRawInvoice this_arg_conv;
47986         this_arg_conv.inner = untag_ptr(this_arg);
47987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47989         this_arg_conv.is_owned = false;
47990         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47991         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47992         uint64_t ret_ref = tag_ptr(ret_copy, true);
47993         return ret_ref;
47994 }
47995
47996 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
47997         LDKRawInvoice this_arg_conv;
47998         this_arg_conv.inner = untag_ptr(this_arg);
47999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48001         this_arg_conv.is_owned = false;
48002         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
48003         return ret_conv;
48004 }
48005
48006 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
48007         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48008         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
48009         return tag_ptr(ret_conv, true);
48010 }
48011
48012 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
48013         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48014         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
48015         return tag_ptr(ret_conv, true);
48016 }
48017
48018 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
48019         LDKPositiveTimestamp this_arg_conv;
48020         this_arg_conv.inner = untag_ptr(this_arg);
48021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48023         this_arg_conv.is_owned = false;
48024         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
48025         return ret_conv;
48026 }
48027
48028 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
48029         LDKPositiveTimestamp this_arg_conv;
48030         this_arg_conv.inner = untag_ptr(this_arg);
48031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48033         this_arg_conv.is_owned = false;
48034         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
48035         return ret_conv;
48036 }
48037
48038 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
48039         LDKInvoice this_arg_conv;
48040         this_arg_conv.inner = untag_ptr(this_arg);
48041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48043         this_arg_conv = Invoice_clone(&this_arg_conv);
48044         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
48045         uint64_t ret_ref = 0;
48046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48048         return ret_ref;
48049 }
48050
48051 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
48052         LDKInvoice this_arg_conv;
48053         this_arg_conv.inner = untag_ptr(this_arg);
48054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48056         this_arg_conv.is_owned = false;
48057         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
48058         *ret_conv = Invoice_check_signature(&this_arg_conv);
48059         return tag_ptr(ret_conv, true);
48060 }
48061
48062 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
48063         LDKSignedRawInvoice signed_invoice_conv;
48064         signed_invoice_conv.inner = untag_ptr(signed_invoice);
48065         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
48066         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
48067         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
48068         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
48069         *ret_conv = Invoice_from_signed(signed_invoice_conv);
48070         return tag_ptr(ret_conv, true);
48071 }
48072
48073 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
48074         LDKInvoice this_arg_conv;
48075         this_arg_conv.inner = untag_ptr(this_arg);
48076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48078         this_arg_conv.is_owned = false;
48079         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
48080         return ret_conv;
48081 }
48082
48083 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
48084         LDKInvoice this_arg_conv;
48085         this_arg_conv.inner = untag_ptr(this_arg);
48086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48088         this_arg_conv.is_owned = false;
48089         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48090         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
48091         return ret_arr;
48092 }
48093
48094 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
48095         LDKInvoice this_arg_conv;
48096         this_arg_conv.inner = untag_ptr(this_arg);
48097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48099         this_arg_conv.is_owned = false;
48100         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48101         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
48102         return ret_arr;
48103 }
48104
48105 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
48106         LDKInvoice this_arg_conv;
48107         this_arg_conv.inner = untag_ptr(this_arg);
48108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48110         this_arg_conv.is_owned = false;
48111         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48112         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
48113         return ret_arr;
48114 }
48115
48116 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
48117         LDKInvoice this_arg_conv;
48118         this_arg_conv.inner = untag_ptr(this_arg);
48119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48121         this_arg_conv.is_owned = false;
48122         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
48123         uint64_t ret_ref = 0;
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48126         return ret_ref;
48127 }
48128
48129 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
48130         LDKInvoice this_arg_conv;
48131         this_arg_conv.inner = untag_ptr(this_arg);
48132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48134         this_arg_conv.is_owned = false;
48135         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48136         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
48137         return ret_arr;
48138 }
48139
48140 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
48141         LDKInvoice this_arg_conv;
48142         this_arg_conv.inner = untag_ptr(this_arg);
48143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48145         this_arg_conv.is_owned = false;
48146         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
48147         return ret_conv;
48148 }
48149
48150 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
48151         LDKInvoice this_arg_conv;
48152         this_arg_conv.inner = untag_ptr(this_arg);
48153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48155         this_arg_conv.is_owned = false;
48156         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
48157         return ret_conv;
48158 }
48159
48160 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
48161         LDKInvoice this_arg_conv;
48162         this_arg_conv.inner = untag_ptr(this_arg);
48163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48165         this_arg_conv.is_owned = false;
48166         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
48167         return ret_conv;
48168 }
48169
48170 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
48171         LDKInvoice this_arg_conv;
48172         this_arg_conv.inner = untag_ptr(this_arg);
48173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48175         this_arg_conv.is_owned = false;
48176         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
48177         uint64_tArray ret_arr = NULL;
48178         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
48179         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
48180         for (size_t o = 0; o < ret_var.datalen; o++) {
48181                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
48182                 uint64_t ret_conv_14_ref = 0;
48183                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
48184                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
48185                 ret_arr_ptr[o] = ret_conv_14_ref;
48186         }
48187         
48188         FREE(ret_var.data);
48189         return ret_arr;
48190 }
48191
48192 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
48193         LDKInvoice this_arg_conv;
48194         this_arg_conv.inner = untag_ptr(this_arg);
48195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48197         this_arg_conv.is_owned = false;
48198         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
48199         uint64_tArray ret_arr = NULL;
48200         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
48201         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
48202         for (size_t l = 0; l < ret_var.datalen; l++) {
48203                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
48204                 uint64_t ret_conv_11_ref = 0;
48205                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
48206                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
48207                 ret_arr_ptr[l] = ret_conv_11_ref;
48208         }
48209         
48210         FREE(ret_var.data);
48211         return ret_arr;
48212 }
48213
48214 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
48215         LDKInvoice this_arg_conv;
48216         this_arg_conv.inner = untag_ptr(this_arg);
48217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48219         this_arg_conv.is_owned = false;
48220         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
48221         return ret_conv;
48222 }
48223
48224 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
48225         LDKInvoice this_arg_conv;
48226         this_arg_conv.inner = untag_ptr(this_arg);
48227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48229         this_arg_conv.is_owned = false;
48230         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48231         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
48232         uint64_t ret_ref = tag_ptr(ret_copy, true);
48233         return ret_ref;
48234 }
48235
48236 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
48237         LDKStr description_conv = str_ref_to_owned_c(description);
48238         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
48239         *ret_conv = Description_new(description_conv);
48240         return tag_ptr(ret_conv, true);
48241 }
48242
48243 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
48244         LDKDescription this_arg_conv;
48245         this_arg_conv.inner = untag_ptr(this_arg);
48246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48248         this_arg_conv = Description_clone(&this_arg_conv);
48249         LDKStr ret_str = Description_into_inner(this_arg_conv);
48250         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48251         Str_free(ret_str);
48252         return ret_conv;
48253 }
48254
48255 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
48256         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
48257         uint64_t ret_ref = 0;
48258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48260         return ret_ref;
48261 }
48262
48263 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
48264         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
48265         uint64_t ret_ref = 0;
48266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48268         return ret_ref;
48269 }
48270
48271 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
48272         LDKExpiryTime this_arg_conv;
48273         this_arg_conv.inner = untag_ptr(this_arg);
48274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48276         this_arg_conv.is_owned = false;
48277         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
48278         return ret_conv;
48279 }
48280
48281 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
48282         LDKExpiryTime this_arg_conv;
48283         this_arg_conv.inner = untag_ptr(this_arg);
48284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48286         this_arg_conv.is_owned = false;
48287         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
48288         return ret_conv;
48289 }
48290
48291 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
48292         LDKRouteHint hops_conv;
48293         hops_conv.inner = untag_ptr(hops);
48294         hops_conv.is_owned = ptr_is_owned(hops);
48295         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
48296         hops_conv = RouteHint_clone(&hops_conv);
48297         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
48298         *ret_conv = PrivateRoute_new(hops_conv);
48299         return tag_ptr(ret_conv, true);
48300 }
48301
48302 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
48303         LDKPrivateRoute this_arg_conv;
48304         this_arg_conv.inner = untag_ptr(this_arg);
48305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48307         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
48308         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
48309         uint64_t ret_ref = 0;
48310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48312         return ret_ref;
48313 }
48314
48315 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
48316         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
48317         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
48318         return ret_conv;
48319 }
48320
48321 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
48322         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
48323         return ret_conv;
48324 }
48325
48326 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
48327         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
48328         return ret_conv;
48329 }
48330
48331 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
48332         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
48333         return ret_conv;
48334 }
48335
48336 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
48337         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
48338         return ret_conv;
48339 }
48340
48341 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
48342         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
48343         return ret_conv;
48344 }
48345
48346 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
48347         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
48348         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
48349         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
48350         return ret_conv;
48351 }
48352
48353 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
48354         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
48355         LDKStr ret_str = CreationError_to_str(o_conv);
48356         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48357         Str_free(ret_str);
48358         return ret_conv;
48359 }
48360
48361 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
48362         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
48363         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
48364         return ret_conv;
48365 }
48366
48367 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
48368         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
48369         return ret_conv;
48370 }
48371
48372 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
48373         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
48374         return ret_conv;
48375 }
48376
48377 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
48378         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
48379         return ret_conv;
48380 }
48381
48382 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
48383         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
48384         return ret_conv;
48385 }
48386
48387 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
48388         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
48389         return ret_conv;
48390 }
48391
48392 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
48393         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
48394         return ret_conv;
48395 }
48396
48397 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
48398         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
48399         return ret_conv;
48400 }
48401
48402 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
48403         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
48404         return ret_conv;
48405 }
48406
48407 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
48408         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
48409         return ret_conv;
48410 }
48411
48412 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
48413         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
48414         return ret_conv;
48415 }
48416
48417 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
48418         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
48419         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
48420         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
48421         return ret_conv;
48422 }
48423
48424 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
48425         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
48426         LDKStr ret_str = SemanticError_to_str(o_conv);
48427         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48428         Str_free(ret_str);
48429         return ret_conv;
48430 }
48431
48432 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
48433         if (!ptr_is_owned(this_ptr)) return;
48434         void* this_ptr_ptr = untag_ptr(this_ptr);
48435         CHECK_ACCESS(this_ptr_ptr);
48436         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
48437         FREE(untag_ptr(this_ptr));
48438         SignOrCreationError_free(this_ptr_conv);
48439 }
48440
48441 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
48442         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48443         *ret_copy = SignOrCreationError_clone(arg);
48444         uint64_t ret_ref = tag_ptr(ret_copy, true);
48445         return ret_ref;
48446 }
48447 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
48448         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
48449         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
48450         return ret_conv;
48451 }
48452
48453 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
48454         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
48455         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48456         *ret_copy = SignOrCreationError_clone(orig_conv);
48457         uint64_t ret_ref = tag_ptr(ret_copy, true);
48458         return ret_ref;
48459 }
48460
48461 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
48462         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48463         *ret_copy = SignOrCreationError_sign_error();
48464         uint64_t ret_ref = tag_ptr(ret_copy, true);
48465         return ret_ref;
48466 }
48467
48468 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
48469         LDKCreationError a_conv = LDKCreationError_from_js(a);
48470         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48471         *ret_copy = SignOrCreationError_creation_error(a_conv);
48472         uint64_t ret_ref = tag_ptr(ret_copy, true);
48473         return ret_ref;
48474 }
48475
48476 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
48477         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
48478         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
48479         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
48480         return ret_conv;
48481 }
48482
48483 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
48484         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
48485         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
48486         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48487         Str_free(ret_str);
48488         return ret_conv;
48489 }
48490
48491 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
48492         LDKInvoicePayer this_obj_conv;
48493         this_obj_conv.inner = untag_ptr(this_obj);
48494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48496         InvoicePayer_free(this_obj_conv);
48497 }
48498
48499 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
48500         if (!ptr_is_owned(this_ptr)) return;
48501         void* this_ptr_ptr = untag_ptr(this_ptr);
48502         CHECK_ACCESS(this_ptr_ptr);
48503         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
48504         FREE(untag_ptr(this_ptr));
48505         Payer_free(this_ptr_conv);
48506 }
48507
48508 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
48509         if (!ptr_is_owned(this_ptr)) return;
48510         void* this_ptr_ptr = untag_ptr(this_ptr);
48511         CHECK_ACCESS(this_ptr_ptr);
48512         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
48513         FREE(untag_ptr(this_ptr));
48514         Retry_free(this_ptr_conv);
48515 }
48516
48517 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
48518         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48519         *ret_copy = Retry_clone(arg);
48520         uint64_t ret_ref = tag_ptr(ret_copy, true);
48521         return ret_ref;
48522 }
48523 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
48524         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
48525         int64_t ret_conv = Retry_clone_ptr(arg_conv);
48526         return ret_conv;
48527 }
48528
48529 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
48530         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
48531         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48532         *ret_copy = Retry_clone(orig_conv);
48533         uint64_t ret_ref = tag_ptr(ret_copy, true);
48534         return ret_ref;
48535 }
48536
48537 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
48538         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48539         *ret_copy = Retry_attempts(a);
48540         uint64_t ret_ref = tag_ptr(ret_copy, true);
48541         return ret_ref;
48542 }
48543
48544 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
48545         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
48546         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
48547         jboolean ret_conv = Retry_eq(a_conv, b_conv);
48548         return ret_conv;
48549 }
48550
48551 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
48552         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
48553         int64_t ret_conv = Retry_hash(o_conv);
48554         return ret_conv;
48555 }
48556
48557 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
48558         if (!ptr_is_owned(this_ptr)) return;
48559         void* this_ptr_ptr = untag_ptr(this_ptr);
48560         CHECK_ACCESS(this_ptr_ptr);
48561         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
48562         FREE(untag_ptr(this_ptr));
48563         PaymentError_free(this_ptr_conv);
48564 }
48565
48566 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
48567         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48568         *ret_copy = PaymentError_clone(arg);
48569         uint64_t ret_ref = tag_ptr(ret_copy, true);
48570         return ret_ref;
48571 }
48572 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
48573         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
48574         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
48575         return ret_conv;
48576 }
48577
48578 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
48579         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
48580         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48581         *ret_copy = PaymentError_clone(orig_conv);
48582         uint64_t ret_ref = tag_ptr(ret_copy, true);
48583         return ret_ref;
48584 }
48585
48586 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
48587         LDKStr a_conv = str_ref_to_owned_c(a);
48588         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48589         *ret_copy = PaymentError_invoice(a_conv);
48590         uint64_t ret_ref = tag_ptr(ret_copy, true);
48591         return ret_ref;
48592 }
48593
48594 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
48595         LDKLightningError a_conv;
48596         a_conv.inner = untag_ptr(a);
48597         a_conv.is_owned = ptr_is_owned(a);
48598         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48599         a_conv = LightningError_clone(&a_conv);
48600         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48601         *ret_copy = PaymentError_routing(a_conv);
48602         uint64_t ret_ref = tag_ptr(ret_copy, true);
48603         return ret_ref;
48604 }
48605
48606 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
48607         void* a_ptr = untag_ptr(a);
48608         CHECK_ACCESS(a_ptr);
48609         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
48610         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
48611         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48612         *ret_copy = PaymentError_sending(a_conv);
48613         uint64_t ret_ref = tag_ptr(ret_copy, true);
48614         return ret_ref;
48615 }
48616
48617 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) {
48618         void* payer_ptr = untag_ptr(payer);
48619         CHECK_ACCESS(payer_ptr);
48620         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
48621         if (payer_conv.free == LDKPayer_JCalls_free) {
48622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48623                 LDKPayer_JCalls_cloned(&payer_conv);
48624         }
48625         void* router_ptr = untag_ptr(router);
48626         CHECK_ACCESS(router_ptr);
48627         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
48628         if (router_conv.free == LDKRouter_JCalls_free) {
48629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48630                 LDKRouter_JCalls_cloned(&router_conv);
48631         }
48632         void* logger_ptr = untag_ptr(logger);
48633         CHECK_ACCESS(logger_ptr);
48634         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48635         if (logger_conv.free == LDKLogger_JCalls_free) {
48636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48637                 LDKLogger_JCalls_cloned(&logger_conv);
48638         }
48639         void* event_handler_ptr = untag_ptr(event_handler);
48640         CHECK_ACCESS(event_handler_ptr);
48641         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
48642         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
48643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48644                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
48645         }
48646         void* retry_ptr = untag_ptr(retry);
48647         CHECK_ACCESS(retry_ptr);
48648         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
48649         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
48650         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
48651         uint64_t ret_ref = 0;
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48654         return ret_ref;
48655 }
48656
48657 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
48658         LDKInvoicePayer this_arg_conv;
48659         this_arg_conv.inner = untag_ptr(this_arg);
48660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48662         this_arg_conv.is_owned = false;
48663         LDKInvoice invoice_conv;
48664         invoice_conv.inner = untag_ptr(invoice);
48665         invoice_conv.is_owned = ptr_is_owned(invoice);
48666         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48667         invoice_conv.is_owned = false;
48668         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48669         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
48670         return tag_ptr(ret_conv, true);
48671 }
48672
48673 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice_with_id"))) TS_InvoicePayer_pay_invoice_with_id(uint64_t this_arg, uint64_t invoice, int8_tArray payment_id) {
48674         LDKInvoicePayer this_arg_conv;
48675         this_arg_conv.inner = untag_ptr(this_arg);
48676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48678         this_arg_conv.is_owned = false;
48679         LDKInvoice invoice_conv;
48680         invoice_conv.inner = untag_ptr(invoice);
48681         invoice_conv.is_owned = ptr_is_owned(invoice);
48682         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48683         invoice_conv.is_owned = false;
48684         LDKThirtyTwoBytes payment_id_ref;
48685         CHECK(payment_id->arr_len == 32);
48686         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48687         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48688         *ret_conv = InvoicePayer_pay_invoice_with_id(&this_arg_conv, &invoice_conv, payment_id_ref);
48689         return tag_ptr(ret_conv, true);
48690 }
48691
48692 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) {
48693         LDKInvoicePayer this_arg_conv;
48694         this_arg_conv.inner = untag_ptr(this_arg);
48695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48697         this_arg_conv.is_owned = false;
48698         LDKInvoice invoice_conv;
48699         invoice_conv.inner = untag_ptr(invoice);
48700         invoice_conv.is_owned = ptr_is_owned(invoice);
48701         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48702         invoice_conv.is_owned = false;
48703         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48704         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
48705         return tag_ptr(ret_conv, true);
48706 }
48707
48708 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice_with_id"))) TS_InvoicePayer_pay_zero_value_invoice_with_id(uint64_t this_arg, uint64_t invoice, int64_t amount_msats, int8_tArray payment_id) {
48709         LDKInvoicePayer this_arg_conv;
48710         this_arg_conv.inner = untag_ptr(this_arg);
48711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48713         this_arg_conv.is_owned = false;
48714         LDKInvoice invoice_conv;
48715         invoice_conv.inner = untag_ptr(invoice);
48716         invoice_conv.is_owned = ptr_is_owned(invoice);
48717         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48718         invoice_conv.is_owned = false;
48719         LDKThirtyTwoBytes payment_id_ref;
48720         CHECK(payment_id->arr_len == 32);
48721         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48722         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48723         *ret_conv = InvoicePayer_pay_zero_value_invoice_with_id(&this_arg_conv, &invoice_conv, amount_msats, payment_id_ref);
48724         return tag_ptr(ret_conv, true);
48725 }
48726
48727 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) {
48728         LDKInvoicePayer this_arg_conv;
48729         this_arg_conv.inner = untag_ptr(this_arg);
48730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48732         this_arg_conv.is_owned = false;
48733         LDKPublicKey pubkey_ref;
48734         CHECK(pubkey->arr_len == 33);
48735         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
48736         LDKThirtyTwoBytes payment_preimage_ref;
48737         CHECK(payment_preimage->arr_len == 32);
48738         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
48739         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48740         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
48741         return tag_ptr(ret_conv, true);
48742 }
48743
48744 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_pubkey_with_id"))) TS_InvoicePayer_pay_pubkey_with_id(uint64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int8_tArray payment_id, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
48745         LDKInvoicePayer this_arg_conv;
48746         this_arg_conv.inner = untag_ptr(this_arg);
48747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48749         this_arg_conv.is_owned = false;
48750         LDKPublicKey pubkey_ref;
48751         CHECK(pubkey->arr_len == 33);
48752         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
48753         LDKThirtyTwoBytes payment_preimage_ref;
48754         CHECK(payment_preimage->arr_len == 32);
48755         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
48756         LDKThirtyTwoBytes payment_id_ref;
48757         CHECK(payment_id->arr_len == 32);
48758         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48759         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48760         *ret_conv = InvoicePayer_pay_pubkey_with_id(&this_arg_conv, pubkey_ref, payment_preimage_ref, payment_id_ref, amount_msats, final_cltv_expiry_delta);
48761         return tag_ptr(ret_conv, true);
48762 }
48763
48764 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
48765         LDKInvoicePayer this_arg_conv;
48766         this_arg_conv.inner = untag_ptr(this_arg);
48767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48769         this_arg_conv.is_owned = false;
48770         unsigned char payment_hash_arr[32];
48771         CHECK(payment_hash->arr_len == 32);
48772         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
48773         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
48774         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
48775 }
48776
48777 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
48778         LDKInvoicePayer this_arg_conv;
48779         this_arg_conv.inner = untag_ptr(this_arg);
48780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48782         this_arg_conv.is_owned = false;
48783         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
48784         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
48785         return tag_ptr(ret_ret, true);
48786 }
48787
48788 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) {
48789         LDKChannelManager channelmanager_conv;
48790         channelmanager_conv.inner = untag_ptr(channelmanager);
48791         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48792         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48793         channelmanager_conv.is_owned = false;
48794         void* keys_manager_ptr = untag_ptr(keys_manager);
48795         CHECK_ACCESS(keys_manager_ptr);
48796         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48797         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48799                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48800         }
48801         void* logger_ptr = untag_ptr(logger);
48802         CHECK_ACCESS(logger_ptr);
48803         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48804         if (logger_conv.free == LDKLogger_JCalls_free) {
48805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48806                 LDKLogger_JCalls_cloned(&logger_conv);
48807         }
48808         LDKCurrency network_conv = LDKCurrency_from_js(network);
48809         void* amt_msat_ptr = untag_ptr(amt_msat);
48810         CHECK_ACCESS(amt_msat_ptr);
48811         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48812         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48813         LDKSha256 description_hash_conv;
48814         description_hash_conv.inner = untag_ptr(description_hash);
48815         description_hash_conv.is_owned = ptr_is_owned(description_hash);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48817         description_hash_conv = Sha256_clone(&description_hash_conv);
48818         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48819         *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);
48820         return tag_ptr(ret_conv, true);
48821 }
48822
48823 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) {
48824         LDKChannelManager channelmanager_conv;
48825         channelmanager_conv.inner = untag_ptr(channelmanager);
48826         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48827         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48828         channelmanager_conv.is_owned = false;
48829         void* keys_manager_ptr = untag_ptr(keys_manager);
48830         CHECK_ACCESS(keys_manager_ptr);
48831         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48832         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48834                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48835         }
48836         void* logger_ptr = untag_ptr(logger);
48837         CHECK_ACCESS(logger_ptr);
48838         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48839         if (logger_conv.free == LDKLogger_JCalls_free) {
48840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48841                 LDKLogger_JCalls_cloned(&logger_conv);
48842         }
48843         LDKCurrency network_conv = LDKCurrency_from_js(network);
48844         void* amt_msat_ptr = untag_ptr(amt_msat);
48845         CHECK_ACCESS(amt_msat_ptr);
48846         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48847         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48848         LDKStr description_conv = str_ref_to_owned_c(description);
48849         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48850         *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);
48851         return tag_ptr(ret_conv, true);
48852 }
48853
48854 uint64_t  __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(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, int8_tArray payment_hash) {
48855         LDKChannelManager channelmanager_conv;
48856         channelmanager_conv.inner = untag_ptr(channelmanager);
48857         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48858         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48859         channelmanager_conv.is_owned = false;
48860         void* keys_manager_ptr = untag_ptr(keys_manager);
48861         CHECK_ACCESS(keys_manager_ptr);
48862         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48863         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48865                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48866         }
48867         void* logger_ptr = untag_ptr(logger);
48868         CHECK_ACCESS(logger_ptr);
48869         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48870         if (logger_conv.free == LDKLogger_JCalls_free) {
48871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48872                 LDKLogger_JCalls_cloned(&logger_conv);
48873         }
48874         LDKCurrency network_conv = LDKCurrency_from_js(network);
48875         void* amt_msat_ptr = untag_ptr(amt_msat);
48876         CHECK_ACCESS(amt_msat_ptr);
48877         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48878         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48879         LDKStr description_conv = str_ref_to_owned_c(description);
48880         LDKThirtyTwoBytes payment_hash_ref;
48881         CHECK(payment_hash->arr_len == 32);
48882         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
48883         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48884         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref);
48885         return tag_ptr(ret_conv, true);
48886 }
48887
48888 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
48889         LDKChannelManager this_arg_conv;
48890         this_arg_conv.inner = untag_ptr(this_arg);
48891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48893         this_arg_conv.is_owned = false;
48894         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48895         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48896         return tag_ptr(ret_ret, true);
48897 }
48898
48899 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
48900         LDKStr s_conv = str_ref_to_owned_c(s);
48901         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48902         *ret_conv = SiPrefix_from_str(s_conv);
48903         return tag_ptr(ret_conv, true);
48904 }
48905
48906 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
48907         LDKStr s_conv = str_ref_to_owned_c(s);
48908         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48909         *ret_conv = Invoice_from_str(s_conv);
48910         return tag_ptr(ret_conv, true);
48911 }
48912
48913 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
48914         LDKStr s_conv = str_ref_to_owned_c(s);
48915         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48916         *ret_conv = SignedRawInvoice_from_str(s_conv);
48917         return tag_ptr(ret_conv, true);
48918 }
48919
48920 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
48921         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
48922         LDKStr ret_str = ParseError_to_str(o_conv);
48923         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48924         Str_free(ret_str);
48925         return ret_conv;
48926 }
48927
48928 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
48929         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
48930         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48931         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48932         Str_free(ret_str);
48933         return ret_conv;
48934 }
48935
48936 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
48937         LDKInvoice o_conv;
48938         o_conv.inner = untag_ptr(o);
48939         o_conv.is_owned = ptr_is_owned(o);
48940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48941         o_conv.is_owned = false;
48942         LDKStr ret_str = Invoice_to_str(&o_conv);
48943         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48944         Str_free(ret_str);
48945         return ret_conv;
48946 }
48947
48948 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
48949         LDKSignedRawInvoice o_conv;
48950         o_conv.inner = untag_ptr(o);
48951         o_conv.is_owned = ptr_is_owned(o);
48952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48953         o_conv.is_owned = false;
48954         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48955         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48956         Str_free(ret_str);
48957         return ret_conv;
48958 }
48959
48960 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
48961         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48962         LDKStr ret_str = Currency_to_str(o_conv);
48963         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48964         Str_free(ret_str);
48965         return ret_conv;
48966 }
48967
48968 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
48969         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48970         LDKStr ret_str = SiPrefix_to_str(o_conv);
48971         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48972         Str_free(ret_str);
48973         return ret_conv;
48974 }
48975